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:
sudo apt-get update
sudo apt-get upgrade
Step 2) Download and install Lightshowpi using the following commands shown.
# Install git (if you don't already have it)
sudo apt-get install git-core
# Clone the repository to /home/pi/lightshowpi
git clone https://email@example.com/togiles/lightshowpi.git
# Grab the stable branch
git fetch && git checkout stable
Once the installation is complete simply reboot the Raspberry Pi
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.
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.
By the default settings on the Lightshowpi, here are the GPIO pins that are used. Insert the female connections in this order.
- The first input is gpio 17 (pin 11) on the raspberry pi shown above.
- Second input is gpio 18 (pin 12) on the raspberry pi.
- Third is gpio 27 (pin 13)
- gpio 22 (pin 15)
- gpio 23 (pin 16)
- gpio 24 (pin 18)
- gpio 25 (pin 22)
- 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:
On the SSR, connect the other side of the cables in the following way:
- pin(11) from Pi to IN1 (CH1) on SSR
- pin (12) from Pi to IN2 (CH2) on SSR
- pin (13) from Pi to IN3 (CH3) on SSR
- pin (15) from Pi to IN4 (CH4) on SSR
- pin (16) from Pi to IN5 (CH5) on SSR
- pin (18) from Pi to IN6 (CH6) on SSR
- pin (22) from Pi to IN7 (CH7) on SSR
- pin (7) from Pi to IN8 (CH8) on SSR
- pin (6) (GND) from Pi to GND on the SSR
- 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.
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.
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.)
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.