The LPD8806 IC provides a simple way to offload the pulse width modulation (PWM) control of 6 separate LED channels (2 x RGB LED pixels) with 7 bit brightness resolution per channel. With 21 bits per pixel, that gives us 2,097,152 different possible brightness/colour combinations.
Strips using the LPD8806 IC are available through many sources (e.g. Adafruit). Most commonly they are sold as 32 LED per meter, but some manufacturers sell them as 36 or 48 LED per meter. Also note that some manufacturers make strips where fewer LPD8806 ICs are used, so that several LEDs (typically 2 or 3) are combined into the same pixel, which is not suitable here. Just FYI, the LEDs on these multi LED per pixel strips are wired in series, and thus require a higher voltage to run the strip, typically 12V (the IC requires 3.3 to 5V supply, but the LED’s can run off a separate, higher voltage).
For our purposes, we use the most common 32 LED, 32 pixel, strips, which operate from a nominal 5 volts. This strip can be easily cut every 2 LEDs, or at approximately 62.5mm intervals, and re-joined again to build a chain – data & clock outputs of one segment going into data and clock inputs of the next segment. Depending on the strip, power consumption is typically about 50mA per LED when set to bright white on a 5V supply, although some strips we tried used less and were thus not as bright.
There is one* reasonably serious issue with the LPD8806 – the only documentation available is in Chinese, and lacks it lacks the important SPI protocol description. Thankfully, the wonderful people at Adafruit, and several others around the net, have reverse engineered the protocol and provided good example code. But here I will give another description of the protocol, based on my own understanding.
The strips basically implement a large shift register, like SPI, but with a small trick to allow use of only 2 signals – data and clock, without a separate reset or latch signal. Each LPD8806 implements six 7 bit PWM controllers, but six daisy chained 8 bit shift registers (effectively a single 48 bit register). With a 1 metre length, and 32 LED/m, that gives a total of 32 * 8 * 3, or a 768 bit shift register.
As only 7 bits per colour are used, the most significant bit (MSB), which is sent first, is used as an indicator to signal when the LPD8806 shift registers should latch the data to their PWM controllers. The MSB of each byte must be kept high while shifting colour data normally, and the daisy chain data input to output will ripple through all 48 bits normally. The colour values should thus be in the range 0x80 to 0xFF, and for typical strips are sent in Green, Red, Blue order.
But when the MSB is left low, the internal shift registers will be bypassed, and the data output will effectively follow the input. This means that shifting just three** zero bytes will immediately latch all colour data along the full length of the chain. It also resets the shift registers ready for a new set of data to be shifted in.
An example of this data shifting will be shown in a future post of implementing fast software SPI.
* Another issue with the LPD8806 is that it is difficult to source as a standalone chip. We’ve been able to get hold of a couple of thousand to begin testing our custom PCBs, but most people will just want to buy the LED strip with the components already in place.
** There seems to be some disagreement around about how many zero bytes are needed to latch the data, but our experience has been that 3 bytes, or 24 bits, or all zero is sufficient.
*** While here I’ll mention two other features of the LPD8806. OMODE seems to allow inversion of the PWM output, so when pulled low the PWM will be active high. PMODE allows setting a parallel output mode, so when pulled low outputs 1&4, 2&5, and 3&6 are paralleled to provide higher driver currents. These pins seems to have internal pull ups, so can be left unconnected for normal use.