Instructables
Picture of Computer Controlled Musical Christmas Lights
In this Instructable, i am going to teach everyone the basic steps of how to build your own computer controlled musical Christmas lights. This setup is very simple and common. Within a few hours, you too can build your own light display for the holidays/new year!

First, lets go over how it works. A computer is connected to a micro-controller which pulses electricity into a relay circuit attached to a series of lights called "channels". Each channel when pulsed with electricity, will give power to your light source. As you choose which songs to play on your computer, you can choose what you want to display by programming your micro-controller.

Since we aim for fun and simplicity, we will be using an Arduino for our micro-controller. If you don't know what is an Arduino, then please visit this website (www.arduino.cc) and buy one online or at your local Radioshack.
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts and Materials

Picture of Parts and Materials
If you are a tech-savy person who can work with soldering equipments and have basic knowledge of circuitry, you will find this project easy to make. On the other hand, if you have never done any electrical work in your life, I advise you to get on Google and learn how to solder, or contact an electronics expert. This Instrutable does utilize high voltage current, therefore you are advised to use caution when working with such equipment. *I shall take no liability of any damages or injury that may occur due to this project*

Now that we're clear, lets move on. Below are a list of parts and materials that you will need:

-Arduino Duemilanove (About $30 on Amazon)

-USB Cable ($1 at any Dollar Store)

-Windows Computer (preferably a laptop)

-6 relays; rated at 5v  ($4 each at Radioshack)

-Assorted LEDs  ($3 at Radioshack)

-220-OHM Resistor for LEDs  ($3 a pack at Radioshack)

-Soldering PCB  ($5 at Radioshack)

-6 of 3-pronged female outlets  ($30 total at Walgreens; hardware isle)

-A 3-pronged male outlet  ($5 at Walgreens)

-Plastic Box enclosure  ($1 at any Dollar Store)

-Plywood  ($3 at a Hobby Store or Hardware store)

-Hot glue and hot glue sticks  (Salvaged)

-6 Common Black 1N4004 Diodes ($4 at Radioshack)

-Solder and Soldering Iron  (Salvaged)

-Scrap wires
1-40 of 50Next »
angello11 month ago

http://arduino.cc/en/tutorial/ShiftOut

Do you think I could use that to make more channels?

JAEmanuel4 months ago

Would this setup work with a Arduino Uno? I know I would have to change the code, but if I hooked it up could it handle everything alright?

dnicky2288 (author)  JAEmanuel4 months ago
Arduino Uno would work fine. It's basically the same thing as Arduino Duemilanove.
Great! Thanks!
cubbydebry1 year ago
I just had a quick question, on the diagram with the relays which wires are the positive output and which ones are the negative return?
dnicky2288 (author)  cubbydebry1 year ago
When you are handling AC power, there are no "positive" or "negative". So in other words, the relay can be attached either way, as long as the contacts for 120v are not mixed up with the 5v ones. If you are not sure about your relay, then don't do the project otherwise it will risk your life if you get shocked.
dnicky2288 (author)  cubbydebry1 year ago
If your Relays did not come with a "wiring diagram", then you would have to test them by using LOW voltage, such as applying 5v to 2 terminals and determining which pins are switched on when you do that.
dnicky2288 (author)  cubbydebry1 year ago
A relay is a switch that is triggered by an electromagnet field. You can solder the positive and negative to either side you choose (as long as you do the same for all relays).
lmedeiros21 year ago
In your diagram doesn't show we're to conect the diods
techno guy1 year ago
are the 5 volt relays really able to switch that much power?
I think your confusion is just in the naming convention. You might be expecting a "5V Relay" to be a relay capable of switching 5V, but in this case, these are high power relays capable of switching 120V AC. However, they can be controlled (turned on/off) by a low current, 5V source, and that is why the author called them 5V relays. Do not attempt to do this with a relay incapable of handling high power unless you like to see things go boom.
I know about these things, I was just wondering if the contacts on a relay this small were able to handle switching power from an outlet
Well, that's the point. You need to find relays that say they are rated for high power AC but can still be switched with 5V DC. If the part specifications say that it can, then it can (or at least should). Of course, you also have to consider the size of the pad you are soldering the contact to, or if you can use a connector instead to attach a wire straight to the contact instead.
dnicky2288 (author)  Kurt E. Clothier1 year ago
Kurt, if this was Facebook, I would "Like" that comment!
dnicky2288 (author)  Kurt E. Clothier1 year ago
Hahaha its like you've read my mind and typed it for me: " unless you like to see things go boom"...
dnicky2288 (author)  techno guy1 year ago
Yes. In simple terms, relays are actually switches that are controlled by an electromagnet. The electromagnet is small enough to be accept a 5 volt input. Once you apply 5-volts, then the electromagnet attracts the switch terminal, thus connecting the circuit. Since the switch is not related to the 5-volts you provided, you can switch great amounts of electricity without affecting the Arduino (in our case).

