I started testing the ideas for the design of my stupid pet trick today, starting with the IR sensor. I couldn’t find the one I was looking for at the computer store:
Instead I got these, the SEN 00241:
I’m not sure if they work as well, but I like that they are smaller and more discreet. It seems like they will work with just a couple of holes in the front of the frame, instead of a big black brick being visible in the front. Though, so far I can’t tell exactly what the best angle for sensing is. See this video where I use my cell phone to dim an LED:
Uh oh. I got an email from Tom Igoe saying that this sensor only works for a few inches, while the other sensor will work for several feet, which is more of what I need.
Also, just had a thought on the train over here that the lights should ease on and off, so they don’t just flicker or all of a sudden appear if something jumps in front of the sensor. But maybe that would be cool too.
Anyway, here are a couple of shots of the set up from today:
And a schematic of the circuit:
Also, here are some sketches I did while I was eating dinner for the figures.
Oh, and my Arduino code:
const int ledPin = 11;
int aVal = 0;
int brite = 0;
//read analog signal
aVal = analogRead(A0);
brite = map(aVal, 0, 150, 0, 255);
//write to led