A brief tour of intelligent LEDs

I’m not really sure what the history of these is. At some point, I started seeing people using RGB LED stuff and suddenly everybody was screwing with them.

Hackaday indicates that the WS2812 dates back to the second half of 2013 or so with the APA102 showing up on the scene a year later.

Either way, these days, there’s a huge variety of intelligent LEDs out there these days.

Intelligent LEDs are pretty great and kinda easy

If you are working with plain old regular LEDs, you have to think about resistors, switching the voltage on and off, etc.

For intelligent LEDs, generally all you need is power and data. This is easy!

All of this is fluffy-weird

There are TI chips that look a little bit like the popular NeoPixel devices but if you want to get a cheap 1 meter long LED strip, you won’t see those TI chips in use. There isn’t a wealth of code examples for how to drive the TI chips nor are they price-competitive, etc.

Instead, everything in the world of intelligent LEDs revolves around parts that work their way to you through a web of actually quite opaque business connections.

It turns out that most of this stuff isn’t excessively hard, if you happen to have an electronics factory of some sort. It would probably be a fascinating article for someone to research just a few of the strands of this web of market links.

The real market pressure seems to have been to make things close enough to everything that’s already out there that nobody has to worry too much about changing their design around somebody else’s fancy LED device.

This does, however, mean that you probably want to test carefully the strip you intend to use in a finished piece before you make any irreversible decisions. Sometimes you buy two strips that look the same but electrically are slightly different and so you can’t use them in the same project. Some chips are OK with 3.3v logic and 5v power, others are not.

Form factors

The first form factor you’d see is just a really tiny friendly general-purpose LED controller chip designed to drive a small number of LEDs that would be soldered to a strip of flexible PCB.

Eventually, folks started integrating the controller chip directly into the LEDs, which created intelligent LEDs.

You can buy these discrete LEDs in a variety of shapes. The 5050 package is the standard but you can get them in right-angle versions or smaller packages. They also make them in 5mm or 8mm packages.

You can also buy finished products containing these LEDs. You can get them in two-dimensional arrays, solid strips, flexible strips, circles, bars, etc.

More recently, these LEDs started being available as COB devices where they are much more densely packed, soldered to a strip, and then covered with a plastic material. The tightest 5050 strip is 144 LEDs per meter, these have more like 350 LEDs per meter.

Clocked vs clockless LEDs

clocked vs clockless LEDs

There are two big categories of devices.

First, there’s the clocked devices. Outside of power, these use two additional wires. One wire contains the clock strobe, one wire contains the data.

Second, there’s the clockless devices. Outside of power, these use a single additional wire that requires a bit of microcontroller chicanery to drive a signal with a frequency within a particular range with a particular encoding. Basically, you have to output bits at a consistent rate, which means that you tend to have to tune everything to the processor in question and what clock speed it is running at and you need to disable interrupts. And electrical flakiness will tend to cause strobing or other weird effects.

Because needing to string half as many wires is a huge gain, most people put up with the troubles of the clockless device.

Clocked devices are still handy because you can run them slower (say off of a 1 MHz microcontroller) or faster (say, 40 MHz for the signal) and they won’t complain. And because it’s two signal lines that operate in concert, there’s some reduction in the potential for electronic glitchyness.

The “NeoPixel” series

This is the most popular intelligent LED in the world of people who make cheap electronics and hack on electronics for fun. At some point, AdaFruit started selling them as “NeoPixels” and the name stuck.

These are the archetypical clockless device and there are a lot of devices out there that roughly speak the same protocol, so when I describe a product part number, understand that there’s a fairly good chance you are getting some almost-compatible or clone or otherwise different chip that happens to act exactly like the genuine issue and if you look on any of the marketing sites, those are your search terms.

The start of the family tree is the WS2811, a discrete LED controller chip designed to drive RGB LEDs.

This begat the WS2812, which is mostly just a WS2811 but with a LED integrated which has been followed by the WS2812B, and a bunch of other similar devices like the SK6805.

From there, there’s the SK6812 that can do RGBW instead of just RGB.

There’s also the WS2813, which adds a second signal line and the WS2815 which keeps the second signal line but is also designed to run off of 12V.

There are a bunch of compatible or almost-compatible devices out there. For example, there’s the WS2814 which is RGBW like a SK6812 but it’s made by a different company and it’s a chip to drive external LEDs.

There’s a lot of variety here and it’s all relatively easy to find.