And "are they really able?"...um yes...you see my project is working...so its pretty obvious that with the right type of Relay, then it should work.
This is a nicely put together Instructable. I really love the concept, but I think that beginners should stick to LEDs... working with live A/C lines is not something that should be taken lightly.

As far as the circuit goes, I have a few electrical concerns. People need to understand that it takes a special relay to control A/C power. Automotive relays will not work because they are meant for DC operation. Secondly, I wonder what the power rating for the contacts, board, and connecting wire are. A 100 bulb strand of traditional Christmas Lights can easily consume 500 Watts (drawing over 4 amps). This compounds as more strands are linked together. The relays have to be able to handle at least this much power, and the supply wires need to be able to handle the total amount of potential current draw. Also, the contacts on a typical prototype board cannot handle very much current either. If these things are operating near their max power ratings, they will be getting very hot and need some cooling system in place to prevent fried parts or a fire.

As far as adding more channels, just use a serial in/parallel out shift register or I/O expander chip. There is really no reason to use an Arduino here unless that is all someone knows how to do. And in that case, they probably shouldn't be messing with high power stuff anyway.

I'm not trying to sound like a know-it-all or anything; I really do like this instructable. It's just that I'm an electrical engineer, and I cringe when people "tinker" with lethal levels of electricity.
dnicky2288 (author)  Kurt E. Clothier1 year ago
Kurt E. Clothier, I understand your point. BUT, my Instructable is not created for "beginners". My Instructable is intended to demonstrate the useful functionality of an Arduino Microcontroller for those who simply would cherish having their own synchronized Christmas lights. When I wrote this Instructable, I assume that all people who are doing this project has at least SOME experience with electronics, soldering, and microcontrollers. Some parts, due to rarity, I never mentioned an EXACT part to get, assuming that this concept is simple enough to be applied by anyone who has intermediate experience.

As for the relays, I NEVER said to use an Automotive relay. I said to use a Relay that would trigger with 5v applied to it. I also note they must be able to handle 10a @ 120v. Sir, in addition to that, I have about 5,000 lights connected to the 8 extension cables of my project. This worked very well, and I have tested the fact that it does NOT consume as much current as you think it would. One strand is certainly less that 4 amps, well, at least mine are.

Also, as for the "contacts on a typical prototype board cannot handle much current" part: Sir, I understand you love to give me feedback. But somethings I do want to clarify with you: It is NOT a prototype board. It is not a breadboard either. It is a high-current rated PCB board, and is tested to be fine for my projects requirements. As for the "parts can get hot"...I did mention to ELEVATE the circuit board on all 4 corners with a piece of plywood and allow it ventilation. Please look closer in my documentations.

Assuming that by doing project you UNDERSTAND the high voltage of AC currents, I am not going to go into details of this. I have told everyone to insulate their connections. I have warned the audience, and what they chose to do under their own responsibility. When you mention "people", I had a feeling that you are saying the "people are stupid"...because anyone who could even SOLDER all of this circuitry SHOULD have the knowledge to understand the potential danger of AC electricity. Am I not correct?

Kurt, I understand you are an Electrical Engineer. I am on my path to majoring as an Electrical Engineer as well. I greatly appreciate your feedback, but maybe next time can you please message me instead of criticizing in public? Because to be honest, it really affects what the audience thinks of this project. (which has been done numerous times by many people in the world) Thanks.
I apologize if I have offended you; that was never my intentions. I did not, nor am I, negatively criticizing you. I have just seen far to many people do things that could easily kill them or cause their house to burn down because they didn't know any better. I don't mean to imply that any people are stupid; however, unless they have been properly trained in electricity, they are ignorant of how it works.

My message was not meant to say what you did wrong, but rather to warn people to take precautions into consideration. Yes, you warned of the dangers of high voltage, but you did not mention some of the other tolerance issues I noted. And from what I have seen, the average hobbiest does not take any of these things into consideration. When I was getting my undergrad degree, there were plenty of future electrical engineers who didn't know how to solder appropriately and never took high current into consideration. I wouldn't expect anyone to know how to do these kinds of things unless they have been properly trained or practice a lot. Even then, the knowledge of how to solder does not in any way imply that one knows anything at all about the characteristics of electricity.

No, you did not say automotive relays, nor did you say to use AC relays, and many people don't know the difference. Again, I'm not criticizing you, I am just providing further information for people to be able to safely repeat what you did.

