Blog

Create your own Christmas musical light show

In light of the Christmas season, this post was created to inform you how to create your own music synchronized lights! It is a truly spectacular display and sure to impress everyone in the neighborhood, family, and friends.

Check out this example video:

Even if you are not planning a large-scale setup like the video, we can still use this, for example, just for an indoor Christmas tree. The possibilities are up to you!

Now, lets get started on learning how this was accomplished.

Step 1) Acquire the Raspberry Pi 3B model which can be found on amazon for $35.

There will be a few more components required to use the Pi as well, here is a good kit on amazon: CanaKit Raspberry Pi 3 Complete Starter Kit – 32 GB Edition.

Additionally you will want to grab a wireless (or wired) keyboard and mouse laying around the house to use the Pi.

Once you have the Raspberry Pi 3, you’ll want to boot it up and install the  recommended Raspbian operating system we are going to need. Here’s more information on getting started with the raspberry pi.

Once you complete the Raspbian installation its time to  update the latest version using the following command in the Terminal type:

raspberry_pi_raspi-terminal

sudo apt-get update
Then,
sudo apt-get upgrade

Step 2) Download and install Lightshowpi using the following commands shown.

Download:
# Install git (if you don't already have it)
sudo apt-get install git-core
# Clone the repository to /home/pi/lightshowpi
cd ~
git clone https://togiles@bitbucket.org/togiles/lightshowpi.git
# Grab the stable branch
cd lightshowpi
git fetch && git checkout stable

Install:
cd /home/pi/lightshowpi
sudo ./install.sh

Once the installation is complete simply reboot the Raspberry Pi

sudo reboot

This is the software that allows the light and music synchronization. After completing the necessary steps shown and rebooting, we are ready to test out our hardware.

Step 3) Get a Solid State Relay (SSR) to perform the fast light switching that we are going to need. I purchased the Sainsmart 8 channel SSR in case I decide to have a larger future display, but you can look around to see what will suit your needs.

Here is a circuit showing how the SSR works.

ssr

In this circuit notice that the input and output voltages are electrically isolated (not physically connected). Once the input DC control voltage is applied (usually 5V) the diode turns on and emits light. The light is detected by the light sensor and turns on the TRIAC only when the AC voltage (usually 120V @60Hz) sine wave reaches zero on its next cycle. This is to avoid conducting when the sine wave is at any peaks since this can cause voltage transients and high frequency spikes which the circuit or environment may not be equipped to handle.

Step 4)  Connecting and Testing the Hardware will require us to use male to female connectors to join the raspberry pi’s GPIO pins to the input pins on the SSR. The Pi will use the female connection and the SSR will utilize the male connector.

First lets take a look at how the raspberry pi GPIO layout is configured.

rp2_pinout

By the default settings on the Lightshowpi, here are the GPIO pins that are used. Insert the female connections in this order.

Connecting

  1. The first input is gpio 17 (pin 11) on the raspberry pi shown above.
  2. Second input is gpio 18 (pin 12) on the raspberry pi.
  3. Third is gpio 27 (pin 13)
  4. gpio 22 (pin 15)
  5. gpio 23 (pin 16)
  6. gpio 24 (pin 18)
  7. gpio 25 (pin 22)
  8. gpio 4 (pin 7)

The Pi will be powered by the power supply which was bought earlier. In addition the SSR will also need to be powered, you may simply jumper the supply and ground from the Pi to the SSR. Then, from the diagram you may use the most convenient pins to do this

9. Vcc or 5V (pin 2 or 4)
10. Ground (pin 6, 9,14,20,25,30,34,39)

For the SSR:

ssrr

On the SSR, connect the other side of the cables in the following way:

  1. pin(11) from Pi to IN1 (CH1) on SSR
  2. pin (12) from Pi to IN2 (CH2) on SSR
  3. pin (13) from Pi to IN3 (CH3) on SSR
  4. pin (15) from Pi to IN4 (CH4) on SSR
  5. pin (16) from Pi to IN5 (CH5) on SSR
  6. pin (18) from Pi to IN6 (CH6) on SSR
  7. pin (22) from Pi to IN7 (CH7) on SSR
  8. pin (7) from Pi to IN8 (CH8) on SSR
  9. pin (6) (GND) from Pi to GND on the SSR
  10. pin (2) (5V) from Pi to VCC on the SSR

Note: you only need to connect one of the grounds, unless you are using an external supply for the SSR.

Testing:

Once the hardware has been setup, we should be able to see the LED output on the SSR. Run the following code to check the LED’s.

First ensure you are inside the lightshowpi library by running these commands.
cd
cd lightshowpi

This will blink each channel one at a time.
sudo python py/hardware_controller.py --state=flash

This will fade each channel in and out using software PWM.
sudo python py/hardware_controller.py --state=fade

To stop the code use ctrl-C in the same terminal window.

Once you see that all of the components are working properly we are almost ready to connect the Christmas lights!

Connecting the SSR Output

We will need a few things to connect the ouput. First we need to get some small extension cords to use for wire, I used 16AWG(gauge) which is the recommended household size. Also useful if you have any wire nuts laying around.

Here are pictures to show what to do with the cords. 8 Will be used for the channels and 1 used for the power supply (daisy chained to the others.)

Photo: Photo: Photo: Photo: Photo: Photo: Photo: Photo: Photo: Photo: Photo: Photo: Photo: Photo:

Step 5) You now have completed this project, most people have built a small project box to hold all of the equipment and organize everything.

Note: Before connecting anything to power please make sure to check all wiring thoroughly and use electrical tape to cover any mains voltages, have an electrician check your work to be safe.

Personal Completed example:

 

 

 

*Disclaimer:All the information on this website is published in good faith and for general information purpose only. Any action you take upon the information on our website is strictly at your own risk. and we will not be liable for any losses, injury or damages in connection with the use of our website.