I got right on it. I dug out a pile of solid state relays and brought them to the Lab. I bought an Arduino Duemilenova and demonstrated the use of the LED Blink example sketch to actually blink a halogen lamp. I found some info on using LEDs as light sensors [1] and an Arduino sketch demonstrating the technique[2].
I found that the LEDs were not nearly sensitive enough - the laser had to point straight into the light emitting part, or the LED wouldn't register. So I switched to phototransistors. They are much more sensitive, and over a wider range of frequencies. With the proper filter over the transistor I could make it more sensitive to red light, and from a much wider range of angles to the sensor.
DISCLAIMER AND WARNING: This instructable deals with line (mains) voltage at 120 or 240 volts. Use common sense if you build this circuit - if you have a doubt about something, ask someone who knows. You are responsible for your (and others') safety, and compliance with local electrical codes.
Remove these ads by
Signing UpStep 1: The Sketch and some Theory
For each lamp I use telephone cable, since it's cheap, has four conductors, and I had a bunch laying around anyway. I used red for common +, black for ground, green for the phototransistor collector, and yellow for the relay control +.
A phototransistor passes an amount of current that varies with the amount of light falling on it. The Analog to Digital Converter (ADC) in the arduino measures the voltage at the pin relative to ground. I looked at the phototransistor data sheet and verified with a multimeter that the transistors pass 10mA at full light. Using Ohm's law, that's about 500 ohms at 5V,
To control the lamps I used a solid state relay module. These are relatively cheap at the current rating we needed, about $4 for up to 4A. Make sure to buy relay modules with a zero-crossing detector, especially if controlling anything inductive, like a fluorescent light, motor, or wall-wart transformer. Switching them on or off anywhere but the zero point could cause voltage spikes which at best will reduce the life of your appliance, and at worst start a fire.
hexaled.pde5 KB





































Visit Our Store »
Go Pro Today »




Very hard to get an impresion of what was done ...