Introduction: Christmas Lights to Music Using Arduino
My wife and I have wanted to create our own lights-set-to-music show for the last few holiday seasons. Inspired by the two Instructables below, we decided to finally get started this year and decorate our RV. We wanted an all-in-one controller (lights AND music) but didn't need it to be controllable over the internet, making it a little different than the other two Instructables.
Video to come!
Sources I've Used:
Arduino Christmas Light Controller
xmas-box: Arduino/ioBridge internet controlled Christas lights and music show
Solid State Relays (SSRs) Using TRIACs:
Step 1: Parts You'll Need
FM Transmitter - I made one (shown in the photos below) but any will work ($15+)
RadioShack B&M ($14):
Wire Terminals (3 packages, 12 connectors) 276-1388
Printed Circuit Board 276-147 (could use smaller)
330ohm Resistors (2x 5-packs)
150ohm Resistors (2x 5-packs)
Home Depot B&M ($25):
50 ft Landscape/Sprinkler Wire (18ga, 7 conductor) 079407238170
6' Power Cords (x8 minimum, to use the female 120v connectors)
-you may need more than 8, depending on the locations of your lights; I used 11
Clear Plastic Box (my Dollar Tree was out but HD had these for $0.87)
Soldering Iron (I use a butane-powered BernzOmatic from Home Depot; doubles as a heat gun)
Solder (highly recommended: Soldering Paste)
Screwdrivers (philips for WaveShield, standard for wire terminals)
Wire (for WaveShield and connecting to the SSRs, I used extra breadboard jumper wires I had)
SD Card (any size, I used 64MB)
Power source for Arduino (I used an extra powered USB hub I had)
Hot glue gun
Wire nuts (optional)
Step 2: SSR Board
Solid State Relay Board
If you like, you can also view full-size copies of my schematic and board.
I started by placing all the components on the board. When I was satisfied with how they were laid out, I started by soldering all the items to the board that didn't need extra wire (basically, everything but the ground from the Arduino and the 120v hot line). I then soldered the common grounds/hot wires. As you can see from the bottom of the board, it looks rather messy.
When finished, I tested each SSR separately by hooking up the 120v power and measuring across the neutral and each switched hot output while I put a 5v source across the Arduino side of the board.
Step 3: Add the Arduino
I used a hot glue gun to secure the Arduino board to the SSR PCB.
If you decide to solder an FM transmitter directly to the PCB, you can add it in the extra space in the bottom left of the photo below. Otherwise, you can also plug in any generic FM transmitter.
Step 4: Construct the WaveShield
Follow the excellent directions at Lady Ada to construct the WaveShield kit. I used the default control pins (2 - LCS, 3 - CLK, 4 - DI, 5 - LAT, 10 - LCS). I also connected pin A0 to the 1.5k resistor at R7 (see photo below).
When finished, follow the directions here to prepare songs and transfer them to your SD card. Place the card in the WaveShield when finished.
Step 5: Connect to the SSRs
I used the extra breadboard jumper wires I had to connect the following:
WaveShield (these can be changed but I used the defaults)
D2 - LCS
D3 - CLK
D4 - DI
D5 - LAT
First 3 SSR Channels
D6 - Channel 1
D7 - Channel 2
D8 - Channel 3
D10 -> LCS
WaveShield - SD Card (cannot be changed)
Gnd - SSR Ground
A0 - Connect to R7 (1.5K resistor) on the WaveShield to measure output from amplifier.
Remaining 5 SSR Channels
A1 = D15 - Channel 4
A2 = D16 - Channel 5
A3 = D17 - Channel 6
A4 = D18 - Channel 7
A5 = D19 - Channel 8
Step 6: Upload Sketch and Test Everything
I used a short length of the landscape wire to test the setup. I connected the black wire to the neutral wire terminal, and each of the other six conductors to the first six SSR hot wire terminals. On the other end of the landscape wire, I connected all the neutrals to the black conductor and each of the other six conductors to the hot wire of each of six female electrical outlets (see photo below). To supply power, I connected one of the six foot male power cords left over from harvesting the female connectors into the 120v input wire terminals (see photo below)
I used xmas_box.pde from here and set debug to true while testing everything. I plan on editing the code once I get everything set up outside but for now it works without modification.
Update 2010-06-22: I've attached a 7-zip file containing code I might have used (besides the original code from above). I'll upload new code later this year when I put the controller back together and implement some of the ideas I had for future expansion.
Update 2010-12-11: I've re-written the program using the daphc example from the WaveHC library and the VuMeter code from the xmas_box Instructable linked above. It will now play any song it finds on the WaveShield's SD card in a continuous loop. The program is Christmas_Lights_2010.pde below. I've also included Christmas_Lights_2010_Channel_Test.pde which just cycles through all 8 channels so you know that they work.
Step 7: Put It All in a Box
I started by hot gluing the circuit board into the clear plastic tub.
I had an extra powered USB hub laying around so I decided to use that to power the Arduino. I hot glued the power adapter for the hub into place and plugged the 11th 6' extension cord (the only one not cut up) into it. I also glued the hub in place. Into the opposite side of the extension cord, I plugged in the circuit board's 120v plug. The USB cord going to the Arduino from the hub is a $1 extend-able cord from Dollar Tree but any USB cord would work.
To run the cords through the side of the tub, I used my soldering iron with the tip removed (effectively a mini heat gun) to melt away the plastic. I then used hot glue to secure the cords in place. I did this with the lights' power cords (top of the picture below) and the power cord for the board (bottom).
I finished it up by using wire nuts to connect the power going out to all the lights to the test wires I had already hooked up (adding an additional two for the 7th and 8th channels). Add the lid and you're all set. Should be waterproof-enough for me and it's protected by the front steps of my RV.
Step 8: Hook Up Christmas Lights
Run the landscape cables to all of the lights and wire the female 120v connectors. Each connector is connected to both the black wire and one of the six colors (one for each channel in the cable). I ended up running two lengths of cable (to cover all 8 channels).
You may need more than one female 120v connector per channel. I used two per channel for both my miniature trees and my reindeer (there is one on each side of a central Christmas tree).
Step 9: Ideas for Changes
There are 3 extra pins on the Arduino available to add extra channels. I'll probably add these three next year (or go with both of the next two options).
Use higher-powered TRIACs, such as the 4A Z0405
-as long as you are using LED lights, 1A should be PLENTY
Use a shift register so that you can have more than 11 channels.
Participated in the
Homemade Holidays Contest