PhysComp lab, week 2: Analog In

Ah, another brilliant demonstration of my utter lostness in the field of electronics!

Hooked wires and potentiometer

I managed to strip three wires in less than five minutes—a huge improvement over last week—but I still suck at soldering:

Bad soldering

My hands shake a lot, I’ve learned. Also, I can’t see. I had to bring in the nasty fluorescent work light that I use when I’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’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.

The first part of this assignment went smoothly. I had no problem matching my setup to the photo in the instructions, and turning the knob actually did what it was supposed to do. Yay!

Add a potentiometer and LED

Bright vs. Dim
Lit red LED Dim red LED

(I know it doesn’t look very dim, but trust me.)

Swapping in other kinds of variable resistors required my actually thinking, however, and that part didn’t go so well.

I had wanted to get a flex sensor, but the computer store suddenly changed its hours—I guess because we’re three weeks into the semester?—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 other photo, 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.

Aaah. I really need to learn which leg of an LED goes where.

So then both LEDs were lit, and the red one was responding to the photocell, but the green one wasn’t doing squat. I fiddled with the code some more, changing analogWrite(ledB, potValueB/4); to analogWrite(ledB, potValueB*4);, but that didn’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.

Both LEDs off:
LEDs off

Both LEDs on:
LEDs on

Covering the photocell—red LED dims:
Covering the photo cell

Nice nail polish, huh.

Holding the thermistor—green LED dims:
Heating the thermistor

Do I understand why this worked? Absolutely not. But it worked! Woot!

Leave a Reply

Your email address will not be published. Required fields are marked *