• Published on | Nov 19, 2016 | by FozzTexx

Controlling WS2812 RGB LEDs from the ESP32

I've posted my code which uses the RMT peripheral on the ESP32 to control WS2812 RGB LEDs. The LEDs can be controlled from within a task without any flickering because the timing of the pulses is controlled by the RMT peripheral. As the RMT peripheral exhausts its buffer it sends an interrupt which then refills the buffer just in time.

I tried to make the driver fairly generic and re-usable, but it hasn't been thoroughly tested. It currently sets up and manages the RMT directly since there is no RMT driver in Espressif's esp-idf yet. Doing it directly may also be helpful for others who are interested in seeing how to use the RMT peripheral, so I don't know if I will change the ws2812 driver when the esp-idf is updated.

Commenting disabled for spambots