Page 1 of 1

SPI & WS2801 LED Strips

Posted: Tue Feb 03, 2015 1:00 am
by markvr
Hi All,

I have some of these WS2801 LED strips: http://proto-pic.co.uk/rgb-led-chain-20 ... dressable/

They work fine with my Arduino, but I'm struggling to get them to work with my PI, and would appreciate any advice!

I have a B+, and have enabled SPI in rasp-config, rebooted and can see the "spidev0.0" entry in /dev

I've connected the "data" line to pin 10, and the clock line to pin 11 (according to this diagram http://www.raspberrypi-spy.co.uk/2014/0 ... nd-pinout/)

I've connected the 5v line to the 5v on the GPIO (pin2), and the ground to pin6

I'm then trying to run the Adafruit test program as "root": https://github.com/adafruit/Adafruit-Ra ... Dpixels.py with the number of LEDs set to 5 so I don't draw too much power from the Pi.

I've also tried the PixelPi library https://github.com/scottjgibson/PixelPi

No matter what I do, the LEDs refuse to so much as blink! They just remain out the entire time. I've also tried connecting them directly to an external 5v supply and connecting the ground of that to a ground on the GPIO.

Have I missed something, I don't really know what else to try! Like I said,they work fine with my Arduino so it's definitely something to do with the Pi config...

thanks!

Re: SPI & WS2801 LED Strips

Posted: Tue Feb 03, 2015 1:11 am
by DougieLawson
There's five wires needed for SPI.
GND
MISO (master in, slave out)
MOSI (master out, slave in)
CS (chip select)
SCLK (clock line)

And for some devices you'll also need 3V3. If your device drives input pins at 5V0 you may need to use voltage dividers.

http://pi.gadgetoid.com/pinout/spi

Re: SPI & WS2801 LED Strips

Posted: Tue Feb 03, 2015 1:17 am
by markvr
Thanks, but I'm not clear. My pixels only have 4 wires, and it works fine on the Arduino just 4. I'm using a WS2801 Arduino library, so not doing SPI directly, but AFAIK it uses the SPI.

I've also tried wiring it up like the Adafruit example which only has 4 wires: https://learn.adafruit.com/raspberry-pi ... d-software

Re: SPI & WS2801 LED Strips

Posted: Tue Feb 03, 2015 1:19 am
by DougieLawson
MOSI (master out, slave in) == data in (DI)
SCLK == clock in (CI)

I assume it's not sensitive to CS and assumes it's the only SPI device on the bus.

You are probably OK with 5V0 because both of those are output signals and 3V3 from the RPi should be high enough to be seen as high by your SPI device.

If it isn't then you'll need two transistors for each line to amplify the high signal from 3V3 to 5V0.

Driving your Arduino from your Raspberry Pi (using the USB/serial interface) and having the Arduino drive the LED strip may be easier.

Re: SPI & WS2801 LED Strips

Posted: Tue Feb 03, 2015 11:56 pm
by markvr
I fixed this by randomly changing advanced settings in raspi-config and updating with rpi-update.

I disabled "devicetree", enabled I2C, and ran rpi-update, which pulled some updates down.

Some combination or other of all this meant that it finally started working!