Control Fluorescent Lights with a Laser Pointer and an Arduino




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?
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.

Step 2: Wiring the lights

Web Control

Have a look in the ceiling and decide where you will mount the Arduino controller.  Remember that it will need a 7-12v poweer supply. Cut lengths of telephone wire (or cat5 or whatever) about two feet longer than the distance from the Arduino to each light you want to control.

Have a look at the connection from the power lines from the switch into the ballast.  You might be able to order connectors (Newark Electronics sells the Wago 930 series, which is what we had).  Then you won’t need to cut existing wires and can remove the system if something goes wrong.

Solder the ground (black) to the relay input -, and the control (yellow) to relay input + (the color code in the picture is different from what I put on the front page, since I changed my mind about what would make sense).

Solder or screw on (depending on your relay) the black (hot) wire through the relay.  Make sure to use heat shrink and electrical tape!  Push the black wires into your connectors and the white (neutral) and ground (green) are just straight through from connector to connector.

The other end of the wires go to the Arduino as follows:
All the red wires (common cathode or collector) go to Analog 0 (port C0), and all the black to ground.  Each green (anode or emitter) goes to pins 8-13 (port B 0-5) and the yellow wires go to the pins 2-7 (port D 2-7).  Make sure that the green and yellow wires match up, since the sensor needs to control the proper relay!  If you put the yellow into pin 2, the green from the same fixture goes to pin 8.

For more detail: Control Fluorescent Lights with a Laser Pointer and an Arduino




Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
How to use a Stepper Motor

Whether we care to admit it or not, motors can be found all over in our everyday lives; they just...

Close
Scroll to top