PWM

PWM

April 14, 2025

An Introduction to PWM: Controlling RGB LED Colors with an ESP32 Potentiometer

I’ll be honest: my first attempt to build an adjustable colored lamp ended with a dead LED and a faint smell of burnt hope. I’d hooked up an RGB LED straight to the ESP32’s GPIO pins, spun a potentiometer, and expected a smooth rainbow. Instead, I got a single angry flicker, then darkness. What I’d missed wasn’t just a current‑limiting resistor — it was the whole concept of Pulse Width Modulation (PWM).