NeoPixel (WS2812-based) digital RGB LED strip are very popular as they are affordable and easy to use. These are driven from only one wire, which is very convenient. Unfortunately for C.H.I.P users, as there is no clock line, it requires more or less precise timing requirements. It is very easy to drive them using microcontrollers, but difficult using a full-fledged operating system.

It doesn't look that bad in the Pi land but there is no driver on the C.H.I.P yet. While it may be attainable using DMA, our best bet to drive a LED strip from a C.H.I.P is to use a 2-wire interface alternative: the DotStar APA102. These are available in various formats, including micro 2020 SMD. They can be controlled from a standard SPI interface using SCLK for clock and MOSI for data.

There is a pure Python library to control it from a Raspberry Pi. With a few tweaks, we can will make it work on the C.H.I.P. On C.H.I.P, SPI support is not enabled by default, but spi module is now part of the standard kernel so you don't have to compile your own.

Enable SPI

Follow these instructions to enable SPI communication on the C.H.I.P.

APA102 driver installation

Clone the repo then apply the following patch to (or get it from my fork):

--- a/
+++ b/
@@ -62,8 +62,8 @@ class APA102:
         self.ledstart = (globalBrightness & 0b00011111) | 0b11100000 # Don't validate, just slash of extra bits
         self.leds = [self.ledstart,0,0,0] * self.numLEDs # Pixel buffer
         self.spi = spidev.SpiDev()  # Init the SPI device
-, 1)  # Open SPI port 0, slave device (CS)  1
-        self.spi.max_speed_hz=8000000 # Up the speed a bit, so that the LEDs are painted faster
+, 0)  # Open SPI port 0, slave device (CS)  1
+        self.spi.max_speed_hz=500000
+        self.spi.mode = 3 # CPOL=1|CPHA=1

The C.H.I.P has a slower SPI than the Raspberry Pi with the default max speed being 500 Khz. In practice, I found the SPI to be stable up to 2.5 Mhz on by board. 500 Khz is also fast enough to drive long strips and small panels @ 30FPS+. Roughly FPS=SPI_SPEED/((32*N_LEDS)+32+(N_LEDS/2)) apa102 clock

By en:User:Cburnett - Own workThis vector image was created with Inkscape., CC BY-SA 3.0, Link

Wiring and testing

Wire your strip. Be cautious: the strip is 5V powered and input high should be at least 0.7*VDD which is 3.5V while the C.H.I.P has 3.3V GPIOs. Lower the the strip voltage a bit (e.g. using a diode) or use a level shifter.

Run the sample lightshow using python3 You might want to edit the number of LEDs in the source file.