Let me add this to the beginning of this... I made some very large safety mistakes in this... please if you do anything with this understand the electricity, how it should be used, and how to NOT do it like I did. There are some things are are fine... great even... and there are some things that should NOT be done. (the biggest ones I can think of are putting the relay on the neutral, instead of the hot, and using low voltage wire instead of 120v wire).

That being said everything here works, and was very educational for me. With a few minor changes you can amke this functional AND safe. Thank you.

I am very new to Arduino, but am having a lot of fun with it!!! After finishing the animatronics for my office Christmas float I decided to make some automated Christmas lights.
I know this has been done many times online, but I think this shows the best, easiest, and cheapest of some of the different ways I have found.

Most of this deals with the electrical box. I didn't take pictures of the cable build, so it is all in one step, but there is a lot there.

Also the software and a MP3 is at the end.

Let me know if you have any questions.

I will also say that I got the hot/neutral backwards. You don't want to be switching the neutral on and off and constantly pushing electrons down the other lines (the hot). Any leak, insulation damage, or whatever else will results in leaking electrons... and this is never good. So make sure the lines that are being switched are the hot lines, not the neutral.
I have keep this the same (wrong) way so as not to cause more confusion with the colors. If you are doing this I am going to assume you can make this switch without too much problem. Just make sure you are switching the hot, not the neutral.

Step 1: Intro

Here is everything you will need for this project. From left to right:
Arduino. I used the Arduino Mega 2560 and Ada Fruit Wave Shield. I went with the Mega because I wanted to be able to control more lights. With the mega I effectively can control as many as I want (not hundred, but dozens). If you want to go this way make sure you check out the differences in building the Wave Shield for the Mega as opposed for the Uno. Basically pins 10-13 need to be redirected to 50-53 ("CCS" to 53, 11 to 51, 12 to 50, 13 to 52). I'm not going to go into all of the changes for that, the AdaFruit forums are much better than I could do.
If you haven't used electrical scissors get them, I love them. Same with wire strippers. These are both things I have been reluctant to use for years, preferring to stick with a knife. Go for the succors and stripper.
In-sure wire connectors are not needed, but they sure make the connections easier.
Be sure to get jumper wires that are male on one end, and female on the other. There aren't many like that, so look for them, the ones from AdaFruit are good.
cheap electrical outlets.
Cheap plug from Home Depot
4-Gang Old Work Outlet Box. This makes a pretty good project box. I still need to get a 4 place faceplate to finish it off, and get another outlet box to house the arduino and relays. Currently it is functional, but not pretty.
Romex wire. It may be easer and better to just use some speaker wire or something like that, but I had the romex and so I used it.
SainSmart 8-Channel Relay Module. This makes this easy, and is likely cheaper than any you would roll yourself. The only downside is you have to make sure you program them backwards from what I am used to... low is on, high is off. Strange, maybe that is how they do it in China.
Laptop for programing the Arduino. Make sure you switch the board from the Uno to the Mega... that one took me a while to figure out why it was not compiling right!!!

