Arduino based Christmas light controller


8 channels, utilizing solid state relays

I wanted to do something cool with my Christmas lights this year. So after doing some digging around, I ran across the Arduino Uno. I had heard of the Arduino before, but never really looked into it. Once I did, I was sold. Great price, excellent open source philosophy, and really easy to program.

While the Arduino can have up to 19 output channels (if I understand it correctly), I chose to keep it simple (mostly for budget reasons) this year. I’m going to simply run 8 channels. I had originally planned to just run 8 normal Bosch style relays, I probably have that many laying around in my tool box in the garage from past car projects. But I decided against that, simply for ease of assembly, I’d have to setup transistors to fire them, flyback diodes to dampen them, oodles of spade connectors to plug into them. Though I would love to listen to the sound of 8 relays clicking away in harmony. :)

This page is here to document the build, though it’s really pretty simple.

For the relays, I used 8 of these. They are solid state relays, good for about 100watts AC. They’re nice and high impedance, and draw about 17ma, so I can run them directly off the CPU pins of the Arduino with no extra circuitry.

I installed them on a protoboard like this.

I’m going to jump around a bit because I didn’t take enough pictures. :)

First note the blue box, that’s an electrical outlet box from the hardware store. It’s meant to be installed inside of a wall. They’re cheap, and designed to work with this kind of AC voltage.

Second, 4 normal electrical outlets, they’re like 59cents a piece a the hardware store.

Next up, I cut the end off of an old iMac power cord I had laying around from a long since dead iMac. I ran that into the box and stripped back a good 8” of insulation to free up the 3 wires inside. I ran the neutral line to all of the outlets.

Another thing I missed taking a picture of. On the side of the outlets, there’s a little copper bridge between the upper and lower half. I removed those bridges on the live side, effectively turning the 4 pairs into 8 individual outlets.

It might be hard to tell there, but I stripped several inches of insulation off the hot lead from the power cord. This will go to the line of solder you see on the relay board there. I decided my solder bridge sucked, and wanted to be sure I got a good power feed into all the relays.

Yes, I’m soldering with my desoldering iron. Call me lazy, I didn’t want to bring my big soldering station in the house, and it was too cold to solder in the garage. :)

Pretty simple to wire this. One relay per plug. This is the hot side, it goes to the “small blade” on outlets in the US. I numbered the relays, and the plugs to help keep things in order. You’ll see that coming up soon.

Again, I forgot to keep taking pictures as I went. At this point, I had finished the low voltage side of the relays. I have all the negatives joined together into one wire. And then one wire from each relay’s positive to go to the CPU pins on the arduino. The positive trigger wires are wrapped in electrical tape for an extra layer of protection from the nearby high voltage AC. I also have a wire tie into a hole in the corner of the PCB to keep them from even touching the AC side of things.

I mentioned I numbered the relays. I thought it’d be nice to have them numbered in roman numerals. Until I realized that 8 doesn’t fit so well. I had also hooked up the ground line to the outlets at this point.

I have the circuit board down, to keep it away from the AC in the outlets. No need to have it jiggle around and touch the low voltage side to one of the high voltage screws on the outlets.

Numbering the outlets really helped me keep things straight while I was wiring it all up. The relay board fits nicely right behind the outlets, there’s room between the outlets and the relays, but not enough that the relay board can flip over.

I couldn’t find cover plates for 8 outlets at the hardware store. I guess nobody else does this. heheheh. So I bought two really cheap plates. Turns out they’re really brittle, and even if you score them really well, they don’t like to be snapped. It’s good enough, makes the thing safer.

At this point the high voltage side was done, so I plugged it into the wall for a “smoke test”, which it passed. I then  plugged a Christmas light into outlet #1, and used a 9v battery to trigger the relay to make it blink. Success!

The Arduino is going into another electrical junction box, this cover plate is going on that box. I put a button on it so I can change between modes (patterns), the big shaft is a 10k potentiometer (or is it rheostat?), the delay is based directly off the analog reading of this, so it will control the speed of the lights.

This is how I wired it up. It’s hard to see, but there’s a 10k resistor between the +5v feed on the pot and the side of the push button that goes to the CPU pin. That’d be a “pull-up resistor”. The other side of the button goes to ground.

Here’s the way it looked just before I tucked the Arduino into the box.

It fits in there nicely, and you can see the power cord plugged  into the board in the bottom corner of the electrical box.

Everything all connected and running now. One thing to note is it’s not done, I ordered a 7 segment LED and a shift register to run it. That’ll be here by the end of the week. I already have the code added to the sketch to drive it. It’ll display the current mode, which will be real handy when you press the button.

And finally.. Video of it in action.

That was “Mode 5” that came to a grinding halt when my son hit the button. It turns out I had loaded an older version of the sketch onto the controller, a version that had an issue with that mode. It was just too dark out to shoot another video, my camera really doesn’t handle low light conditions well.

I’ll post another update to this page when I have the seven segment LED display working.

and here is the sketch (source).