This tutorial shows how to build a fully automated holiday music and light show using a Raspberry Pi, a Micro SD card, and a few other inexpensive parts. Previously, we covered the basics of what you need for this project and showed how to set up your Raspberry Pi. Here, we’ll focus on the components and connections for the light show, and in part 3, we’ll put it all together with the music.
Install LightShowPi Software
From here on, we will run all the commands remotely. Just ssh into your Pi, as we explained previously.
First, we need to clone the Lightshowpi repository in the home directory of our Pi:
git clone https://bitbucket.org/togiles/lightshowpi.git
Then, change directory to the “lightshowpi” folder:
cd lightshowpi
We will be using the master branch as it has newer features:
git fetch && git checkout master
Now run the install script:
sudo ./install.sh
Reboot the system:
sudo reboot
Connect relay
Now it’s time to connect the Relay to the Raspberry Pi. To do this, shut down the Pi and unplug the power supply. Use the ‘male-female-breadboard wires’ to connect the GPIO pins with the corresponding channels of the relay (I am assuming that you ordered the same relay that I linked above).
To make things easier for you, I have created the following diagrams:
So this is what it looked like:
Now it’s time to test our connections. Power up the Raspberry Pi, SSH into it from your laptop, and then cd into the lightshowpi directory:
cd lightshowpi
Run the following command that will trigger each connected GPIO pin.
sudo python py/hardware_controller.py --state=flash
You will notice that LED on each channel flashing as you will see corresponding GPIO pins being triggered in the Terminal output. Once you confirm that all 8 channels flashed, stop the test with ‘Ctrl+x’.
Now, let’s test some music. Lightshowpi comes with two sample files stored in the music directory. Connect a speaker to the 3.5mm jack of the Pi, cd to lightshowpi directory
cd lightshowpi
And run this command:
sudo python py/synchronized_lights.py --file=/home/pi/lightshowpi/music/sample/ovenrake_deck-the-halls.mp3
You will hear some music from the speakers and see the LEDs on relay flashing with it. Awesome.
In part 3, we’ll set our display to music with a custom playlist and finish up the electrical connections.
For 5 more fun projects for the Raspberry Pi 3, including a holiday light display and Minecraft Server, download the free E-book today!
Read about other Raspberry Pi projects:
5 Fun Raspberry Pi Projects: Getting Started
How to Build a Minecraft Server with Raspberry Pi 3
Build Your Own Netflix and Pandora With Raspberry Pi 3
Turn Raspberry Pi 3 Into a Powerful Media Player With RasPlex