As far as the power consumption of the lights - all strands are different. The numbers I gave were for the larger lights made for outdoor use. If you are using mini-lights, they will use less power. Obviously, the more lights there are in a strand, the more current it will consume. There are also differences in bulb from one make to another and of course the size of the bulb. The difference in bulbs vs LEDs is astonishing, and it you are pulsing the lights, they will obviously not be consuming the total current all of the time. With that said, when a bulb is cold, it has a much lower resistance and draws a lot more current. Bulbs are non-ohmic, meaning the typical V=IR and P=IV equations don't always work. As such, the instantaneous start up current will be much higher than the average current drawn - often up to 10 times more.

But just so you know, if you are using 8 outlets to power 5000 lights, that is 625 lights per outlet. Since the average 100 bulb strand mini-lights will use about 41 Watts, only 5 can be connected in series without violating the UL standard 588 of only using 210 watts total per continuous strand.

Just because something has been done before doesn't mean it should be repeated. Thousands of people have caught their houses on fire because they would cover a lamp with colored cloth to create mood lighting. And to clarify, criticizing you would be making fun of your various grammatical mistakes, misspelled words, and over use of CAPITAL letters to emphasize emotion. If you cannot accept constructive criticism regarding your work from a peer in your field, then you will never make it as an engineer. Failing is the best way to learn. I would never trust someone boasting about how little they fail; however, I would like to prevent people from failing in ways that would hurt themselves, others, or destroy property.

Lastly, I assume that anyone who uses an Arudino for any purposes other than learning how microcontrollers work is a beginner. The Arduino is not a microcontroller; the Atmel AVR chip sitting on the board is. The Arduino is nothing more than an over hyped development board and accompanying software system created to increase people's interest in electronics - perfect for beginners or others not trained in the electrical field such as artists or business people. This is further shown in your last comment about the 13 I/O pins on the Arduino Duemilanove (14, actually). The actual uC in use (ATmega168) has a total of 23 I/O pins. The Arduino system has wasted 9 of them. Also, using additional Arduinos to add more channels would be a ridiculous waste when you could easily just serially shift out the data to a few SIPO registers to control the relays. This is not something I would expect a beginner to know, but someone trained in the field would immediately know what I am talking about.
dnicky2288 (author)  Kurt E. Clothier1 year ago
Sir, the key points that I clarified in my previous message still apply. But thank you very much for your constructive criticism regarding my work. I really appreciate it! I really do. Especially from an Double-E major. I must say your advice is quite impressive. I am actually aiming to major in Electrical Engineering. I am honored to have you mentoring me for this project. You spent quite some time finding caveats of my project and I am so happy that someone would point those out for me. And yeah, sorry about the CAPITAL words of emphasis. My intention was never to get emotional or in denial. I was too lazy to use rich-text commenting. Although am still not an engineer, please note that I am a programmer and thus am not the best when it comes to circuitry. But the things I make, I have the knowledge and know what I'm doing (to not kill myself). And since what I made is successful, I just thought I'd help make someone's Christmas special.

One thing we both share in common (and many other technical people) is the writing of LONG essays to explain every little detail. Kurt, I appreciate that very much and actually have the mind to sit down and read every single word. I honor your advice and clarification for my audience.

Lastly, I'm sure we both really know what an Arduino is and are probably experts in this aspect. Again, the only reason why I "dumb down" alot of terms such as saying "Arduino is a microcontroller" is because with people who have less knowledge...its easier to explain rather than writing an essay about it (I'm sure you understand). Please bear with me on this, as I totally understand how you feel about me and this Instructable. I'm sure alot of other projects have their own flaws and errors but as long as we all understand, lets all let it go.

BTW Kurt, I actually want to talk to you more by email or phone regarding EE major. Do you mind giving me your email or phone number?
dnicky2288 (author)  dnicky22881 year ago
And also, this project is probably like 1 + 1 = 2.1 for you (if you know what I mean). It would never have never been done this way if I am an EE. And you're right, its an amateur project....but it gets the basic concept, a little lacking in some parts...but its simple and works.
dnicky2288 (author)  dnicky22881 year ago
And I see what you mean by serially "shift out" to the SIPO registers.

http://arduino.cc/en/uploads/Tutorial/ShftOutExmp2_3.gif
dnicky2288 (author)  dnicky22881 year ago
lol sorry if I was being a "smart ass". I really didn't mean that.
No worries. I owe you an apology as well for being a jerk.
Yes, this is (I think) exactly what I was talking about. There are different kinds of registers that require different control signals, but at the minimum you will need a data signal and a clock signal.

If the register has a separate control line to "load" the shifted in data to the output (this is called a storage or latch register - check out a 74595 IC) then all registers could share the same data and clock lines, each only needing its own "data load" line to see the desired data at the outputs of the desired register. Hence 3 control lines could drive 8 outputs. Each additional register (8 more outputs) would only require 1 additional control line to latch the data.

