Thursday, August 16, 2012

Raspberry Pi and the WS2801

Update (October 29th):
Big update here:

Update (August 19th):
 - Pixel Invaders support provided in the 1.3.0-Beta4 release of pixel controller (Here:
- Tested and working with the latest checked in version of PixelPi
- Run it like this: " sudo python --chip WS2801 --mode all_off "
- It works by sending the pixel data to the pixelPi software using a UDP network connection.  So in pixelcontroller you must setup a UDP output device with the IP set to the IP address of your Raspberry Pi board  (Keep the port set at 6803)
- The PixelPi software receives the packet and sets the pixels accordingly.

Update (august 17th):
- Just added preliminary support for pixel invaders; Neophob (from just added UDP support so the pixelcontroller software can talk to the Raspberry Pi (  Its still a work in progress but should be functional(ish)

What it does so far:
- Supports POV LED Strip (Like the original Adafruit Software)
- Now Support matrix displays (2D Panels)
- Added some test modes (fade and chase modes)
- Supports pixel remapping (by using a CSV file with the location of your pixels in the array)
- Adjustable refresh rate / chase rate
- All options selectable by command line args (no python tweaking required (hopefully))
What's up next.
 - panning on large images across the pixel array.  Ideally I was thinking it would be cool to pass in some images from and have it pan around them.
- animation support (maybe animated GIF)
- TCP/IP support (support sending display data from another PC)


Grab the python file:
git clone git://

Install Python Image library:
sudo aptitude install python-imaging-tk

pi@raspberrypi ~/git/PixelPi $ sudo python  --help
usage: [-h] [-v] [--chip {WS2801,LDP8806}] --filename FILENAME
                  --mode {strip,array,fade,chase} [--verbose]
                  [--array_width ARRAY_WIDTH] [--array_height ARRAY_HEIGHT]
                  [--spi_dev SPI_DEV_NAME] [--refresh_rate REFRESH_RATE]

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  --chip {WS2801,LDP8806}
                        Specify chip type LDP8806 or WS2801
  --filename FILENAME   Specify the image file eg: hello.png
  --mode {strip,array,fade,chase}
                        Choose the display mode, either POV strip or 2D array,
                        color, chase
  --verbose             enable verbose mode
  --array_width ARRAY_WIDTH
                        Set the X dimension of your pixel array (width)
  --array_height ARRAY_HEIGHT
                        Set the Y dimension of your pixel array (height)
  --spi_dev SPI_DEV_NAME
                        Set the SPI device descriptor
  --refresh_rate REFRESH_RATE
                        Set the refresh rate in ms (default 500ms)

Test with a fade:
sudo python  --chip WS2801 --mode fade --refresh_rate 1

Test with a chase:
sudo python  --chip WS2801 --mode chase--refresh_rate 1

Display an image (POV mode):
sudo python  --chip WS2801 --mode strip --filename test.png --refresh_rate 1

Display an image (Array mode):
sudo python  --chip WS2801 --mode array --filename test.png --refresh_rate 1

Wire up the RGB LED string:
I did something similar to this:

My starting point: