Skip to content
Get started

ESP32 RMT LED Strip

The esp32_rmt_led_strip light platform drives most addressable LED strips using the RMT peripheral.

Here’s a comparison of some alternatives for driving these strips:

  • This component, the ESP32 RMT LED Strip, uses the RMT peripheral to precisely control the timing of the output and ensure compatibility with a wide range of LED strips. However, there is only enough RMT symbol memory to buffer a few pixels at a time. Flickering may occur when the microcontroller is busy performing higher priority tasks and the RMT interrupt cannot be serviced soon enough to refill the buffer for subsequent pixels.
  • The I2S Clockless LED Strip component uses the I2S peripheral and DMA to drive the output with larger buffers that are more immune to flickering caused by interrupt latency. However, the resulting waveform diverges slightly from the datasheet timing recommendations although in practice it is close enough for the LED pixels to work reliably.

NOTE

The ESP32-C2 and ESP32-C61 do not have RMT hardware and are not supported by this component.

# Example configuration entry
light:
- platform: esp32_rmt_led_strip
channel_colors: GRB
pin: GPIOXX
num_leds: 30
chipset: ws2812
name: "My Light"
  • pin (Required, Pin Schema): The pin for the data line of the light.

  • num_leds (Required, int): The number of LEDs in the strip.

  • chipset (Optional, enum): The name of the chipset used; determines signal timing. Not required if specifying the timings manually.

    • WS2811
    • WS2812
    • SK6812
    • APA106
    • SM16703
  • channel_colors (Required, string): The order in which the strip expects its color channels. List each of R, G and B exactly once, optionally with a single W in any position; for example GRB, BGR, GRBW, WRGB or RWGB. The value is case-insensitive. Including a W makes this a four channel RGBW strip.

  • max_refresh_rate (Optional, Time): A time interval used to limit the number of commands a light can handle per second. For example, 16ms will limit the light to a refresh rate of about 60Hz. Defaults to sending commands as quickly as changes are made to the lights.

  • use_psram (Optional, boolean): Set to false to force internal RAM allocation even if you have the PSRAM component enabled. This can be useful if you’re experiencing issues like flickering with your leds strip. Defaults to true.

  • rmt_symbols (Optional, int): When use_dma is enabled, this sets the size of the driver’s internal DMA buffer. When DMA is disabled, it specifies how much RMT memory is allocated to the component. RMT memory is shared across all components and should be allocated in multiples of the block size. On the ESP32 and ESP32-S2 variants, RMT memory is shared between RX and TX components. On other variants, RX and TX have their own RMT memory, but a TX component can also use RX memory that no RX component uses.

ESP32 VariantAvailable MemoryBlock Size
ESP32512 symbols64 symbols
ESP32-C396 symbols48 symbols
ESP32-C596 symbols48 symbols
ESP32-C696 symbols48 symbols
ESP32-H296 symbols48 symbols
ESP32-H2196 symbols48 symbols
ESP32-H496 symbols48 symbols
ESP32-P4192 symbols48 symbols
ESP32-S2256 symbols64 symbols
ESP32-S3192 symbols48 symbols
ESP32-S31192 symbols48 symbols

Each component uses its own RMT channel: remote_receiver uses an RX channel, remote_transmitter and esp32_rmt_led_strip use a TX channel. A channel uses at least one block of memory, so the number of channels is the available memory divided by the block size, for example 8 on the ESP32 and 2 on the ESP32-C3. On the ESP32 and ESP32-S2, RX and TX components share these channels. On other variants, RX and TX each have this many channels.

ESPHome checks all esp32_rmt_led_strip, remote_transmitter and remote_receiver components together. Validation fails if:

  • they need more channels than are available
  • more than one RX or more than one TX component sets use_dma, since only one channel per direction supports DMA
  • rmt_symbols is an odd number or smaller than one block
  • without use_dma, rmt_symbols is larger than one channel can use. On the ESP32 and ESP32-S2 that is all the RMT memory; on other variants it is the RX memory for an RX component, or the TX and RX memory together for a TX component
  • a transmitter or LED strip with use_dma sets rmt_symbols above 2046

A component with use_dma uses one block. When it compiles, ESPHome also works out which memory each channel gets when the components are set up: by setup_priority, then in the order of the configuration. A component that refers to another component by ID, such as a power_supply, can be set up after the ones that follow it. If a channel does not fit, ESPHome logs a warning that suggests an rmt_symbols value that fits, or a setup_priority that sets up the smaller ones first. esphome config does not show this warning. The order matters because a TX channel can extend into memory that the next one would need: on an ESP32-S3, a 48 symbol strip followed by a 288 symbol strip fits, but not the other way round.

  • use_dma (Optional, boolean): Enable DMA on variants that support it. If enabled rmt_symbols controls the DMA buffer size and can be set to a large value, up to 2046.

  • All other options from Light.

These can be used if you know the timings and your chipset is not set above. If you have a new specific chipset, please consider adding support to the codebase and add it to the list above.

  • bit0_high (Optional, Time): The time to hold the data line high for a 0 bit.

  • bit0_low (Optional, Time): The time to hold the data line low for a 0 bit.

  • bit1_high (Optional, Time): The time to hold the data line high for a 1 bit.

  • bit1_low (Optional, Time): The time to hold the data line low for a 1 bit.

  • reset_high (Optional, Time): The time to hold the data line high after writing the state. Defaults to 0 us.

  • reset_low (Optional, Time): The time to hold the data line low after writing the state. Defaults to 0 us.