4. January 2012 06:56
I bought a meter of addressable RGB LED strip from Adafruit. It uses the LPD8806 driver chip to drive LEDs. I didn’t find a writeup of the protocol, so here’s a quick overview.
Each LPD8806 has 6 PWM outputs and can therefore drive two RGB LEDs. It has two lines for SPI input (data & clock), and two lines for SPI output (data & clock).
It is implemented in a very simple way:
- When it receives a zero byte, it resets its byteCount to 0, and writes a zero byte on the output.
- When it receives a byte with the high bit set (ie ORed with 0x80) and its byteCount < 6, it uses the lower 7 bits of the byte to set the output of one of the PWM outputs. It then increments byteCount to move to the next PWM output.
- If byteCount == 6, it just sends the byte to the output.
When these chips are chained together, with the inputs of the second chip connected to the output of the first chip, they are quite easy to use. You just send a total of 3 bytes per LED, and bytes 1-3 go to the first one, 4-6 to the second, and so on. The byte order is not GRB instead of RGB, which is presumably done so that the PCB layout is simpler.
The color value is 7 bits per color, for 128 * 128 * 128 = 2,097,152 colors.
That’s about it.
And just to repeat the note in the tutorial…
Adafruit buys the strip in 5 meter lengths, with connectors at both ends. When you buy a shorter length they cut it off the longer length, so if it has a connector on it, the connector may be the one on the end rather than the one on the start. If you try to hook up to a connector on the end, it won’t work.