Picture of 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

Picture of Parts You'll Need

SSR Supplies ($7):
MOC3031 Optocoupler (8)

Light Controller Supplies ($61):
Arduino Duemilanove

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)
Diagonal Cutters
Wire Strippers
SD Card (any size, I used 64MB)
Electrical Tape
Power source for Arduino (I used an extra powered USB hub I had)
Hot glue gun
Wire nuts (optional)

1-40 of 67Next »
kldewitt878 months ago

Can you recommend any particular FM transmitter? I know you made yours. I just haven't quite found what I'm looking for in that way of one.

Thanks so much for your help!

MRedmon (author)  kldewitt878 months ago
No, any should work.
I finally managed to find the one I wanted. Thanks! :)
kldewitt879 months ago

The link for the optocoupler no longer shows anything on the website. Which one do you recommend as a substitute? Also, are the numbers in parentheses supposed to be how much of each you thing you need?

Thank you!

MRedmon (author)  kldewitt879 months ago

I'll update the link. You can always search for the part number... they still carry the exact one I used:


Yes, the numbers in parentheses is the number needed (though read through the Instructable because you might want more).

rdgrahamjr1 year ago
This is pretty cool light controller. I am sharing this on my blog rdgraham.com for my share a post Sunday.
Hi, I'm a newbie and I bet this must be obvious but which MOC3031 do I choose?

