Lightshowpi Project
Hello everyone! This is my official guide on how to create a light show using lightshowpi as of October 2020.
Gather Your Supplies
For this project you will need the following:
- Raspberry Pi (I used a Model B+ that I bought at goodwill years ago. As far as I know, this will work with all pi's except for the 4, however I cannot verify that.)
https://www.raspberrypi.org/products/
- SD Card/Micro SD Card (This depends on what pi you use. Anything 16GB or larger should suffice)
https://www.walmart.com/ip/SanDisk-32GB-microSDHC-...
- Micro USB power cable (for Raspberry Pi)
- Sainsmart 8 Channel Solid State Relay Board
https://www.sainsmart.com/products/8-channel-5v-so...
- 10 Channel Power Distribution Block
https://www.speedwaymotors.com/Electrical-10-Termi...
- Four Hyper Tough Outlets
https://www.walmart.com/ip/Hyper-Tough-Grounding-D...
- Two Hyper Tough 2 Gang Box
https://www.walmart.com/ip/Hyper-Tough-2-Gang-Swit...
- Male to Male, Male to Female, and Female to Female Jumper Wires
https://www.amazon.com/gp/product/B072L1XMJR/ref=p...
- 16 Gauge wire
https://www.walmart.com/ip/16-Gauge-Red-Black-Powe...
- HiLetGo Digital FM Transmitter
https://www.amazon.com/gp/product/B07X3Z8YTD/ref=p...
- Wire cutter and wire stripper
https://www.walmart.com/ip/Wire-Stripper-Universal...
- Electrical tape
- Soldering Iron
https://www.walmart.com/ip/Hyper-Tough-30-Watt-Sol...
- Laptop/computer with SD Card reader/writer
- Two prong power plug
Begin Wiring
Before we set up the raspberry pi, you will want to go ahead and do all necessary wiring that way after you set up the pi you can go ahead and test the hardware then. To start you will want to pull up a reference sheet for the GPIO pin layout of your respective pi. For example the one I used is attached to this step.
On the Sainsmart board, take a flathead screwdriver and loosen all of the channel screws (the screws within the little green boxes). Then, grab your Male to female jumper cables and wire them as follows:
GPIO 11 to CH1
GPIO 12 to CH2
GPIO 13 to CH3
GPIO 15 to CH4
GPIO 16 to CH5
GPIO 18 to CH6
GPIO 22 to CH7
GPIO 7 to CH8
SKIP
GPIO 6 to GND
GPIO 2 to VCC
Note: On the SSR board, there are two GND's. Use the one next to the VCC.
Then you will want to cut 16 pieces of 16 gauge wire (2 for each of the 8 channels) and strip just the end, about 1/16th of an inch off. Then insert into the output side of the ssr board and tighten down the channel screws (not too tight).
Before we continue there are a few things you should know: on the wall outlets there are two sets of screws, one bronze and one silver. The bronze side is for power, the silver side is for ground. Now, what you want to do is take the left wire from channel one and run it to the top screw on the bronze side. Then go to the next channel and use the left wire and run it to the bottom screw on the same side. Repeat until you have eight wires ran to the outlets.
Then you will need to make the ground wires. Cut a piece of 16 gauge wire and sort of daisy chain the outlet grounds together. To do this attach one wire to the upper silver screw and then to the bottom silver screw of the next outlet. You should then end up with one ground wire that isn't connected. Splice your two prong power plug and either solder or crimp the negative wires together.
Now, grab your 10 channel power bus bar. You will only need 9 channels. Daisy chain 9 of them together (same side). Then take the right wire from the channel one on the SSR board and attach it to the first used channel. Do this until all 8 wires are attached to the bus bar. Then take the positive wire from the two prong power plug and run it into the last channel of the bus bar.
Now the hard part is over!
Set Up Raspberry Pi
For those of you who are new to Raspberry Pi start here:
There are a few programs you will need to download before we begins setup. For all of the following links, select your OS for the proper download.
- Raspberry Pi Imager
https://www.raspberrypi.org/downloads/
- PuTTy
https://www.chiark.greenend.org.uk/~sgtatham/putty...
- SD Card Formatter
https://www.sdcard.org/downloads/formatter/
- Advanced IP Scanner
https://www.advanced-ip-scanner.com/download/Advan...
Once you have those downloaded, begin by plugging in your SD card. Open the SD card formatter and select the drive you wish to format. Then format the card. This is just a precaution to help make the rest of the process go smoother.
Then, download the NOOBS OS system for raspberry pi here:
https://downloads.raspberrypi.org/NOOBS_latest
Note: The reason I chose NOOBS over Raspberry Pi OS is because NOOBS offers a quick recovery method in case you need a fresh install.
Once that is done, open the raspberry pi imager program, scroll down to custom os, find the NOOBS .zip, select the drive you wish to write your os to, and write!
After that is complete, insert the SD card into the slot on the pi. Most of which are underneath the board, opposite the usb ports. You will also want to plug in a mouse to the raspberry pi for the time being. Plug in the micro USB power supply into the rpi. Then use HDMI to plug it into a TV, PC Monitor, etc. After some time, the raspberry pi will prompt you, asking you what OS you would like to install. Select the first option (Raspberry Pi OS Full/Desktop). Allow it to install the operating system and then it will reboot the pi. Follow the pop-up instructions to update your pi and set up a password for SSH (which we will use later).
After all of that is done, you will want to click on the Raspberry Pi logo in the top left corner. Then from the drop down menu go to Preferences>Raspberry Pi Configuration. This will open a menu with various settings for your Raspberry Pi. Click on the "Interfaces" tab and enable SSH.
Then plug in the USB WiFi dongle to one of the usb ports (if your pi doesn't have built in WiFi). Connect to your WiFi network.
Once you're done with that, go to your computer with Advanced IP Scanner and PuTTy installed. Connect to the same SSID as you connected your Raspberry pi to. Open Advanced IP Scanner and scan this range: "192.168.137.1 - 192.168.137.254." Your raspberry pi should pop up with an IP address next to it. Now, open PuTTy and in the Host Name box type the IP address that shows up next to the raspberry pi. There will be a pop up, click yes. Then you will be prompted with "login in as:" type "pi" and then enter the password you chose when you set up your pi. As you're typing, you may notice that the password will not show up. This is a security feature and is completely normal. Just type out the password and hit enter. For any other questions, refer here:
https://www.raspberrypi.org/documentation/remote-a...
Once you have successfully accessed your pi remotely, type in the following commands:
sudo apt install git-core
git clone https://togiles@bitbucket.org/togiles/lightshowpi...
cd lightshowpi
git fetch && git checkout python3
sudo ./install.sh
sudo reboot
After each command wait for the "pi@raspberrypi:" in green text to appear before typing a new code in. Once that is all done, enter this command to test the hardware:
sudo python py/hardware_controller.py --state=flash
Each light on the SSR board should flash individually. You're ready to run some lights!
Playing Your First Song
The easiest way I found to play songs was to download .mp3 files and then put them into a folder on the raspberry pi. I titled mine "music." Then in PuTTy use this command:
sudo python py/synchronized_lights.py --file=/home/pi/lightshowpi/usic/[songname].mp3
That's all there is to it! It's been a really fun yet challenging project and I hope this helps anyone out who experienced the same things I did. Here is a link to a YouTube playlist with recordings of some of the songs from my light show.
https://www.youtube.com/playlist?list=PLusUu0mUL14inWN0n3kunZgV04VEoSOdA
If you have any questions, feel free to ask! Thank you!