Other types of registers that do not have an output latch can still share the data line (look up an HEF4094) each would just need its own clock signal. While this means you would need less total control lines for the same number outputs, without the output latch, data is immediately seen at the output as it is shifted through the register. (Sending the data 0000100 through would mean every output on the way would be "1" for a brief moment that that "1" was being shifted through each bit until it reaches its destination. This would be fine for visible LED control since it would be too fast for us to notice, but would be bad for motor control or other sensitive data lines.

One thing you have to pay attention to is the available output current from each register. Most AVR chips (and therefore Arduino as well) can source or sink 40mA per I/O pin, but not from all pins all at once since the the VCC and GND pins can only have 200mA total flowing - hence only 4 outputs could be at the maximum at any give time to still leave enough current to run the chip itself. The 74595 register has 35mA pins, but the chip as a whole can only dissipate 600mW. The HEF4094 has 10mA pins, but the chip as a whole can only source or sink 50mA at one time.

This is the main reason I don't like Arduino - it stops people from learning alternative ways of doing things as well as chip limitations. It is perfectly fine for simple beginner projects but should eventually be replaced by other things. Good job finding this register example.
Well, thank you for your honesty. Again, I never meant to insult you, I was just trying to offer suggestions. I know I come off as a pompous jerk sometimes, and I am trying to work on my demeanor, but that is not how I meant to sound.

Of course, you obviously know what you are doing if your project is working. I am not very good at "dumbing down," as you said, my work so that others who don't have my training can repeat it - that's why I'd never be a good teacher. Your explanation of this project is very good. I think anyone could easily follow the steps - that is why I was so quick to point out a few concerns the average hobbyist may overlook. 

Here is my website with contact information. I'd rather not put the actual info here, just so random web crawlers don't snatch it up!

Keep up the good work. And yes, I can't help but write lengthy essays. I'm glad someone somewhere can relate.
dpucio1 year ago
By far and away the best x-mas light controller istructable on instructables. Could use some better circut pictures though kind of grainy.
dnicky2288 (author)  dpucio1 year ago
Thanks man! I appreciate that! Yeah, I took those photos a while ago.

Hope my instructions were clear enough though. :-)
You forgot to use the 6 common black 1n4004 diodes or do you need did at all?
dnicky2288 (author)  Ctpnoi281 year ago
Oops haha. Sorry, I used the "6 common black diodes" but I forgot to put them in the diagram (too much to remember). I really recommend that you use them because it makes the circuit safer, since electricity can flow backwards in a relay. I attached each diode between the Ardunio and Relay to protect the voltage from "shorting out" the Arduino.

Please realize that a relay is basically an electromagnet which triggers a switch when a small amount of electricity is applied (5v in our case). It is risky to directly power a Relay with the Arduino because it technically "heats up" the Arduino. If you are doing this continuously, it would quickly damage the Arduino. This is where the diode comes into play. It prevents the voltage from being mishandled by only allowing it to go one way, and flow directly to the ground terminal.

Sorry for the misunderstanding and inconvenience. I hope you found my Instructable useful.
Thank you so much! I really need that!
dnicky2288 (author)  Ctpnoi281 year ago
No problem! I'm glad I can help.
What happened to your program "High Tech Christmas 1.0" as I can't find it on the net???
dnicky2288 (author)  GaryRet1 year ago
Sorry about that. I fixed the broken download link. Try again, it should work.
Thank you very much! I have it and will run it after dinner tonight!!!
Gary K
Great, I am up and running...now to record some macro's! Thanks for your program. I will get with my daughter (who is musical) and set up 5 of the 6 channels for notes and one for the beat (I think). Now I am off and running.
Again thanks for posting this...a great project!
dnicky2288 (author)  GaryRet1 year ago
No problem, my friend. I hope all works well for you!

If you need to look at some examples, feel free to search for "Musical Christmas lights" on YouTube. You will find many people who attempted this, along with with some great songs.

If you have any questions, feel free to ask.
So I the program working with a seeedstudio relay shield and its great. I have keys 1-4 to turn each channel 'on' and then Q-R to turn each channel 'off'. I'm trying to simplify being able to control the amount of time the lights are on. Is there an easier way to do this?
dnicky2288 (author)  pablopeillard1 year ago
Friend, you can always declare an variable, like an integer which tells how long to delay the lights. For example, instead of typing in 150 in the "delay ()" function, you can also do this:

int remainOn = 150; //now you can change the value of 150 to anything you like
delay (remainOn);

I hope this helps!
My relays are stuck in the closed position and I cant figure out why. There is no current going to them but they wont open so the lights stay on. Do you have any idea why that would happen?
1-40 of 50Next »