Computer Controlled Musical Christmas Lights

245,518

160

65

Intro: 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.

Step 1: 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

Step 2: LED Indicators

Start out by Soldering the LED Indicators to the PCB board and associating them with the 6 channels that we are going to build.
You will need the 6 LEDs for checking your channels to see if they work.


1. First, grab 6 red wires and 1 black wire. Solder them in a row starting with the 6 wires and 1 black wire.

2. The 6 red wires lead to the positive end of your LEDs.

3. Solder the 6 resistors on the other ends of your LEDs.

4. Solder the black cable to each end of your resistors.

Check your work on the diagram below. Make sure you do not have any sloppy connections or short-circuit problems.

Step 3: Testing the LEDS

If you are eager to test your LEDs to see if your connections are successful, you may do so by connecting the pin wires to your Arduino. Follow the diagrams below if you wish to test the LEDs before proceeding to connect the relays.

Plug in the 6 pins to your Arduino along with the ground wire.
Connect your Arduino to your computer and open up the Arduino Sketch-board software. Paste the code below and run it.
If all goes well, you should see all the LEDs being lit up.


int tree1 = 13;
int tree2 = 12;
int tree3 = 11;
int tree4 = 10;
int tree5 = 9;
int tree6 = 8;

void setup() {

  pinMode(tree1, OUTPUT);
  pinMode(tree2, OUTPUT);
  pinMode(tree3, OUTPUT);
  pinMode(tree4, OUTPUT);
  pinMode(tree5, OUTPUT);
  pinMode(tree6, OUTPUT);
}

void loop() {

  digitalWrite(tree1,HIGH);
  digitalWrite(tree2,HIGH);
  digitalWrite(tree3,HIGH);
  digitalWrite(tree4,HIGH);
  digitalWrite(tree5,HIGH);
  digitalWrite(tree6,HIGH);

}

Step 4: Connecting the Relays

If you've just attempted step 3, then disconnect the Arduino from your computer and disconnect all wires from the Arduino.
To avoid damage to the Arduino and to other parts of the project, try to use electrical tape to isolate open-wires.

We are now going to solder the relays to each channel of the circuit board. Please be careful when you do so. When these connections are powered, they have high voltage dangers. Take a minute to look at the pins of your relay.

Observe the diagram closely as you solder because your relay may vary from the one shown.

Step 5: In the Box!

Once your relays are all soldered up, its time to put it in the box. Before you do anything, make sure you do not have an soldering mistakes. Hot glue the 4 corners of your PCB board to small pieces of plywood. Hot glue that plywood directly on the plastic box.

Do the same for the Arduino. Except, I recommend you use screws to secure the Arduino to a piece of plywood, then hot glue it to the plastic box enclosure. Connect the wires from the PCB to the Arduino.

(The only "free-hanging" wires should be the "high-voltage" ones which are connected to the relays.)

Step 6: Packaging and Handling

This is the important step before you launch your miracle of wonders. First, connect all your relay wires to each pin. Connect the ground to your main power source. In other words, make a simple-circuit with the wires. Pretend the "Male 3-pronged plug" is your power-source, the 6 "female extension cords" are your "load" (or light bulb), and the "switch" are the relays.Make sure each relay is connected to a single load. If you need help, you can look at my diagram below.

A few things to take note of: Make sure your wires that you use to connect the circuit can tolerate 120v voltage. It is best to check the specifications. Be sure to wrap all wires thoroughly with electrical tape. Poke holes in the plastic box and make sure the power wires come out. Hot glue any gaps you may have.

Step 7: Wrap It Up

