LED strip and RGB LED software

Here's an overview picture showing all the major components. Go ahead and plug in your powered USB hub, mouse, keyboard, speakers, and either ethernet or WiFi connection.

Connecting the RGB LED Strip

First, cut back the plastic sleeve from the RGB strip and solder 4 wires. Note that there's an Input and Output end of the strip, and it's important to connect to the input end. You can also use some JST connectors if you don't want to solder.
Now connect the wires to the Raspberry Pi and 5V Power supply as shown. Don't forget to connect the ground of the power supply to the ground of the Pi! A much more detailed guide to creating this connection can be found in the light painting project. The picture below is from that guide.

RGB Strip Software


Grab the software and follow the instructions on that page for getting the Pi able to output to SPI. Do install spidev. It's important that you use the hardware SPI because any bit-banging approach won't be fast enough.

sudo raspi-config to enable hardware SPI (follow instructions at git page). While you're there, set the audio output to be out the 3.5mm jack rather than the HDMI connector.

I added the install directory to my PYTHONPATH in bashrc so I could call the functions from anywhere.

nano ~/.bashrc:

export PYTHONPATH=$PYTHONPATH:/home/pi/RPi-LPD8806

(you could also add PYTHONPATH=$PYTHONPATH:/home/pi/RPi-LPD8806 to /etc/environments, but this will require a reboot to register on new terminal windows)

Test out that the strip works by running the example code:

python example.py

The xmas light code we're going to download later wants to run as root, and when you run things with a sudo in front, the environment variables, specifically, PYTHONPATH aren't transferred.

To keep those environment variables around, edit /etc/sudoers by typing

sudo visudo

and then add to the bottom

Defaults env_keep=SYNCHRONIZED_LIGHTS_HOME
Defaults env_keep+=PYTHONPATH


the first line is something we'll need for the xmas light package to be installed later.

To test that you have it setup right and can run things as root, close the terminal and re-open, then type

sudo python
from bootstrap import *
led.fill(Color(50,50,50),0,10)
led.update()

that should turn on the first 10 LEDs. You might need to restart a terminal window to make sure the environment variables get loaded.

Mount the LED Strip


I looped my strip back and forth on a baby gate with twist ties, but this wastes LEDs at the bends. A cleaner route would be to cut the strip into 5 even segments and solder 4-wire jumpers between each segment. You'll just need to adjust the address of the LEDs for the columns.
This guide was first published on Jan 13, 2014. It was last updated on Jan 13, 2014. This page (LED strip and RGB LED software) was last updated on May 04, 2015.