Working with LEDs and RGB LED strips
May 9, 2026 ยท View on GitHub
An LED is a special type of diode. While most diodes have a low forward voltage of around 0.6 volts, LEDs have a high forward voltage depending on the color of the light:
- Red: 1.6 to 2.0 volts.
- Green: 1.9 to 4.0 volts.
- Blue: 2.5 to 3.7 volts.
An RGB LED is the physical combination of three LEDs: red, green and blue. As a result, a forward voltage of around 3.5 volts is required to light them.
The ESP32 hardware operates at 3.3 volts,
which is not enough to light some of these LEDs.
For this reason, you may need a different power source,
which is labelled VLed in this project.
There are a number of options available:
-
3.3V power sources
Some LEDs will work with a 3.3 volt power supply. Attach
VLedto3V3.
Important
If your RGB LED strip seems to work with a 3.3V power supply, but shows wrong colors, then you need a 5V power supply. The main symptom is a red pixel when it should be white. If you don't have a 5V power supply available, you may set the global brightness to a low value (more on this later) as a workaround.
-
5 volts power sources (and higher)
Wheel bases and USB cables already operate at 5 volts, which is enough to power any LED. Attach
VLedto5Vif available.Higher voltages will work as long as you use a proper current limiting resistor for each LED. When working with LED strips, make sure your power source is within its specifications.
-
External powerboost module/shield
As described in the power subsystem, some external power boost modules provide both 5.0 and 3.3 volt outputs. Attach
VLedto the5Voutput. -
Builtin powerboost module/shield
If your DevKit board has built-in battery support, there is no 5V output. Connect
VLeddirectly to the positive pole of the battery. This is not optimal as some LEDs will go off before the battery is discharged.
RGB LED strips
Warning
In addition to this notes, always follow Adafruit's advice when working with LED strips.
LED strips are controlled by a single output-capable pin labelled Dout in this project.
Some LED strips can work with 3.3V logic, others cannot.
If your LED strip does not work with 3.3V logic,
you will need a small "level shifter" circuit, which is described below.
-
No level shifter (3.3V logic)
Wire
DouttoDinin the first pixel via a 300 to 1000 ohm resistor. The resistor should be at the end of the wire closest to the LED strip, not the DevKit board. This resistor can be omitted only if your LED strip already has a resistor inDin. Otherwise your LED strip could burn out.
Needed parts:
- 300 to 500 ohm resistor (x1)
-
Level shifter (5V logic)
Dinrequires a minimum voltage of 3.5 volts. The ESP32 operates at 3.3 volts, which is insufficient. To overcome this limitation, a "level shifter" circuit is required. We are using the most simple level shifter available: a pull resistor attached to a GPIO pin in open drain mode (Dout).
Test this circuit at falstad.com
Needed parts:
- 1K-ohms resistor (x1)
Each individual RGB pixel is controlled by a (very small) chip, called pixel driver. This project supports the following:
- WS2811 drivers. Note: not tested.
- The WS2812 family, including: WS2812 and WS2812B
- The WS2815 family. Note: not tested.
- SK6812 drivers. Note: not tested.
- UCS1903 drivers. Note: not tested.
- APA106 drivers.
Note
The popular RGB LED strips based on the WS2812B driver require a 5V power supply and a level shifter. However, I made it work with the brightness workaround, no level shifter and a 3.3V power supply.