Occasionally in order to get myself motivated to finish an existing project I need to jump onto another project for a break. In this case I've been trying to get motivated to finish up my latest robot project for some time now and just can't seem to get it done. So, I've started a new project which is fun and will be fairly easy to complete, a Christmas lights controller with synchronized music. You can buy these kinds of systems but building it is really the fun part for me.

The intent is to use an Arduino Mega 2560 microcontroller board (http://arduino.cc/en/Main/ArduinoBoardMega ), a 16-Channel 12V Relay Module and the Vixen software package (http://vixenlights.com ).

Vixen is a .NET based software package that lets you create lighting sequences to music. It has a plug-in architecture for developers to create custom plug-ins for outputting the data for the sequences in whatever format that is needed. It also allows you to define the number of "channels" to control lights on. Basically a channel can be thought of as a single string of lights. You can perform various types of commands against each channel for each "frame" of the sequence. The cool part is you can define the number of frames per second, so you might say I want 10 frames per second, this allows you to command each channel to do something different 10 times every second.

The arduino will be pumped data from the Vixen software, running on a PC, via a USB serial connection. This data will tell the Arduino which lights to turn on and off via the relay module for each frame of the sequence. The relay module will do this by turning power on and off to 16 separate 120V AC wall outlets. In order to do things like have a string of lights be at half brightness the data from vixen will send the channel a value of 128 (the value range for a channel is 0-255 off-fully on), the arduino will then use PWM (pulse width modulation, nothing more than turning something on/off really fast) to flip the relay for that channel on/off fast enough to make the lights look like they are at half brightness.

I'm fairly sure the hardware part isn't going to be a big problem. More likely the use of the data coming from Vixen into the Arduino and controlling the relays at a fast speed will probably cause me the most trouble.

If you are wondering about the weird numbering it's because I don't have decent video editing software on my Windows machine and I don't want to deal with my Mac. I welcome any ideas on improvements. I'm already getting prepared for the relays not being able to switch fast enough to do fades. If that turns out to be the case I will continue the series with videos using dimming circuits with random phase TRIACs.

Oh, and if I'm using the wrong terminology in the videos, please let me know.

// speed for the com port for talking with vixen#define VIXEN_COM_SPEED 57600

// speed for talking with the serial monitor in the IDE#define PC_COM_SPEED 57600

// setup your choice of dimming values or just on/off values// the relays don't seem to be able to dim the lights so it looks// like I will have to build dimmer circuits for next year. The// doesn't change, just have to remove the relay bord and replace// it with a dimmer circuit for each relay.#define MODE_DIMMING 0#define MODE_FULL 1#define MODE MODE_FULL

I've had a few questions from some folks about the project wiring so a made a little video which I'll be uploading to youtube shortly to try to explain it. Here is a little textual explanation that covers the most important points. I don't do very well trying to explain things verbally sometimes, which you will notice if you watch the new video.

Basically the key to the project is this:

There are 3 common power bus lines. Ground, Positive and Negative.

The electrical sockets all have their positive terminals connected together on the common positive bus.

The electrical sockets all have their ground terminals connected on the common ground bus.

Each electrical socket has its negative terminal connected to one of the relays with the center screw terminal of the relay.

The third screw terminal (common open of the relay) of every relay is connected to the common negative bus.

When a relay closes it connects the electrical socket's negative terminal to the common negative bus thus allowing power to flow through the circuit for that individual electrical socket, causing the lights plugged into that socket to light up.

There are two power sources for the project. The power source supplying power to the electrical sockets (the orange plug in the project) and the power supply that is powering the relay board and the Arduino board (that little HP power supply in the project).

Well I've pretty much come to the conclusion that even if I could find SSRs to replace the mechanical relays I still wouldn't get the dimming control I want. For now I'm leaving the project as is, it works and is a good start for me. That gives me a year to figure out how to create dimming circuits, lol. The project was fun though.

I commented on your Youtube video regarding running your sketch using (Just a USB) I still could not make it work by removing the serial.print and changing Serial1 to Serial. I decided to write my own which only has one problem which only has one problem I was hoping you might help me with. All the lights turn on and my "squares" in vixen only turn them off. So it actually is working opposite of how it should. I did put in your code that turns all the lights off and the powerOnSelfTest and all that works fine. It only screws up when vixen runs.

//test the channels to see if they are all working analogWrite(channel_index, 0); //turn channel at [channel_index] on delay(250); // wait analogWrite(channel_index, 255); //turn channel at [channel_index] off }

Serial.print("System Ready"); turn_all_lights_off(); //All the lights come on by default, turn them off}