WS2801 pixels can create really cool displays – for longer strips you can turn them into a matrix, or shorter ones can be used for lighting effects, visual notifications or anything you can dream up! Below is a short guide on how to use Python on Raspbian with an AndyPi PixelLight strip. If you want an easy setup controllable via your android phone, you can install hyperion – follow the same instructions as for the BerryGlow, but start with Raspbian!
Raspberry Pi (any model)
AndyPi PixelLight Strip (WS2801)
PixelLight === Raspberry Pi
+5v === +5v (pin 2)
GND === GND (pin 6)
SI (DATA) === MOSI (GPIO10 – pin 19)
CK (CLOCK) === SCLK (GPIO11 – pin 23)
(Alternatively, if you have a long strip, you can power from a separate supply (see diagram))
1. You’ll need to start with Raspbian installed on your SD card. I started with a fresh install of the 2014-9-9 issue, and ensure the SPI is available (it is turned off by default):
select number 8 (advanced options)
then select A5 (SPI)
finally select “Yes” to enable SPI by default
2. We need to install the hardware SPI control module for python. Start by updating the system, installing the development tools and pip if you haven’t already:
sudo apt-get update
sudo apt-get install python-dev
sudo apt-get install python-pip
sudo pip install spidev
3. Get the basic python module for accessing the PixelLights (based on Adafruit’s work), and run the file to test (you should get a rainbow swirl by doing the following:
git clone https://github.com/andy-pi/pixellights.git
sudo python AndyPiPixelLights.py
4. You’re now ready to download the demo python file, included in the repository (PixelLightsDemo.py) to create your own projects. You can edit this to your own requirements, controlling each pixel individually, using a rainbow swirl, or a colour wipe. All the modules are imported from the file above, see the comments in the code for examples!
5. You can also check out PixelPi software, which is for image processing for matrices of pixels.