Using Audio Hardware To Drive Neopixels Super Fast

Here’s the thing about running large strings of Neopixels—also known as WS2812 addressable LEDs. You need to truck out a ton of data, and fast. There are a dozen different …read more

Jan 13, 2025 - 13:00
 0
Using Audio Hardware To Drive Neopixels Super Fast

Here’s the thing about running large strings of Neopixels—also known as WS2812 addressable LEDs. You need to truck out a ton of data, and fast. There are a dozen different libraries out there to drive them already, but [Zorxx] decided to strike out with a new technique—using I2S hardware to get the job done. 

Fast!

Microcontrollers traditionally use I2S interfaces to output digital audio. However, I2s also just happens to be perfect for driving tons of addressable LEDs. At the lowest level, I2S hardware is really just flipping a serial data line really fast with a clock line and a word select line for good measure. If, instead of sound, you pipe a data stream for addressable LEDs to the I2S hardware, it will clock that data out just the same!

[Zorxx] figured that at with an ESP32 trucking out I2S data at a rate of 2.6 megabits per second on the ESP32,  it would be possible to update a string of 256 pixels in just 7.3 milliseconds. In other words, you could have a 16 by 16 grid updating at over 130 frames per second. Step up to 512 LEDs, and you can still run at almost 70 fps.

There’s some tricks to pulling this off, but it’s nothing you can’t figure out just by looking at the spec sheets for the WS2812B and the ESP32. Or, indeed, [Zorxx’s] helpful Github page. We’ve featured some other unorthodox methods of driving these LEDs before, too! Meanwhile, if you’ve got your own ideas on how to datablast at ever greater speeds, don’t hesitate to let us know!