Home / Peripherals / LEDC PWM
ESP32 LEDC PWM Guide: Channels, Frequency vs Resolution Trade-off
The ESP32 LEDC offers 16 PWM channels. Frequency and resolution trade off against each other — here is the maths and recommended values.
Channel count
The original ESP32's LEDC provides 16 PWM channels (8 high-speed + 8 low-speed) across four timer groups. Channels in the same group share frequency and resolution; groups are independent. That constraint catches a lot of people out.
Frequency vs resolution
The core formula:
actual frequency = 80 MHz / ( divider × 2 ^ resolution_bits )
So higher frequency means lower resolution. With the divider at 1, the theoretical ceilings are:
| Resolution | Duty steps | Max frequency | Good for |
|---|---|---|---|
| 8-bit | 256 | 312.5 kHz | Switching supplies, fast dimming |
| 10-bit | 1024 | 78.1 kHz | Flicker-free LED dimming |
| 12-bit | 4096 | 19.5 kHz | Servos, fine dimming |
| 13-bit | 8192 | 9.8 kHz | Motor drives |
| 20-bit | 1,048,576 | 76.3 Hz | Very slow, very fine control |
Need low frequency and high resolution? Increase the divider. A 50 Hz servo with a large divider and 12-bit resolution is perfectly fine — you do not have to drop to 8 bits.
Recommended settings
- LED dimming: 10–12 bit at ≥ 1 kHz. Below a few hundred Hz the flicker is visible, especially through a phone camera.
- Servos: 50 Hz (20 ms period), duty mapped to 0.5–2.5 ms pulses, 12-bit or better.
- DC motors: 5–20 kHz to move the whine above the audible range.
- Passive buzzers: change frequency to make tones, around 50% duty.
Notes
- Maximum resolution differs per chip (20 bits on the original, less on some newer parts) — verify against the official documentation.
- Hardware fade is handy, but check whether your call is blocking or non-blocking; you need the fade ISR installed for true background operation.
- LEDC runs through the GPIO matrix, so almost any output pin works — except the input-only GPIO 34–39.
- "Low-speed" channels can keep running from the RTC clock during sleep, which is ideal for a low-power breathing LED.
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.RMT (IR & WS2812)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.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.