My Halloween Light Show

by The Electrodog Show in Circuits > Arduino

9262 Views, 15 Favorites, 0 Comments

My Halloween Light Show

20131024_201752_LLS.jpg
This year for Halloween I made a light show that was synced to music. I used an Arduino that was controlled by Vixen light software. My Arduino was connected to one power switch tail and four custom relay boards I built myself. The relays controlled a few different Halloween lights.
 

Ingredients

Arduino_Uno_Angle.jpg
pRS1C-2160389w345.jpg
pRS1-6856395w345.jpg
Capture.PNG
The main ingredients of the project are:
The Arduino Uno (receives serial commands from Vixen and switches relays on and off)
Vixen Light Control Software (allows me to program, control, and execute my lights) 
Custom Relay Boards (These are plugged into the Arduino and turn the lights on and off. They are soldered to extension cords.)
My Windows Computer (Runs the Vixen software. My computer also plays the music.)
Amplifier and Rock Speaker (lets people hear the music outside)
The Lights to be Controlled
 Many Other Assorted Cables

The Elements to Be Controlled

IMG_1973.JPG
IMG_1975.JPG
IMG_1972.JPG
IMG_1976.JPG
IMG_1974.JPG
I had five light elements connected to my Arduino via relays. 
My first element to control was a black plastic pumpkin cutout outlined with lights. 
My second element was an orange plastic pumpkin stuffed with lights. 
The third and fourth element were strands of lights outlining my house. 
My last element was a strobe/shop light. 

How It Is Hooked Up

IMG_2003.JPG
IMG_1991.JPG
IMG_1998.JPG
IMG_1999.JPG
IMG_2001.JPG
IMG_1977.JPG
IMG_1997.JPG
The relay is connected to my computer inside my house via USB. The strobe light is plugged into the power switch tail which connects to my Arduino. The rest of the lights are connected to extension cords that are spliced and hooked up to custom relay boards. You can hear the music via a rock speaker that is connected to an amplifier inside. I ran my USB and speaker cable inside to connect to the amplifier and Vixen light control computer. 

Software and Arduino Code

Capture.PNG
2.PNG
I used Vixen light control software to control the Arduino. The Arduino receives serial data from Vixen and uses a simple sketch to turn the relays on and off. I found the small sketch from the DIY Christmas Forum. Below is how I configured mine to five channels. 
#define NCH 5    // ALTER THIS: the sum of pwm and digital pins (number of channels from vixen)
#define NPWM 3 // ALTER THIS: the number of PWM pins you use
#define NDIG 2  // ALTER THIS: the number of DIGITAL pins you use...make sure NPWM+NDIG=NCH

int pins[NCH]={ 3,5,6, 2,4  }; //ALTER THIS FOR YOUR PHYSICAL PINS...pwm first then normal digital pins (set for UNO currently)
int data[NCH];   // to buffer incoming data

void setup()
{
  Serial.begin(38400);  // ALTER THIS: for various serial speeds on Vixen                   
  for (int i=0; i<NCH; i++) pinMode ( pins[i], OUTPUT ); 
}

void readSerialBuffer()  { for (int i=0; i<NCH; i++) data[i] = Serial.read(); }

void outputToPins()   {
  for (int i=0; i<NPWM; i++) analogWrite(pins[i], data[i]); // first pwm
  for (int i=NPWM; i<NCH; i++) // now digital outputs
         if (data[i]<127) digitalWrite(pins[i], LOW); else digitalWrite(pins[i], HIGH);
}

void loop()

   if (Serial.available() >= NCH) {
      readSerialBuffer();
      outputToPins();
   }
}

I had to make sure the exact numbers of channels I was going to use in Vixen is setup in the sketch. I also had to make sure that the Baud rate matched on Vixen and the Arduino sketch.  I had Vixen output to the Arduino via the Generic Serial Output. Lastly I had to make sure the serial output matched the serial port on the Arduino.