You can build an interactive toy that responds to changing light levels by removing the 10KΩ potentiometer and adding a photocell wired to a 1KΩ resistor of the Adjustable Twin LED Flasher. Wiring a photocell to a 1KΩ resistor allows the Arduino to read light levels applied to pin A0. Figure 4-10 and Figure 4-11 show the Fritzing and circuit schematic diagrams for the Interactive Twin LED Flasher. The MakerShield Interactive Twin LED is shown in Figure 4-12.The photocell leads are bent down to allow FrankenBot’s cardboard head to mount nicely on top of the MakerShield, as shown in Figure 4-13.
Figure 4-10. Interactive Twin LED Flasher Fritzing diagram
Figure 4-11. Interactive Twin LED Flasher circuit schematic diagram
The Adjustable Twin LED Flasher sketch shown in Example 4-2 is used to read the different light levels and change the Arduino’s output flash rate.
Figure 4-12. Makershield Interactive Twin LED Flasher
Figure 4-13. FrankenBot: cut out opening for the photocell and LEDs to pass through cardboard FrankenBot head (left); mount cardboard Frankenbot head on top of MakerShield Interactive Twin LED Flasher (right)
TECH NOTE
The FrankenBot head template can be found on my Arduino Downloads page.
With the Example 4-2 sketch uploaded to the Arduino, FrankenBot’s LEDs will be flashing at a rate based on the surrounding lighting conditions. Place your hand over the photocell and watch the LEDs flash faster. Try different light sources and notice the effect on FrankenBot’s LEDs. As always, record your tests and experiments in a lab notebook!
TROUBLESHOOTING TIP
Check your wiring, the placement of the electronic parts on the breadboard, and the photocell bent leads if the Twin LED Flasher is not working.
Leave a Reply