If you found this post I hope its because your confused and frustrated with what you have found online.
I have done none of the work and take all the credit.
I have look at hundreds of builds trying to figure out what actually works. It seems as though all these people building computer controlled Christmas light systems "forget" to post their secret sauce and if you follow exactly what they say to do IT DOESN’T WORK.
I am not a reader or writer. I do my best learning visually and by doing on-the-job training.
Here's the basics:
1. Micro-controller (Brains)
2. Relays (On/Off switches)
3. Christmas Lights
Here is a rough draft picture of this idea. I drew lines between each of the sections to illustrate the different configurations you can choose. The difference between my system and other systems is my system allows for expansion. Its never a final product.
![]() |
Don't stress over this picture. It's only here to program your brain with the basics. |
I for my system I am using the Mega. But You don't have to! The controller only limits the amount of digital outputs you have control over. If your prototype is going to control 8 strings of light or 8 channels, use the Uno. If you want to start out with 32 channels upgrade to the Mega.
The back of the box for the Mega says that it has 54 digital inputs/outputs.
People get extremely distracted by the PWM (Pulse-width modulation). Everyone wants to use it to slowly fade the lights on and off. I am not going to worry my self about PWM because I'm not using it. For me all I want is the lights to blink on and off. If you want your lights to fade you'll have to go somewhere else.
If you have your Arduino you can start your playing on on the arduino.cc site. There you will see how to install their IDE software and a few tutorials on how to make the Arduino work.
The first tutorial you need to be familer with is the blink tutorial.
http://arduino.cc/en/Tutorial/blink
Here's the code:
Experiment with this code and you will should learn how to read the basics of what’s really going on here. Try changing the port by looking at int led = 13; and then try changing it to another pin and getting that pin to blink. For example to have pin 9 blink make your code look like this int led = 9;.Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
So by completing this blink tutorial you should know:
1. How to read the blink command
2. How to hook up an led
How many relays are your choice but I'm going to use a lot so all of the following examples will show a lot.
So before buying lots of hardware lets get the Arduino configured and ready to have hardware plugged into it. If you read around the net you should have learned this by now. IF YOU CAN MAKE AN LED LIGHT UP YOU CAN MAKE SOMETHING WORK. Sorry you can't see 5 volts and cheep multimeter suck but an led is cheep and is a visual indicator letting you know your circuit has power.
Here is a picture of a led board that I have built. Each pin I want to use is represented by a led.
![]() |
Front |
All the parts you need for this board:
1) Led
2) 200 Ohm resistor
3) Printed circuit board
4) Wire
![]() |
Back |
Once I have everything soldered up then I plug it into the Arduino.
Using the blink tutorial I tested each led to verify that I soldered everything correctly. This also gave me the opportunity to label each led. At this point if your not working test your connections. As you can see from the pictures one of my joints wasn't soldered correctly and the wire broke loose. It is very easy to a bad job of soldering everything that's why I test and verify EVERYTHING before moving on.
Blink
Blink
Blink
Everything works, good job brain!
So scrap the blink sketch and lets play around with my code.
Yes its long and probably full of crap but its what made sense to me. I have 47 relays and 47 led's so all 47 are represented. Hopefully you can read the code and make sense of it. Depending on what your doing all you should do is add or subtract lines to fit your need. Each pin is represented 3 times. One time in each section. Also change the incoming bits to represent how many led's your using.
int C1 = 2;
int C2 = 3;
int C3 = 4;
int C4 = 5;
int C5 = 6;
int C6 = 7;
int C7 = 8;
int C8 = 9;
int C9 = 10;
int C10 = 11;
int C11 = 12;
int C12 = 13;
int C13 = 22;
int C14 = 23;
int C15 = 24;
int C16 = 25;
int C17 = 26;
int C18 = 27;
int C19 = 28;
int C20 = 29;
int C21 = 30;
int C22 = 31;
int C23 = 32;
int C24 = 33;
int C25 = 34;
int C26 = 35;
int C27 = 36;
int C28 = 37;
int C29 = 38;
int C30 = 39;
int C31 = 40;
int C32 = 41;
int C33 = 42;
int C34 = 43;
int C35 = 44;
int C36 = 45;
int C37 = 46;
int C38 = 47;
int C39 = 48;
int C40 = 49;
int C41 = 50;
int C42 = 51;
int C43 = 52;
int C44 = 53;
int C45 = 54;
int C46 = 55;
int C47 = 56;
int i = 0;
int incomingByte[47];
void setup()
{
Serial.begin(9600);
pinMode(C1, OUTPUT);
pinMode(C2, OUTPUT);
pinMode(C3, OUTPUT);
pinMode(C4, OUTPUT);
pinMode(C5, OUTPUT);
pinMode(C6, OUTPUT);
pinMode(C7, OUTPUT);
pinMode(C8, OUTPUT);
pinMode(C9, OUTPUT);
pinMode(C10, OUTPUT);
pinMode(C11, OUTPUT);
pinMode(C12, OUTPUT);
pinMode(C13, OUTPUT);
pinMode(C14, OUTPUT);
pinMode(C15, OUTPUT);
pinMode(C16, OUTPUT);
pinMode(C17, OUTPUT);
pinMode(C18, OUTPUT);
pinMode(C19, OUTPUT);
pinMode(C20, OUTPUT);
pinMode(C21, OUTPUT);
pinMode(C22, OUTPUT);
pinMode(C23, OUTPUT);
pinMode(C24, OUTPUT);
pinMode(C25, OUTPUT);
pinMode(C26, OUTPUT);
pinMode(C27, OUTPUT);
pinMode(C28, OUTPUT);
pinMode(C29, OUTPUT);
pinMode(C30, OUTPUT);
pinMode(C31, OUTPUT);
pinMode(C32, OUTPUT);
pinMode(C33, OUTPUT);
pinMode(C34, OUTPUT);
pinMode(C35, OUTPUT);
pinMode(C36, OUTPUT);
pinMode(C37, OUTPUT);
pinMode(C38, OUTPUT);
pinMode(C39, OUTPUT);
pinMode(C40, OUTPUT);
pinMode(C41, OUTPUT);
pinMode(C42, OUTPUT);
pinMode(C43, OUTPUT);
pinMode(C44, OUTPUT);
pinMode(C45, OUTPUT);
pinMode(C46, OUTPUT);
pinMode(C47, OUTPUT);
}
void loop()
{
if (Serial.available() >= 47) {
for (int i=0; i<=47; i++)
{
incomingByte[i] = Serial.read();
}
digitalWrite(C1, incomingByte[0]);
digitalWrite(C2, incomingByte[1]);
digitalWrite(C3, incomingByte[2]);
digitalWrite(C4, incomingByte[3]);
digitalWrite(C5, incomingByte[4]);
digitalWrite(C6, incomingByte[5]);
digitalWrite(C7, incomingByte[6]);
digitalWrite(C8, incomingByte[7]);
digitalWrite(C9, incomingByte[8]);
digitalWrite(C10, incomingByte[9]);
digitalWrite(C11, incomingByte[10]);
digitalWrite(C12, incomingByte[11]);
digitalWrite(C13, incomingByte[12]);
digitalWrite(C14, incomingByte[13]);
digitalWrite(C15, incomingByte[14]);
digitalWrite(C16, incomingByte[15]);
digitalWrite(C17, incomingByte[16]);
digitalWrite(C18, incomingByte[17]);
digitalWrite(C19, incomingByte[18]);
digitalWrite(C20, incomingByte[19]);
digitalWrite(C21, incomingByte[20]);
digitalWrite(C22, incomingByte[21]);
digitalWrite(C23, incomingByte[22]);
digitalWrite(C24, incomingByte[23]);
digitalWrite(C25, incomingByte[24]);
digitalWrite(C26, incomingByte[25]);
digitalWrite(C27, incomingByte[26]);
digitalWrite(C28, incomingByte[27]);
digitalWrite(C29, incomingByte[28]);
digitalWrite(C30, incomingByte[29]);
digitalWrite(C31, incomingByte[30]);
digitalWrite(C32, incomingByte[31]);
digitalWrite(C33, incomingByte[32]);
digitalWrite(C34, incomingByte[33]);
digitalWrite(C35, incomingByte[34]);
digitalWrite(C36, incomingByte[35]);
digitalWrite(C37, incomingByte[36]);
digitalWrite(C38, incomingByte[37]);
digitalWrite(C39, incomingByte[38]);
digitalWrite(C40, incomingByte[39]);
digitalWrite(C41, incomingByte[40]);
digitalWrite(C42, incomingByte[41]);
digitalWrite(C43, incomingByte[42]);
digitalWrite(C44, incomingByte[43]);
digitalWrite(C45, incomingByte[44]);
digitalWrite(C46, incomingByte[45]);
digitalWrite(C47, incomingByte[46]);
}
}
Once you have your code fitted to your needs you will notice nothing happens.
This code is designed to work via serial connection to a program called Vixen. I have tested this code and it works with Vixen 2.XX and Vixen 3.XX.
Download the Vixen Light software and install it. Once you have Vixen working and configured your Ardunio under the general controller.
So now Vixen should be in charge of your controller now driving your led's on and off.
Up to this point all you should have had to buy are:
1) ArduinoAll of these parts should have been cheep. If your having problems and think this project sucks and you throw your arms in the air to give up at least you haven’t spent to much money at this point.
2) Led's
3) Resistors
4) Wire
5) Printed circuit board
6) Soldering Iron
7) Solder
8) Usb cable
If you wish to continue we will be replacing part out in your current prototype for the real parts.
First real expense, getting rid of the USB cable.
This step is part of the secret sauce that is never talked about. I don't know how people make their system work without having a USB cable running from their computer, out the window, and plugged into their controller.
It's never talked about!
But I'm going to talk about it upfront.
I found out about a wireless system called Xbee
Its small, expensive, and easy to use. Most everything I have bought came from Adafruit.com. She sells the Xbee Series 1 and a break out board (some assembly required).
Also I needed to get a cable that can communicate via USB to these serial devices.
So here's a picture of the general idea
The Xbee's are going to replace the USB cable. One Xbee will be plugged into the Arduino and the other side into your computer.
Xbee S1 requires no configuration.
Xbee S1 REQUIRES NO CONFIGURATION.
You'll see all these guys with the Xbee S2 aka ZigBee. They require configuration of some sort. The S1 requires you to take them out of the package and plug them in.
On my led board I soldered some connections to hook up the Xbee.
The configuration for hooking it up is 5v power to power, ground to ground, Arduino TX to Xbee RX. Then Arduino RX to TX.
Remember to cross them wires or your going to have a bad time. Power up the Arduino and the Xbee green led should light up.
On your computer side, plug in the Xbee via the usb/serial cable.
Go back into Vixen reconfigure the general controller to match what COM port the xbee shows up as on your computer. Then TEST, TEST, TROUBLESHOOT, TEST, TEST.
Vixen should be working the Arduino just like it was plugged directly with the USB cable.
At this point if you have a 9 volt battery power supply you can take your Arduino and walk around the yard and figure out your range.
I left my computer in the living room and walk about 90 feet away from the house and I noticed that led's wern't flashing like they were supposed to. My ultimate range is going to be probably about 30 feet so I doubt there will be any issue with the range.
We have replaced the USB cable with a wireless connection now its time to replace the led's with the relays.
Here's the bait and switch:
OMG WIRES WIRES WIRES. I quit!
Don't get too crazy about all the wires. Yes it looks like a mess, but in reality its very simple.
This board is a 16 relay module I got off Amazon. at the bottom of the relay board is a red wire followed up by a bunch of black wires. They are all connected to the Arduino apparently in a random order. I wish I would have been more thoughtful while running the wires. I have gone back to my blink command and verified each pin works by blinking the relay. So when I activate pin 25 I can tell what relay is working and then I labelled it.
You can also see that I ran the hot wires into the relay terminal. I did this before mounting the board in the box because of the tight space. In all of my examples I have not added 120v power anywhere in the system because 12 or 14 gauge solid copper wire is so stiff and large it made more sense to get all of the small 22 gauge DC wire in first.
Here are some more pictures of the enclosure:
My box is also "load balanced" I split the box in half and Side A will be connected to breaker A and side B will be connected to breaker B. I don't want to have issues of tripped breakers because of to many lights. I will have 20 amps supplied to each side with the 12 gauge wire and 20 amp breaker. Each breaker is also equipped with a GFCI device for added protection.
This system has not been used in a live Christmas show yet since its only September. I haven’t decided the best way of providing the relay outlets yet. The PVC box and cover that are normally used for out door electricity are very expensive for what you get so I am thinking about using dollar store extension cords with waterproof glands.
qwerty