**VERY IMPORTANT PLEASE DO NOT FOLLOW THIS INSTRUCTABLE UNTIL IT'S UPDATED**<br> <br> It looks like you did a lot of planning, but you are unaware of some serious concerns when working with AC mains voltages and this instructable as it is now presents SHOCK AND FIRE HAZARDS.&nbsp; I felt this was important enough that I created an account just to post it.<br> <br> Breaking the neutral legs is wrong and dangerous presenting a shock hazard, especially given the nature of the projecct.&nbsp; A neutral is basically a dedicated ground for the power to return on.&nbsp; The way you have built this all the strings of lights will be hot when they are off and since Christmas lights are not grounded, they have no easy path to ground.&nbsp; This means someone could cut/damage the wire or pick it up while in contact with something grounded and receive a shock.&nbsp; Everything should be protected by a GFCI outlet, but it should never be relied upon to make up for improper design.&nbsp; To correct this you need to rewire to break the hot legs instead of the neutrals.<br> <br> The other thing is your use of sprinkler control cable as an extension cord which presents a shock and fire hazard.&nbsp; You don't specify, but 7 conductor sprinkler control cable is typically 18 ga conductor and insulated for low voltage use.&nbsp; For a safe project you MUST design for the maximum current the source can supply, not the anticipated load you will draw.&nbsp; Christmas lights use thin gauge wire because they have a fuse in the plug limiting the maximum draw the wire/string can pull.&nbsp; If the 18ga conductors were insulated for 120V AC (sprinkler cable is typically not) they would have a maximum of ampacity of 14 amps before you adjust for the length.&nbsp; Assuming that this project is plugged into an outlet protected by a 15 or 20 amp circuit breaker you could easily exceed that 14amp maximum before the breaker trips.&nbsp; This means that a short or heavy load down the line could melt the insulation presenting a fire and/or shock hazard.&nbsp; Also of note are the plugs and receptacles you're using.&nbsp; They do not look like they are weather rated and if they are, they likely won't seal properly with just the conductors going into them (without external sheathing).&nbsp; To correct this you need to use wire sized and insulated for the usage (you could still use a 18ga 120VAC conductor, but you would have to add fuses inline to protect them).&nbsp;<br> <br> I hope you're not offended, you really did do a nice job of planning this out, it just seems like there were some concerns you were unaware of.&nbsp; PLEASE address these concerns ASAP.
Offended?!!? Are you kidding?!? THANK YOU!! <br><br>I totally messed up on the hot/ground thing... I can't believe I did that... it should be fairly easy to fix by just switching my plug. <br><br>This was actually made for a Christmas Float, so it won't be outside in weather, and a fuse is something I didn't even think about, but am certainly going to add. <br><br>This is why I love things like instructables... I hope I can help someone else learn to do some, and in the process learn more myself. So offended?!!? Please, thank you very much. I have a life time &quot;be nice&quot; policy, but I am glad they have an official one here.
It's obvious you put a lot of thought into the project and the instructable, but sometimes people react to corrections/constructive criticism like you told them their kid is ugly.&nbsp; So I figured I'd just disclaimer it, glad it wasn't necessary.<br> <br> The fusing is only really necessary to protect the relays (what are they rated for?) or the custom extension cord.&nbsp; If you're going to keep the custom extension cord, see if you can find more info on the wire/conductors, maybe you'll get lucky and they're marked with a AC rating so you can pick a fuse.&nbsp; Keep in mind that typical mini-lights use about 0.4 watts per bulb or 40 watts per 100 ct strand.&nbsp; Since they're incandescent lights we can use a power factor of 1 and assume that 100 lights is 0.333 amps. In all reality the loads are probably pretty low and the 18ga wire is probably ok, but it still isn't right using it for voltage it's not rated for.<br> <br> Also since this is going to be used on a float, make sure you have a working GFCI (especially if people will be on the float) powering the whole thing.&nbsp; GFCI's work by comparing the current on the hot leg to the current on the neutral leg, if it senses more on the hot than on the neutral it assumes that something/someone is providing a better path to ground and shuts off the power.<br> <br> As far as your later question in the instructable about using white/black it doesn't actually matter, but the convention of sending power on black/red is there so it's clear to anyone working on it which is hot.&nbsp; On a semi-interesting side note, for a Junction Box with a device (light/receptacle) where the power goes there first then to the switch, power should be sent to the switch on the white conductor so that when it returns to the box it's on the black, preventing confusion in a crowded JB.
Hey, so far this has been the most clear instructable on christmas light control and I think I'm going to try it out. Did you find that the wave shield was able to produce loud, semi-decent quality audio? Also would there be any way to play music from your computer without just having to start your Arduino code and press play at the same time? Thanks!
Good, it was fun. <br>The wave shield works great... you will have to make some changes to the hardware for use with the mega, but it isn't any big deal... just figure out which wires go where... and there are several things in the AdaFruit blog about it.<br>The sounds is 16bit mono... so it isn't high quality CD best, but plenty good enough for something like this. <br>I am really not sure about starting the music from the computer... the problem would be syncing it together... I really thought about that, but never really came to a conclusion.<br>Let me know how it goes!
Talonsblade.... Do it... I have only been doing Arduino for a few weeks, and there is just nothing like writing some code that does something in the real world! And programing is nothing but C. Sure there are some functions you may not want to use on a little Arduino chip, but it makes it fun and simple. Something like this with relays is a great place to start because you have one pin that just turns one light on with one line if code. I am looking for my next project!
I certainty can't disagree with upptown.... You can also buy a spool of lamp cord wire from Home Depot.
Please do NOT use speaker wire! If you have to use twisted strand wire cannibalize a heavy duty extension cord. If you have a lot of incandescent strings the speaker wire will heat up and melt the insulation.
looks awesome. ive been thinking about doing this for a while now but i am more a software junkie than hardware so i never knew where to start. now, im going to get one of these and get started. i will let you know how it works out

About This Instructable




Bio: I am a computer nerd (CS degree by accident), bake bread, outdoors, build airplanes, balloons animals, photography. I have too many hobbies.
More by tlandrum:Tools for Better Bread Easy No Kneed Bread Cob Bread Oven, Back Yard Sourced! 
Add instructable to: