A few members of the Alpha One Labs Hackerspace do not like the harsh light given out by fluorescent fixtures.  They wanted a way to be able to easily control the individual fixtures, perhaps with a laser pointer?

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.

Step 1: The Sketch and some Theory

I'll assume you know how to power your Arduino, and get a sketch compiled and loaded in.

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.

great! so you need to buy the ballasts?
First time i ever saw wires soldiered on like that, even if they are bare wires they are typical just shoved into the headers. Glad it works for you.
&nbsp;Too bad there is no picture of the florecent lights . A video would be grat .<br /> Very hard to get an impresion of what was done ...<br /> <br />
There are pictures, and an AVI - are they not showing up for you?<br />
Ohh.. .. thanks - didn't see the Avi before .<br /> <br />
I saw the Avi but in fact still dont know what I saw. A light wnet on and then it went off
Yes, we can see them.<br />
any thoughts on being able to rapidly turn on and off the light without making the ballast mad? way to keep the light warm but off or dim?<br />
Nice!&nbsp; I would have made a shield or something instead of soldering the wires straight to the Arduino, but otherwise this is an awesome project!<br />
&nbsp;I have to tell you, I&nbsp;witnessed&nbsp;that soldering job done in&nbsp;literally&nbsp;20 seconds. &nbsp;As they say &quot;Desperate&nbsp;times call for&nbsp;desperate&nbsp;measures&quot; &nbsp;We were fresh out of header pins and this was the best way at the time to get the wires connected (safely). &nbsp;I bet you will see an update soon once we get some header pins in or possibly a&nbsp;shield. &nbsp; Although I think a shield may be too much for this. &nbsp;Good work on this project by the way! &nbsp;And I can't wait to see the serial interface side of this project when it is done too.

About This Instructable




More by rmd6502:Creating a Bluetooth wireless scrollwheelHow to make a charlieplexed LED heartHow to 3D print a solder stencil!
Add instructable to: