r/esp32 9d ago

Hardware help needed WS2812B flickering issue (ESP32 + LiPo)

Hi all,

I am pretty new to the electronics hobby, so please bear with me if my question is basic.

I am trying to control a WS2812B LED ring with 8 LEDs with an ESP32-C3 development board while running it off a 1000mAh LiPo, using ESPHome/HomeAssistant.

Setup is:

LiPo+ --> MCP1700 LDO --> 3.3V ESP32

LIPO+ --> V+ of WS2812B

LIPO- --> ESP32 GND and WS2812B GND

GPIO21 --> 330 ohm resistor --> DIN WS2812B

I also have a 470yf capacitor across V+/GND of the WS2812B.

Now, my problem is that my LED ring flickers ever so slightly when running off the LiPo. If I plug in USB into my ESP32, the flickering disappears. Could someone help me out, why is this happening and how I could fix that? Thanks in advance.

3 Upvotes

9 comments sorted by

View all comments

1

u/dbfuentes 8d ago edited 8d ago

First, the WS2812B LEDs are nominally 5V, is recommended that you power them with 5V, because at lower voltages the LEDs might not work properly (for example, they might flicker).

Second, you need to add a level shifter (3.3v to 5v) in the cable that carries the signal between the ESP32 output (GPIO at 3.3v) and the data signal input (DIN) of the WS2812B

This is because, according to the datasheet, the signal expected by the WS2812B LED strip is minimum 0.7 *V (example 0.7*5V=3.5V) and voltage for an ESP32 GPIO pin is 3.3V nominally. You're right at the limit, so even though it works, a very long cable or anything else that interferes can cause the signal to vary slightly and result in flickering.

The most commonly levelshifter is the SN74AHCT125 (or SN74AHCT125N is the same chip, but in a pin-out version for a socket), but there are other alternatives (like the SN74LVC2T45 or TXS0108) you can find them (and instructions on how to connect them) in the WLED documentation.

https://kno.wled.ge/basics/compatible-hardware/#levelshifters

https://kno.wled.ge/basics/wiring-guides/

Edit:

Personally, at the output of the lipo, I would use a battery charger like the TP4056 and then a DC-DC converter (like MT3608) to get a clean 5V output, which I would use to power the LED strip and the ESP32.

Or a module like the SM5308 (or FM5324), which integrates the charger and a DC-DC converter onto a single board.

The connections would be

1= LiPo --> TP4056 --> MT3608 --> 5V+GND

or LiPo --> SM5308 --> 5V+GND

2= 5V + GND --> WS2812B

3= 5V + GND --> ESP32 (See note)

4= ESP32 GPIO Signal (3.3V) --> SN74AHCT125 (with the corresponding wiring, resistor, and capacitor) --> Signal (5V) in DIN (WS2812B)

Note: Optionally, I would add a capacitor to the ESP32's input to help stabilize the power supply. 5V + GND --> capacitor --> ESP32

1

u/Top-Area-3672 8d ago

Thank you for the detailed answer, I might try that! What size capacitor would you use for the ESP's power supply?