Home / Peripherals / RMT (IR & WS2812)
ESP32 RMT Guide: Infrared, WS2812 LED Strips and Pitfalls
RMT is the most underrated ESP32 peripheral: IR remotes, WS2812 strips and one-wire sensors all depend on it. Channels, resolution and the Wi-Fi interference problem.
What RMT is for
RMT (Remote Control) was designed for infrared remotes, but really it is a programmable precision waveform generator. It emits arbitrary high/low sequences at ~12.5 ns resolution and does so without the CPU — you write the data to memory and the hardware plays it out while the core does something else.
Besides IR it is now the standard way to drive:
- WS2812 / SK6812 one-wire RGB strips (by far the most common use today)
- DHT11 / DHT22 one-wire sensors (both RX and TX)
- Stepper-motor pulse trains and other custom single-wire protocols
Channels and resolution
| Item | Original ESP32 | Note |
|---|---|---|
| Channels | 8 | Shared between TX and RX |
| Clock source | 80 MHz APB | ≈12.5 ns per tick |
| S2 / S3 / C3 / C6 / H2 / P4 | Verify against official docs (counts differ; C3 has notably fewer) | |
Check the documentation for channel counts: they vary a lot between chips, so only the original ESP32 figures are stated here.
The big one: Wi-Fi makes your LEDs flicker
WS2812 timing is tight (a "0" bit is about 0.35 µs high). While Wi-Fi is active the radio briefly stalls the bus and delays the interrupt that refills RMT memory, stretching a bit — which shows up as randomly wrong colours or a flickering strip.
Common mitigations:
- Send the strip in small chunks to shorten each transfer.
- Bit-bang the waveform over SPI instead — SPI has DMA and copes far better.
- Lower the refresh rate to dodge Wi-Fi bursts.
- Disable Wi-Fi modem sleep to reduce sudden latency spikes.
Other gotchas
- Symbol memory per channel is limited: long strips must be sent in chunks or via loop mode.
- RMT is not pin-picky — it runs through the GPIO matrix — but the input-only GPIO 34–39 cannot be used.
- IR transmit needs a transistor to drive the LED; the IO pin cannot source enough current.
- IR receiver modules (VS1838B and friends) output inverted logic: low means carrier present.
Data verified:2026-10-20 · Cross-checked against Espressif documentation. Anything that varies between chips or ESP-IDF releases is marked rather than guessed.
Official peripheral docs →
Related
I²CWhich two pins to use for I²C on the ESP32, what pull-up value to pick, and why your device never shows up on the bus scan.SPIWhich pins HSPI and VSPI default to, how fast you can realistically clock them, and why your display stays black.UARTWhich pins each of the three UARTs defaults to, why UART1 appears broken, and what to check when flashing fails.LEDC PWMThe ESP32 LEDC offers 16 PWM channels. Frequency and resolution trade off against each other — here is the maths and recommended values.Deep SleepHow low the current really goes, which pins can wake the chip, and whether your variables survive. Use it with the battery life calculator.