# LED Strip Driver

[![Component Registry](](

This driver is designed for addressable LEDs like [WS2812](, where each LED is controlled by a single data line.

## Backend Controllers

### The [RMT]( Peripheral

This is the most economical way to drive the LEDs because it only consumes one RMT channel, leaving other channels free to use. However, the memory usage increases dramatically with the number of LEDs. If the RMT hardware can't be assist by DMA, the driver will going into interrupt very frequently, thus result in a high CPU usage. What's worse, if the RMT interrupt is delayed or not serviced in time (e.g. if Wi-Fi interrupt happens on the same CPU core), the RMT transaction will be corrupted and the LEDs will display incorrect colors. If you want to use RMT to drive a large number of LEDs, you'd better to enable the DMA feature if possible. [^1]

#### Allocate LED Strip Object with RMT Backend

#define BLINK_GPIO 0

led_strip_handle_t led_strip;

/* LED strip initialization with the GPIO and pixels number*/
led_strip_config_t strip_config = {
    .strip_gpio_num = BLINK_GPIO, // The GPIO that connected to the LED strip's data line
    .max_leds = 1, // The number of LEDs in the strip,
    .led_pixel_format = LED_PIXEL_FORMAT_GRB, // Pixel format of your LED strip
    .led_model = LED_MODEL_WS2812, // LED strip model
    .flags.invert_out = false, // whether to invert the output signal (useful when your hardware has a level inverter)

led_strip_rmt_config_t rmt_config = {
    .clk_src = RMT_CLK_SRC_DEFAULT, // different clock source can lead to different power consumption
    .resolution_hz = 10 * 1000 * 1000, // 10MHz
    .flags.with_dma = false, // whether to enable the DMA feature
ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip));

[^1]: The DMA feature is not available on all ESP chips. Please check the data sheet before using it.


## 1.0.0

- Initial driver version, based on the legacy RMT driver (`driver/rmt.h`)

## 2.0.0

- Reimplemented the driver using the new RMT driver (`driver/rmt_tx.h`)

## 2.1.0

- Support DMA feature, which offloads the CPU by a lot when it comes to drive a bunch of LEDs
- Support various RMT clock sources
- Acquire and release the power management lock before and after each refresh
- New driver flag: `invert_out` which can invert the led control signal by hardware

## 2.2.0

- Support for 4 components RGBW leds (SK6812):
  - in led_strip_config_t new fields
      led_pixel_format, controlling byte format (LED_PIXEL_FORMAT_GRB, LED_PIXEL_FORMAT_GRBW)
      led_model, used to configure bit timing (LED_MODEL_WS2812, LED_MODEL_SK6812)
  - new API led_strip_set_pixel_rgbw
  - new interface type set_pixel_rgbw

## 2.3.0

- Support configurable RMT channel size by setting `mem_block_symbols`


Supports all targets

License: Apache-2.0

To add this component to your project, run: add-dependency "espressif/led_strip^2.3.0"

or download archive


  • ESP-IDF >=5.0
  • Stats

    • Downloaded in total
      Downloaded in total 582.6k times
    • Downloaded this version
      This version: 35.6k times


    espressif/led_strip version: 2.3.0