The most popular form factor is the 4 pin or 6 pin 5050 module, which you can hand-solder relatively easily. These get turned into LED strips or integrated onto circuit boards in all sorts of shapes and sizes.

There’s the very similar 3535 form factor that’s just a smidgen smaller.

There’s a right-angle 4020 form factor that you can’t really hand-solder, sadly. There’s also a bunch of even-smaller packages which you can’t really hand solder either.

There are 5mm or 8mm through-hole LEDs with four pins that you can solder up in interesting configurations and also can be used to make Christmas lights.

There’s some blobbier pieces that use a chip like the WS2811 for larger Christmas lights styled strings or sometimes with added bits to drive a giant 3W or brighter LED.

And you can get the driver chips like the WS2811 or others.

Finally, there are COB strips.

You can get all of these in RGB, plus you can frequently find all-white, and WWA (warm-white/cool-white/amber, which gets no respect, but I like them), and RGBW.

You can frequently take apart toys that look like they’ve got smart RGB pixels in them and this will be the LEDs they use.

Part of why these are popular is that they are cost-optimized. They don’t PWM or update fast enough to make a persistence-of-vision toy, although you can encourage a small number of devices to drive a parallel set of them to get the update rate up enough for video.

At the same time, there’s enough variance that you might think you can drive a strand containing a bunch of different types of NeoPixels but it’ll flake out on you.

The “APA102” series

These are the second most popular LED, the archetypical clocked device.

Adafruit sells them as “DotStar” but most of the time, folks just call them APA102, even though a lot of the devices are probably other devices like APA107 or SK9822 or HD107 chips.

These have a significantly reduced chance of going flaky. I haven’t done a head-to-head comparison between the WS2813/WS2815 redundant-wire versions of the NeoPixel, but these tolerate a lot of electrical and clock weirdness. Most importantly, if the processor has an interrupt of some sort of your interpreter garbage collects, a NeoPixel is going to have corrupted data whereas with an APA102 it’ll pick up where it left off.

These are much less cost-optimized and PWM significantly faster, so you can actually create a persistence-of-vision toy with one, although with the number of different chips out there, you don’t always get the fastest-of-the-fast PWM frequencies, just faster-than-the-NeoPixel PWM frequencies.

They support a per-pixel 5 bit brightness control, however on at least some of the chips, that’s overlaying a fairly low frequency PWM atop the high frequency PWM, thus destroying the whole advantage of using these instead of a NeoPixel.

There’s a lot less variety for APA102 pixels. You can sometimes find white pixels but never WWA or RGBW versions.

Hardware trickery

The clocked APA102 pixels are able to be driven by the SPI port on most common devices. This can also mean that there’s a DMA controller that can be encouraged to spit out the pixel data without the CPU’s involvement.

There may be a peripheral that can be put towards the purpose of driving NeoPixels. For a long time, NeoPixels were thought to be completely incompatible with the Raspberry Pi without an intervening microcontroller but they figured out how to make it work. DMA controllers, PWM drivers, I2S ports, UARTs, et al. all have been made to work.

On certain devices, notably the Teensy, the SAMD21 and the SAMD51, the DMA controller can be encouraged to drive parallel strips of NeoPixels, although this means that it needs to create in-memory buffers to store the interwoven bitstream.

As soon as the Raspberry Pico’s PIO controller was documented, folks were coming up with ways to drive NeoPixels with it using a shift register to save pins.

In general, it helps to understand the available libraries for your platform that can drive LEDs and what ports they work best on.

Be careful when mixing different LED types

NeoPixels and APA102’s are completely different so you are always going to be driving them completely separately.

Different kinds of NeoPixels… that’s different. RGB and RGBW NeoPixels don’t mix. Different kinds of RGB or RGBW neopixels might mix. The timings for WS2811, WS2812, and SK6812 NeoPixels are ever so slightly different on the RGB side. Worst case you might have to default to the 400 kHz low-speed mode.

tl;dr: These are amazingly handy for a wide variety of problems

At least twice so far, I’ve done up an elaborate fancy project involving driving non-intelligent LEDs and spent a bunch of energy getting it right… and then it didn’t quite work out the way I wanted… and then when I take a step back and just use an intelligent LED, I realize that I didn’t need to do all of the extra work.

On the other hand, there are reasons to screw with this. A non-intelligent LED strip is generally a lot brighter than an intelligent LED strip, you generally can’t get a NeoPixel with a high CRI white, and you can’t get a RGB+Warm White+Cool White+Lime+Violet NeoPixel.

Where to go from here?