Multicolor LED strips generally come in two flavors – solid color and addressable. Solid color strips, as the name implies, have all of their LEDs display the same color. Addressable strips on the other hand allow you to control the color value of every individual LED in the strip. The most popular individually-addressable LEDs on the market at the moment are Adafruit Industries’ NeoPixels, based on the WS2182 chipset. They come in a variety of physical packages including strips, rings, and matrices.
Each “NeoPixel” is a self-contained 5050 LED with red, green, blue, and optionally white LEDs with an embedded controller. To set a pixel’s color you need to send a control signal containing color information. The pixel’s controller interprets the digital signal to determine its own color and then passes the data stream along to the next pixel in line. This allows you to string many pixels together and control all of them with a single microcontroller pin.
To start displaying colors on our LEDs we first need to convert our properly formatted color information into a precise datastream for embedded LED controllers. Fortunately others have already done most of the heavy lifting for us. Instead of writing the rather difficult assembly code from scratch we can use an Arduino library, a set of prewritten routines for a given project or device – in this case addressable LEDs.
As of this writing there are two main libraries for addressable LEDs: FastLED and Adafruit_NeoPixel. In almost every way FastLED is the superior choice. It deals with the stored color data more logically, has better scaling capabilities, and has many more functions for manipulating color information (including color temperature).
But unfortunately FastLED does not support RGBW strips!
The creator of FastLED has said that he’s working on RGBW implementation, but that he’ll basically need to rewrite a large portion of the library from scratch. There is no ETA at the moment, and I don’t want to wait to get this project going. The Adafruit_NeoPixel library has almost no color manipulation functions, but it does work perfectly for sending formatted color information to RGBW strips.
I spent a couple of days brainstorming how to mix the color functions of FastLED with the bit bang function of the NeoPixel library (i.e. its ability to output to RGBW strips) without modifying either, and the best implementation I came up with was 3x slower than using either library alone. The key sticking point is because the color information is formatted differently between the two libraries, you have to either store all color information twice (a CRGB array and a *pixels GRBW array), or convert the GRBW information to a temporary CRGB object if you need to call a FastLED function. I’d imagine that the best option would be to rewrite how the NeoPixel library stores its color information to include a CRGB object, but for the time being I’m going to use the Adafruit_NeoPixel library vanilla.
If you have a good solution for mixing the two libraries together, please let me know!