I have bought a couple of these led strands from adafruit. http://www.adafruit.com/products/322

they use WS2801 chips.

I have a raspberry pi B+ running raspbian

I have been having problems controlling the LEDS properly.

I have been using this command to debug: echo -ne "\xFF\x00\x00" > /dev/spidev0.0

When I send \xFF\x00\x00 it turns the first LED to yellow.

which led me discover that the first byte controls both the 1st red and 1st green LEDS, and then the next byte controls the 1st blue LED and the 2nd red LEDs.

in the first byte:

1-15 controls 1st green led, 1 being lowest intensity to 15 being the highest.

16,32,64,80,96,112,128,144,160,176,192,208,224,255 controls 1st red led, 16 being lowest intensity to 255 being the highest.

the rest of the numbers are just combinations green and red intensity.

My understanding was that the 1st byte controls the 1st red LED, 2nd byte controls the 1st green LED and the 3rd byte would control the 1st blue LED.

Does anyone know why this would be happening?

  • You need to send 24 bits per LED, i.e. three bytes per LED. What happens when you send the correct data? If you send incorrect data the chip is free to do pretty much what it wants as you are using it out of spec. – joan Jun 10 '15 at 16:25
  • If I send \xFF\x00\x00 the first led is yellow. Is that sending the correct data? – MonkeyTravel Jun 10 '15 at 16:45
  • I'd have thought so. But that's not what you said you were sending. – joan Jun 10 '15 at 16:53
  • Sorry for the confusion. I edited the question. Hopefully that makes it less confusing. – MonkeyTravel Jun 10 '15 at 16:59
  • I would be tempted to try sending data for at least 4 LEDs in each string. E.g. \xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00 and see if each LED (or at least the first three) have the same colour. There will be an inter-byte time gap, but I think it is of the order of 1.5 bit times, so should not muck up the timing. – joan Jun 10 '15 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.