I always wanted one of those colourful glowing large TV screens in my living room but I never felt like paying a fortune for it. So, why don’t do it on my own? I ordered two Raspberry Pis, which seemed like a perfect fit for a media center and a LED controller because of the built in SPI bus interface. After some research, I decided that using SMD LED strips with WS2801 chips would be the best match for a Raspberry Pi controller. Furthermore SMD strips are quite easy to mount, because of the adhesive tape on the back of the strip.
Demonstration
Hardware installation
We’ll setup the necessary hardware first.
You’ll also need tools for soldering. Alternatively, you could use just one Raspberry Pi, which will act as the LED controller and the media center.
As a Software Developer, I’m not an expert in soldering but I tried to do my best. Cut the strip into 4 pieces that match your TV dimension. For easy replacing of a broken LED strip or moving the installation to another TV connect the stripes with pigtail connectors.
WS2801 LED strips have always four connectors. In my case with those pinouts:
Be careful, don’t twist those between the pigtails! There’s also an arrow on the strip, which marks input / output. Make sure you’re able to connect the strips from input to output with the pigtail connectors.
It’s easier to solder the connectors to the fine SMD if you put some soldering to each of the four joints in advance. Finish it up with a heat shrink, for more flexibility use non-adhesive heat shrink tubes.
LED mounting
Now, we’re coming to the fun part. It’s barely easy to mount the strips because we chose SMDs, just use the adhesive tape and you’ll be fine. It’s essential that you start mounting from the bottom right, seen from the back of the TV with the arrow on the strip pointing to the right. Later, you’ll connect from the GPIO from the RPI directly to this input of the strip. Then go ahead counter clockwise, connecting the output of the first strip to the input of the second strip and so on until you reach the bottom left. The output of the last strip is left empty, so the strips are not connected in a loop.
LED strip wiring
Wire the LED’s up as shown in the following diagram created by . Please note, the diagram shown, is for the Rpi revision 1.0. This could slightly change with later revisions. Make sure the input 5V/GND connectors of the strip and the Raspberry Pi power connectors are directly connected to the DC Power Jack Adapter (DC Jack).
There’s no need for the Pi’s micro USB port anymore. I’d suggest using Breadboard Jumper wires for proper connections to the Pi’s breakout board. Leave the output connectors of the LED strip as they are.
Prototyping: All wires connected to the Raspberry Pi.
Final outcome: Raspberry Pi in black enclosure and power supply wired up.
Software installation
So, the hardware is prepared. In this section I’ll show you how to setup two different applications on the Raspberry Pi to control the LEDs. You have to chose one of them, I’d recommend Hyperion for various reasons.
Hyperion
Hyperion is newer, features a JSON interface and is easier to setup than Boblight. It is also less resource hungry. Therefore we can easily run XBMC and hyperion on the same Raspberry without performance issues.
Install a media center distribution for the Pi. I recommend for beginners, it’s easier to install and less locked down. Boot up Raspbmc and remote login with your host computer. You’ll find the IP in XBMC under Settings -> System Info. If you’re on Windows, use for the ssh connection. Shell // Password is: raspberry ssh pi@raspbmc-ip 1 2 / / Password is : raspberry ssh pi @ raspbmc - ip Prepare hyperion installation Shell // Create new folder in the pi user home mkdir hyperion && cd hyperion // Download hyperion installation script wget -N // Make the install script executable sudo chmod x install_hyperion.sh // Make sure boblight is not running in the background sudo /sbin/initctl stop boblight 1 2 3 4 5 6 7 8 / / Create new folder in the pi user home mkdir hyperion && cd hyperion / / Download hyperion installation script wget - N https : / / raw .githubusercontent .com / tvdzwan / hyperion / master / bin / install_hyperion .sh / / Make the install script executable sudochmod x install_hyperion .sh / / Make sure boblight is not running in the background sudo / sbin / initctl stop boblight Install hyperion, it will also be added to your autostart. Shell // Install all necessary packages for hyperion sudo apt-get update && sudo apt-get install libqtcore4 libqtgui4 libqt4-network libusb-1.0-0 libprotobuf7 ca-certificates // Execute the hyperion installation script sudo sh ./install_hyperion.sh // Hyperion should be running now, stop it again sudo initctl stop hyperion 1 2 3 4 5 6 / / Install all necessary packages for hyperion sudo apt - get update && sudo apt - get install libqtcore4 libqtgui4 libqt4 - network libusb - 1.0 - 0 libprotobuf7 ca - certificates / / Execute the hyperion installation script sudo sh . / install_hyperion .sh / / Hyperion should be running now , stop it again sudo initctl stop hyperion Now we create the hyperion config file which includes for example the LED position informations. It’s a very readable JSON format. Theconfiguration can initially be generated by a Java tool called “HyperCon”. Have a look at the . Download to your Host computer where Java must be installed. If you followed the LED installation instructions above, the following settings should give you reasonable results for a start. Please adjust the LED counts and the 1st LED offset for your setup on the “Hardware” tab. We want the LED offset to line up with the LED closest to the initial input, which is connected to the Rpi GPIO. Then click “Create Hyperion Configuration” and save the json file to your Desktop. Don’t rename the file. Let’s copy “hyperion.config.json” to the “pi” user home directory on the Raspbmc. You can easily copy the file by using the shared folder “raspbmc”. Make sure you put it in the folder pi/hyperion. Alternatively you could use SCP for copying the file. Back on the Raspbmc ssh shell, copy the configuration file to the place where it will actually be picked up by hyperion at boot. Shell // Hyperion will by
Lighting Daemon DefaultDependencies = no After = network .target [ Service ] ExecStart = / usr / local / bin / boblightd Restart = on - abort [ Install ] WantedBy = multi - user .target Register the script as a deamon. Shell // Register the boblight script systemctl enable boblight // Start the deamon systemctl start boblight 1 2 3 4 / / Register the boblight script systemctl enable boblight / / Start the deamon systemctl start boblight Boblight should now be installed and running in the background. For more details, have a look overhere: Now generate the boblight config file. Switch to the boblight checkout directory create on step 3 and make the config script executable. Shell chmod x makeconfig.sh 1 chmod x makeconfig .sh Then execute the script Shell ./makeconfig.sh 1 . / makeconfig .sh The script will ask you for the exact LED count mounted on each side of your TV. Use the default values for all other inputs. Wait till the script is ready, then copy everything between“——- Light section starts here ——” and “——- Light section ends here ——” into a text file on your host machine (Not on your Pi). Write down the total LED count. Download this preconfigured config file: and open it with a texteditor on your host machine. Add your generated light section simply to the end of the file. Multiply your total LED count by 3 (RGB channels) and replace “369” with your result in the file. Then select all and copy. Create the actual boblight config file with Shell nano /etc/boblight.conf 1 nano / etc / boblight .conf on your Pi and paste the content of your modified config file on the host machine into it, this will take some time to complete. Lets test the LED config. Shell // Stop the deamon systemctl stop boblight // Manually start boblightd boblightd 1 2 3 4 / / Stop the deamon systemctl stop boblight / / Manually start boblightd boblightd Check the output for errors. We’re getting closer, try firing the LEDs up. boblight-constant BB55AA All LEDsshould light purple.
boblight-dispmanx installation
So, we’ve managed getting boblight to control our LEDs. Now, we’ll see how to setup another tool for sending captured screen color information right to our boblight deamon, it’s called . Perform the following steps on the Raspberry Pi, that will be running the media center. A media center for example XBMC, running on this Pi will act as the video input source. Everything played on XBMC will be captured by boblight-dispmanx and sent to boblight.
Install the newest version of OpenELEC (XBMC distribution) on your Pi: SSH to the OpenELEC Pi: Shell mkdir boblight-dispmanx && cd boblight-dispmanx 1 mkdir boblight - dispmanx && cd boblight - dispmanx Checkout the source code Shell wget