With a Raspberry Pi, you can control a RGB addressable LED strip. The instructions are very simple  and the results are pretty cool. I decided to make a desk lamp with a web interfaceaside: . This post will go through the steps to build your own Pi powered desk lamp.
- Raspberry Pi
- Memory card (greater than 4 GB recommended)
- Power Adapter
- LED Strip (LPD8806)
- Lamp shade
Any model of the Raspberry Pi should work for this project. First we need to set up the Raspberry Pi.
To use SPI on the Raspberry Pi, you need to connect 4 pins. Adafruit has an excellent image in their tutorial that shows how you can do this, which I’ve also linked below.
I’ve used the same power source to the LED strip to power the Raspberry Pi as well.
I found the lamp shades on Amazon. I purchased them in white, since the LEDs are RGB.
I purchased the LED strip from Adafruit.
Download the latest Raspbian from the official source. I used the image
2016-03-18-raspbian-jessie.img. Flash the operating system
onto a memory card.
dd on OSX, I’ve found that
is much faster than
disk will work
fine, but if you are using
disk be prepared to wait longer
- it took about an hour in my case..
(Optional) Expand the file system to use all the available space on the memory card.
To control this particular LED strip, we are going to use the SPI bus on the Raspberry Pi. We need to set up the Pi to use SPI.
Next, we need to install some packages to use the SPI bus. First, let’s update the Raspberry Pi.
Instead of installing spidev and BiblioPixel, you can also clone the
repositories and add them to your
PYTHONPATH. I found that
sudo pip install <package-name> is easier, however I
had to browse through the source code of
found having a local copy accessible was helpful.
Finally, we need
Flask to set up a server on the
sudo for all the
installations. It is definitely required for
may not be for the others. You will need to use
sudo to run
the application, since root access is required to control GPIO pins on
the Raspberry Pi.
The tutorial on Adafruit’s page links to a library for their LED strip, which the author has deprecated in favour of the excellent BiblioPixel . I recommend using BiblioPixel as well — if you want to use a different LED strip in the future this will make it very easy to use the same code base.
At this point, you should be able to run a few examples, and see animations on your LED strip.
If you want more information, feel free to ask me any questions in the comments section below!