{"id":19,"date":"2008-09-18T03:42:07","date_gmt":"2008-09-18T07:42:07","guid":{"rendered":"http:\/\/itp.nyu.edu\/blogs\/ia303\/2008\/09\/18\/analog-in\/"},"modified":"2008-09-25T05:13:10","modified_gmt":"2008-09-25T09:13:10","slug":"analog-in","status":"publish","type":"post","link":"https:\/\/itp.indiamos.com\/blog\/2008\/09\/18\/analog-in\/","title":{"rendered":"PhysComp lab, week 2: Analog In"},"content":{"rendered":"<p>Ah, another brilliant demonstration of my utter lostness in the field of electronics!<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/indiamos\/2867514134\/\" title=\"Hooked wires and potentiometer, on Flickr\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/farm3.static.flickr.com\/2367\/2867514134_87296b1224.jpg?resize=400%2C300\" width=\"400\" height=\"300\" alt=\"Hooked wires and potentiometer\" data-recalc-dims=\"1\" \/><\/a> <!--more--><\/p>\n<p>I managed to strip three wires in less than five minutes&#8212;a huge improvement over last week&#8212;but I still suck at soldering:<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/indiamos\/2866683113\/\" title=\"Bad soldering, on Flickr\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/farm4.static.flickr.com\/3250\/2866683113_43d741d9f7.jpg?resize=400%2C300\" width=\"400\" height=\"300\" alt=\"Bad soldering\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>My hands shake a lot, I&#8217;ve learned. Also, I can&#8217;t see. I had to bring in the nasty fluorescent work light that I use when I&#8217;m doing proofreading, and even then I had to get my eyes down so close to what I was soldering that I almost soldered my face. Another thing I&#8217;ve learned thus far is that you basically get one chance at making each join. If you mess up on the first try, any attempts to fix it just seem to make matters worse. And smoky.<\/p>\n<p>The first part of <a href=\"http:\/\/itp.nyu.edu\/physcomp\/Labs\/AnalogIn\">this assignment<\/a> went smoothly. I had no problem matching my setup to <a href=\"http:\/\/itp.nyu.edu\/physcomp\/uploads\/arduino_pot_led.jpg\">the photo in the instructions<\/a>, and turning the knob actually did what it was supposed to do. Yay!<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/indiamos\/2866683683\/\" title=\"Add a potentiometer and LED, on Flickr\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/farm4.static.flickr.com\/3164\/2866683683_52a49b459c.jpg?resize=400%2C300\" width=\"400\" height=\"300\" alt=\"Add a potentiometer and LED\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Bright vs. Dim<br \/>\n<a href=\"http:\/\/www.flickr.com\/photos\/indiamos\/2867516464\/\" title=\"Lit red LED by indiamos, on Flickr\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/farm4.static.flickr.com\/3183\/2867516464_710847b24a_m.jpg?resize=240%2C180\" width=\"240\" height=\"180\" alt=\"Lit red LED\" data-recalc-dims=\"1\" \/><\/a> <a href=\"http:\/\/www.flickr.com\/photos\/indiamos\/2867516756\/\" title=\"Dim red LED by indiamos, on Flickr\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/farm4.static.flickr.com\/3033\/2867516756_6562fe171f_m.jpg?resize=240%2C180\" width=\"240\" height=\"180\" alt=\"Dim red LED\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>(I know it doesn&#8217;t look very dim, but trust me.)<\/p>\n<p>Swapping in other kinds of variable resistors required my actually thinking, however, and that part didn&#8217;t go so well.<\/p>\n<p>I had wanted to get a flex sensor, but the computer store suddenly changed its hours&#8212;I guess because we&#8217;re three weeks into the semester?&#8212;and was closed five minutes before I arrived. So no Hug-O-Meter for me. Instead, I rewired the board with a photocell, a thermistor, and two LEDs, per the <a href=\"http:\/\/itp.nyu.edu\/physcomp\/uploads\/bb_dualflex_b.jpg\">other photo<\/a>, and then changed the code accordingly. Only one of the LEDs was responding, though, and it was the wrong one. Covering the photocell made the green LED dim instead of the red one. So I fiddled with the code a bit, checking the Serial.print output to see if the thermistor was doing anything at all, and eventually I turned around the red LED.<\/p>\n<p>Aaah. I really need to learn which leg of an LED goes where.<\/p>\n<p>So then both LEDs were lit, and the red one was responding to the photocell, but the green one wasn&#8217;t doing squat. I fiddled with <a href=\"http:\/\/itp.indiamos.com\/PhysComp\/week2\/Analog_In_Arduino_code.txt\">the code<\/a> some more, changing  <code>analogWrite(ledB, potValueB\/4);<\/code> to   <code>analogWrite(ledB, potValueB*4);<\/code>, but that didn&#8217;t do anything. So I took out the resistor (a 220) that was adjacent to the thermistor, and the Serial.print numbers shot up and the LED got a lot brighter. So then I swapped in different resistors: 10 was no good, 100 was no good, but 1,000 did the trick: finally, the changes in brightness were visible.<\/p>\n<p>Both LEDs off:<br \/>\n<a href=\"http:\/\/www.flickr.com\/photos\/indiamos\/2866686143\/\" title=\"LEDs off by indiamos, on Flickr\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/farm4.static.flickr.com\/3053\/2866686143_be41227fd4_m.jpg?resize=240%2C180\" width=\"240\" height=\"180\" alt=\"LEDs off\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Both LEDs on:<br \/>\n<a href=\"http:\/\/www.flickr.com\/photos\/indiamos\/2866686345\/\" title=\"LEDs on by indiamos, on Flickr\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/farm4.static.flickr.com\/3138\/2866686345_3ca5363b38_m.jpg?resize=240%2C180\" width=\"240\" height=\"180\" alt=\"LEDs on\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Covering the photocell&#8212;red LED dims:<br \/>\n<a href=\"http:\/\/www.flickr.com\/photos\/indiamos\/2867518142\/\" title=\"Covering the photo cell by indiamos, on Flickr\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/farm4.static.flickr.com\/3099\/2867518142_a64a576f70_m.jpg?resize=240%2C180\" width=\"240\" height=\"180\" alt=\"Covering the photo cell\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Nice nail polish, huh.<\/p>\n<p>Holding the thermistor&#8212;green LED dims:<br \/>\n<a href=\"http:\/\/www.flickr.com\/photos\/indiamos\/2867518330\/\" title=\"Heating the thermistor by indiamos, on Flickr\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/farm4.static.flickr.com\/3295\/2867518330_61d915394c_m.jpg?resize=240%2C180\" width=\"240\" height=\"180\" alt=\"Heating the thermistor\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Do I understand <em>why<\/em> this worked? Absolutely not. But it worked! Woot!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ah, another brilliant demonstration of my utter lostness in the field of electronics!<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[12,11,4,8,6],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3qY10-j","_links":{"self":[{"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/posts\/19"}],"collection":[{"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":1,"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":53,"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/posts\/19\/revisions\/53"}],"wp:attachment":[{"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itp.indiamos.com\/blog\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}