I have pictures below of the options.
Screen Shot 2013-12-06 at 10.31.24 PM.jpgScreen Shot 2013-12-06 at 10.31.47 PM.jpg
dreos1 year ago
Just wanted to say thank you and thank Lady Ada. Followed the directions with a few exceptions (bought the SSR's built) and this works perfectly. My kids are going to go nuts. Many thanks. I can't wait until the next project. The Barron Fourier and Kings of Leon
SadPanda2842 years ago
I am somewhat new to this hobby, & wanted to started with a slightly smaller version of this project, namely setting up my christmas tree lights (on a prelit tree) to flash to music played on speakers. I was hoping you could tell me how I could alter your project to work (if it's even possible), what items I would need from your list, etc. Also, I wanted to know, if I were to successfully make my idea a reality, is it still possible to set my lights back to run normally, without the arduino & such attached? I hope you can help me! Thanks!
MRedmon (author)  SadPanda2842 years ago
It's possible with no modification - instead of plugging an FM transmitter into the music shield, just plug in powered speakers (such as those made for computers). To make your lights run "normally" you could just unplug them and plug them into a power strip. You could also leave everything plugged into the controller but re-flash the Arduino with a new program that just leaves the lights on constantly. If you wanted to do that, you could flash Christmas_Lights_2010_Channel_Test.pde from Step 6 but change the loop to read:

void loop() {
for (int i = 0; i < channelsLength; i++) {
digitalWrite(channels[i], HIGH);
wirenut19803 years ago
Great work! Looks Awesome!
MRedmon (author) 3 years ago
Got my lights up last weekend and finished hooking up the lighting controller today. I still need to play around with the code a bit but at least everything is up and working.
MRedmon (author)  MRedmon3 years ago
I was messing around with the settings... I think I'll probably put them back to the old settings.


Okay, I must be doing something wrong. I built the circuit using the larger Triacs (4A 400V) and for some reason the lights just don't blink. They just stay lit. On every channel just on never off. I've tried the test sketch with the same results. Lights on, never off. Is it possible I've mis-wired something? Is the pin layout on the larger Triacs different than the ones you used? The Christmas Sketch loops through the SD card nicely and plays all of the songs, but no joy on the lights. Any ideas where I screwed-up?

I am having the same issue with my board. All the channels but one stay on. Did you ever get yours figured out? (I used the same parts as the MRedmon)
MRedmon (author)  merkidemis3 years ago
Have you tested the AC side with a multimeter? Can you post photos (especially close-ups of the triacs and optocouplers)? What happens if you (safely) short pins 4 and 6 of the optocoupler?
MRedmon (author)  MRedmon3 years ago
Sorry... I meant short pins 5 and 6 of the optocoupler. I forgot that the order goes: 6 4 5
Here are the images (Warning: 18 megapixel)

The pins on my optocoupler are thus (Mouser lists the one in your how-to as obsolete):
1 6
2 5
3 4

Datasheet is here:

Given that, which pins should I short?
MRedmon (author)  merkidemis3 years ago
The photos look good... I don't see anything questionable. You could short pins 4 on your optocouplers to check that the high voltage side is working correctly. If it isn't then I'd try turning one of the TRIACs around (swap the pins going to the optocoupler and out to the lights but keep the gate pin going to the optocoupler).
MRedmon (author)  GoranUvDenRimboe3 years ago
Hmm... that sucks. The 4A triacs should be controlled the exact same way as the ones I used. Can you post photos of the circuit (front/back)? The first thing I would do is check and see what the voltage is between ground and the Arduino outputs for each channel (a mis-wire could lead to voltage being applied across the channels at all times, regardless of which channels are being turned on/off on the Arduino). You could also run the following program (untested):

int channels[]={6,7,8,15,16,17,18,19};
int channelsLength = 8;

void setup() {
for (int i = 0; i < channelsLength; i++)
pinMode(channels[i], INPUT);

void loop() {
for (int i = 0; i< channelsLength; i++) {
int channel = channels[i];
int sensorValue = digitalRead(channels[i]);
Serial.print("Channel ");
Serial.print(" reads ");
Serial.print(". ");
Serial.print(10, BYTE);
I found a pinout for the 4A triacs. From left to right counting the pins, pin 3 is the gate. I had at first wired pin 2 to the optocoupler thinking it was the gate. I've gone through and resoldered the triacs making pin 3 go to the optocouplers. However now nothing turns on.

I've attached images of the front and back of the pcb.
I added a third ground wire since my plug used the third gound.
So I've also added an extra wire block to handle the extra ground wire.
I also ran the plugs for the lights to actual outlet plugs.
The four plugs fit nicely in a four gang box and the green common ground from all of the plugs goes to the new ground block.

The common wire for the plugs is red and that goes to the wire block where the plug is attached. The black wires all run to the gang box to connect each single plug socket.

Thanks for the assist.

MRedmon (author)  GoranUvDenRimboe3 years ago
I can't see any reason why it shouldn't be working. Have you been able to determine whether the optoisolators are switching correctly? What happens if you (safely) short pins 4 and 6? Is there voltage between neutral and the A1 of each TRIAC? Do both pins 1 (A1) and 3 (G) connect to the optoisolators? Is there voltage between pin 2 (A2) and neutral? After having it plugged in for a while and then unplugging it, is there a component that feels hot?
MRedmon (author)  MRedmon3 years ago
Sorry... I meant short pins 5 and 6 of the optocoupler. I forgot that the order goes: 6 4 5
I had a thought as I was checking things with the multimeter. Is it possible that the circuit just isn't sending enough of voltage to trigger the Triacs? Since I used the upgraded ones you mentioned and not the ones you first used to build with, that is about the only thing that makes sense. I tried to look at the specs pdf at mouser but I get a file not found error. So I'm wondering if that is what the problem is. When you measure the trigger voltage what do you get for a reading?

MRedmon (author)  GoranUvDenRimboe3 years ago

Minimum trigger voltage for the Z0405 TRIAC is 1.3v so I don't think you should have a problem there (the Arduino is operating at 5v).
MRedmon (author)  MRedmon3 years ago
MRedmon (author)  GoranUvDenRimboe3 years ago
Just to be certain, I measured it... I saw a max of 4.7v on my multimeter.
MRedmon (author) 3 years ago
It may or may not help the two people having problems but as a test I have hooked up one of the 4A TRIACs as an example in a breadboard to make sure everything is working as expected (and it does). I've attached 2 photos and the video of it working can be found at:
2011-12-13 19.40.46.jpg2011-12-13 19.40.59.jpg
MRedmon (author)  MRedmon3 years ago
kate55933 years ago
Hi Matt,

This project is great. I would like to apply it to lighting just our indoor Christmas tree. I'm a newbie so I'm not sure how to streamline the project. If I were to use just 3-4 sets of lights, what would I cut out as far as other parts? Thanks so much for any advice you can offer.
MRedmon (author)  kate55933 years ago
Instead of getting 8 of each of the following you could get 3-4 (as many sets of channels as you would like):

MOC3031 Optocoupler
Both resistors mentioned above

You could also do away with the fm transmitter and hook up a powered speaker instead.

In Christmas_Lights_2010.pde change the following:

int channels[]={6,7,8,15,16,17,18,19};
int channelsLength = 8;


int channels[]={16,17,18,19}; // or other 3-4 inputs that you want to use
int channelsLength = 4; // or 3 if you only want 3 channels
Thanks so much for your quick response. I'm still gathering parts. So if I end up with 4 channels, is that 10 wire terminals?

And one more rookie question: can I substitute a different optocoupler for the ones you specified above? That part seems to be on backorder for the suppliers I looked at.

Thanks again.
MRedmon (author)  kate55933 years ago
You sure can. Any optocoupler that can be triggered by 5V or less with 20mA of current or less and can handle the AC at whatever voltage you are using (110/220/etc) will work, I believe. Of course, if you want the same one, Mouser has them in-stock:

squirtdad3 years ago
ok I am not an electronics guy but I am trying. Where is the FM transmitter connected.....for the life of me I don't see it. Also could you use the same connection for a simple jack and then plug the output into speakers?

MRedmon (author)  squirtdad3 years ago
In the upper-right photo in Step 1 you can see a headphone/speaker cable plugged into the jack that the FM transmitter would plug into (it's black and rectangular). You could also plug in speakers to it (you'd probably need amplified speakers).
robotjam4 years ago
MRedmon, I was wondering if there were a way to add 1 normally open pushbutton switch to advance to the next song on the SD card. For example lets say that I have 15 songs on the card and I want to listen to the 7th song, as it is setup right now I woulld have to listen to the first 6 songs to get to the one I want, I think it would be nice if I could just push a button 6 times to advance through the first 6 tunes and play the 7th tune, the one i want to hear and see at that moment.
Also would there be a way to add some sort of potentiometer to the circuit to adjust the sensitivity? Like attach it to the common ground wire or something.
Sorry to keep bugging you about this but I think we could make this thing really cool (not that it's not now), I think I have some good ideas but I just have no idea on how to implement them.
MRedmon (author)  robotjam3 years ago
I don't see why you couldn't do that... I haven't gotten back into the Arduino frame of mind just yet but glancing at the code make it seem like you could connect D0/D1 (can't be used if you are using serial communication like in my example sketch) or D9 to the normally open push button switch.

I don't see any reason why you couldn't replace the 1.5K resistor from A0 to R7 with a potentiometer. Maybe a 6k pot? You might just have to experiment. It could probably be done in software somehow, too.... perhaps another push button to switch between a given number of preset sensitivity levels (though you are limited in the number of inputs available... you'd have to give up serial communications or add a shift register if you wanted 2 push button switches... but with a shift register you could a LOT more channels).
mojarabm24 years ago
Buddy , lets check out your design again,
why did you draw connectors as common between two triacs?
i can not understand ! let me know about your imaged , or i would show other ways to you , then you may love to make it better.
MRedmon (author)  mojarabm23 years ago
I don't understand the exact reason why these work... I put them together from different projects and built them as diagrammed. And they work.
wootin243 years ago
I have a quick question.
My question is do i have to make a new program for every song it does or does it manualy sync the music with the light.please help me because I'm thinking about making one for the holidays. Also will this work with my solid state relays that have a input of 3 to 8 volts and a controll of 120 volts. Thanks for the help, ps, iam only 14 so keep it in easy to uder stand terms.
1-40 of 67Next »