Once all connections are secure and everything is taped down, its time to start the show! You will need an indoor location to set up your "controller box". (Since you wouldn't want anyone messing with it)

I recommend putting the box in the garage, next to your garage door. Plug in the main power supply to your AC outlet.
Put up your house Christmas lights as you usually would, but plug all the cords into your "controller" instead of an electrical outlet.

As you see in the picture, this is my finishing design. (I put a note saying "High Voltage" to let my family be aware of voltages inside)

Step 8: Songs and Preparation

Of course what would a Computer Controlled Musical Lights be without the music? Download all your favorite MP3 songs to your computer. As long as you can play it loud on a speaker, then you're good to go.

A good setup is to bring your laptop out to your garage, hook up the USB to the Arduino, and plug in some speakers. If you have a WiFi connection on your laptop, you can go on Youtube and search up some songs like "Carol of the Bells - David Foster",  "Deck the Halls", or "God Rest Ye Merry Gentlemen" by Mannheim Steamroller.

Finally, for the programming, we will need some sort of setup to run the lights. You have two options:

-Option A:   You manually control the lights with your computer's keyboard.
-Option B:   You manually program the lights using a macro recorder and play it back automatically.


Either way, you will need to have these two programs running on your computer to communicate with your Arduino:

High Tech Christmas 1.0 (A program that I made myself to control the lights)
Arduino Sketchpad           (The Arduino's default programming software)

Make sure you have both of those programs above. If not, download them, extract the contents, and run them now!

After you have the programs, open up the Arduino Sketchpad program and upload this code to your Arduino:


int tree1 = 13;
int tree2 = 12;
int tree3 = 11;
int tree4 = 10;
int tree5 = 9;
int tree6 = 8;

int incomingByte;      // a variable to read incoming serial data into

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(tree1, OUTPUT);
  pinMode(tree2, OUTPUT);
  pinMode(tree3, OUTPUT);
  pinMode(tree4, OUTPUT);
  pinMode(tree5, OUTPUT);
  pinMode(tree6, OUTPUT);
}

void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();

    if (incomingByte == 'q') {
  digitalWrite(tree1,HIGH);
  delay(150);
    digitalWrite(tree1,LOW);
    }

    if (incomingByte == 'w') {
        digitalWrite(tree2,HIGH);
        delay(150);
        digitalWrite(tree2,LOW);
    }
   
        if (incomingByte == 'e') {
        digitalWrite(tree3,HIGH);
        delay(150);
        digitalWrite(tree3,LOW);
    }
   
        if (incomingByte == 'r') {
        digitalWrite(tree4,HIGH);
        delay(150);
        digitalWrite(tree4,LOW);
    }
   
        if (incomingByte == 't') {
        digitalWrite(tree5,HIGH);
        delay(150);
        digitalWrite(tree5,LOW);
    }
   
        if (incomingByte == 'y') {
        digitalWrite(tree6,HIGH);
        delay(150);
        digitalWrite(tree6,LOW);
    }
   
        if (incomingByte == 's') {
        digitalWrite(tree1,HIGH);
        digitalWrite(tree2,HIGH);
        delay(150);
        digitalWrite(tree1,LOW);
        digitalWrite(tree2,LOW);
    }
   
        if (incomingByte == 'd') {
        digitalWrite(tree2,HIGH);
        digitalWrite(tree3,HIGH);
        delay(150);
        digitalWrite(tree2,LOW);
        digitalWrite(tree3,LOW);
    }
   
        if (incomingByte == 'f') {
        digitalWrite(tree3,HIGH);
        digitalWrite(tree4,HIGH);
        delay(150);
        digitalWrite(tree3,LOW);
        digitalWrite(tree4,LOW);
    }

        if (incomingByte == 'g') {
        digitalWrite(tree4,HIGH);
        digitalWrite(tree5,HIGH);
        delay(150);
        digitalWrite(tree4,LOW);
        digitalWrite(tree5,LOW);
    }
   
        if (incomingByte == 'h') {
        digitalWrite(tree5,HIGH);
        digitalWrite(tree6,HIGH);
        delay(150);
        digitalWrite(tree5,LOW);
        digitalWrite(tree6,LOW);
    }
   
        if (incomingByte == 'u') {
        digitalWrite(tree1,HIGH);
        digitalWrite(tree2,HIGH);
        digitalWrite(tree5,HIGH);
        digitalWrite(tree6,HIGH);
        delay(150);
        digitalWrite(tree1,LOW);
        digitalWrite(tree2,LOW);
        digitalWrite(tree5,LOW);
        digitalWrite(tree6,LOW);
    }
   
        if (incomingByte == 'i') {
        digitalWrite(tree1,HIGH);
        digitalWrite(tree2,HIGH);
        digitalWrite(tree4,HIGH);
        digitalWrite(tree5,HIGH);
        delay(150);
        digitalWrite(tree1,LOW);
        digitalWrite(tree2,LOW);
        digitalWrite(tree4,LOW);
        digitalWrite(tree5,LOW);
    }
   
        if (incomingByte == 'j') {
        digitalWrite(tree2,HIGH);
        digitalWrite(tree3,HIGH);
        digitalWrite(tree5,HIGH);
        digitalWrite(tree6,HIGH);
        delay(150);
        digitalWrite(tree2,LOW);
        digitalWrite(tree3,LOW);
        digitalWrite(tree5,LOW);
        digitalWrite(tree6,LOW);
    }
   
        if (incomingByte == 'o') {
        digitalWrite(tree5,HIGH);
        digitalWrite(tree3,HIGH);
        digitalWrite(tree4,HIGH);
        delay(150);
        digitalWrite(tree5,LOW);
        digitalWrite(tree3,LOW);
        digitalWrite(tree4,LOW);
    }
   
        if (incomingByte == 'p') {
        digitalWrite(tree2,HIGH);
        digitalWrite(tree3,HIGH);
        digitalWrite(tree4,HIGH);
        delay(150);
        digitalWrite(tree2,LOW);
        digitalWrite(tree3,LOW);
        digitalWrite(tree4,LOW);
    }
   
        if (incomingByte == 'b') {
        digitalWrite(tree1,HIGH);
        digitalWrite(tree6,HIGH);
        delay(150);
        digitalWrite(tree1,LOW);
        digitalWrite(tree6,LOW);
    }
   
        if (incomingByte == 'c') {
        digitalWrite(tree1,HIGH);
        digitalWrite(tree3,HIGH);
        delay(150);
        digitalWrite(tree1,LOW);
        digitalWrite(tree3,LOW);
    }

        if (incomingByte == 'v') {
        digitalWrite(tree4,HIGH);
        digitalWrite(tree6,HIGH);
        delay(150);
        digitalWrite(tree4,LOW);
        digitalWrite(tree6,LOW);
    }
        if (incomingByte == 'a') {
  digitalWrite(tree1,HIGH);
  digitalWrite(tree2,HIGH);
  digitalWrite(tree3,HIGH);
  digitalWrite(tree4,HIGH);
  digitalWrite(tree5,HIGH);
  digitalWrite(tree6,HIGH);
  delay(150);
  digitalWrite(tree1,LOW);
  digitalWrite(tree2,LOW);
  digitalWrite(tree3,LOW);
  digitalWrite(tree4,LOW);
  digitalWrite(tree5,LOW);
  digitalWrite(tree6,LOW);
    }
   
  }
}

