So, a few weeks ago, I made a gadget that I called the "Ice Breaker". It was a simple persistence of vision toy that would spell out the word "Hello" on your hand as you wave to someone. The original didn't work too well, so I made a new version that works great! Here's a video:
Stick around until the end to see what was going on with the old version.
A Faster Sensor
The main issue with the original version is that the sensor wasn't fast enough. I had the micro controller set up with a hardware interrupt so that it would handle the incoming frequency data with close to zero delay, but unfortunately the incoming data itself was delayed by up to 90ms.
The new sensor I chose was a Sharp GP2S700HCP which is simply an IR phototransistor and IR LED in one package as you can see here (if you have an unreasonable fear of up-close pictures of spiders, you might not want to look):
Anywho, the advantage of this part is its speed, but the disadvantage is that it requires a little more fiddling to get it to work right.
The basic principle is to use a resistor to pull the collector of the phototransistor high. When light hits the phototransistor, it conducts current through the resistor which drops the voltage at the collector junction. You can see my schematic for this part here:
The hard part of this is picking the right resistor values. I didn't want to bother with an ADC, so the idea was to get the collector junction voltage to drop below V-input Low when the light from the diode is reflected back into the phototransistor. As you can see, I have R3 labeled "DNS" which means "Do Not Stuff". The idea was that I had the option of not stuffing the pull up resistor and just using the internal pull ups of the AVR instead. This could potentially simplify the design if it worked.
Unfortunately, it didn't. The internal pull-ups of the ATTiny24 are rated to be anywhere from 20k to 50k. I found that these were too weak and that ambient light in the room was enough to pull the collector junction below V-input Low.
I then started trying different resistor values. My first guess was 10k. This didn't seem to change too much at first because I had forgotten to turn off the internal pull ups. 10k in parallel with 20-50k doesn't look much different than 20-50k.
After turning those off, it seemed that 10k was too small as my IR LED couldn't produce enough light to get a successful low signal from a reflection. It was good that it wasn't responding to ambient light in the room though. To fix it, I decided to drop the current limiting resistor on the LED from 300ohm to the 100ohm you see in the image (this is the same value used on the LEDs).
The end result was perfect! As long as you don't get it super close to a light source, it seems to work just fine (and at that point, you can't see the LEDs anyway, so it's moot). The only downside is that I'm now powering an invisible LED constantly which will decrease my battery life. I'm not too concerned though. I was never really too concerned with battery life, and it appears to be long enough anyway.
I think I've finally got this thing figured out. If you haven't already, take a look at the video above. After a quick demo, I go on to show exactly what was happening with the original version (with some cool After Effects compositing!)
The total cost of these gadgets is less than $5 in parts (not counting the board), so I think I might try slimming them down a little more, ordering pre made boards, and using them as stocking stuffers for the family. Perhaps instead of a "Goodbye" mode, I'll just have it say "Merry Christmas" or something like that.
Project files can be found here: IceBreaker package v1.0