Step 9: Show Time!

Steps before showtime:

1. After you have uploaded the code to your Arduino, connect your Arduino to your computer via USB.

2. Turn up your volume and speakers. Open up the song you are about to play.

3. Power up your Relays (the main AC source).

4. Open up the program called High Tech Christmas 1.0

5. Select your "Arduino's Serial port". (If you don't know what the port is, keep selecting a different port until you get it right)

6. Click "Play" on your music.

Start hitting some keys! Rock on!

Below, I've attached a picture of a keyboard with tabs of which key controls what relay (lights).

Step 10: Automation and Other Ideas

If you are a lazy person, or just don't like controlling the lights all the time, you can download another program which records whatever you type on the keyboard and plays it back.

This is called a "macro program". You can get a good program like Blue Eye Macro or Avis Macro or something like that.
Then once you've recorded your macros, look for the option to "loop" the songs + the macros so they play repeatedly.
I haven't really gotten into this yet, but I was using Blue Eye Macro this Christmas with no problem at all.

I chose to spread the word about my creation by telling my neighbors and making a small website dedicated to showing pictures, videos, and show times of my production. I would also put a commenting option to allow my visitors to share their feedback.
If you have interest in publicizing you creation, you can build a website like mine. Look Here for my example

That's about it. Hope you can make and share the joy with your friends during the holidays!

Share

    Recommendations

    • Optics Contest

      Optics Contest
    • Plastics Contest

      Plastics Contest
    • Halloween Contest 2018

      Halloween Contest 2018

    65 Discussions

    0
    None
    baburaok

    11 months ago

    Hello Sir,

    Can you please help me where I can get the below specified outlets.

    Other parts am good.

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

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

    This could be a great help for me.

    all outlets I see is having thick wires and I doubt they will fit in the PCB.

    Please respond asap.

    Thanks,

    Gautham

    0
    None
    Mousepotato01

    1 year ago

    Hello please may I have the program High tech christmas to use with the arduino set up.

    0
    None
    CourtneyC25

    1 year ago

    Hi, any suggestions for a person learning programming that wants to try this? I would like to get this built so that my students can try their hands at the programming part. Also, do you have any better pictures, these are a little blurry and the boxes on them distort them slightly.

    Thanks!

    0
    None
    joeshualee

    2 years ago

    Hi, looks like the link to download High Tech Christmas is broken again. Can you fix it? Thanks

    0
    None
    CharanK3

    2 years ago

    Can this be used with a normal song ?? from an audio player perhaps??

    0
    None
    CharanK3

    2 years ago

    Can this be used with a normal song ?? from an audio player perhaps??

    0
    None
    dawelge

    3 years ago on Introduction

    Hello dnicky2288,

    Is there a way I can run this setup off my computers music and not have control over a keyboard? I prefer just running a CD or something. Also do you have any clearer pictures?

    Thanks

    0
    None
    BethanyM1

    3 years ago on Introduction

    If i was to use Arduino Uno, how would the code be different?

    0
    None
    JAEmanuel

    4 years ago on Introduction

    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?

    3 replies
    0
    None
    PhillipS1DJSkats

    Reply 3 years ago on Introduction

    Because he/she would have to take the powerstrip apart to attach the relays to the individual plugs? The plugs are being switched on and off individually by a controller, you can't do that with a straight up power strip.

    0
    None
    DIYPieter

    4 years ago on Introduction

    I'm assuming that it would be possible to use transistors instead of relays if I wanted to use LED's and a 12V system?

    0
    None
    FLAN

    4 years ago

    Your website is no longer available?

    0
    None
    cubbydebry

    5 years ago on Step 10

    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?