I am having an issue with my current setup.
I have an ESP32 powered by a 7.2V - 16.4Wh battery and using a voltage converted to set the actual output to 5v.
I am using a WS2812B led strip (120 leds) powered through 5V (using the same power output as the ESP32).
I use a MOSFET to cut power to the LED strip because I realized that even when no led is powered on on the strip, the strip consumes too much power to my likings.
The setup is as follows:
ESP32 -> LED Data line is protected with a 330Ohm resistor.
LED Strip 5V is directly connected to the 5V input.
LED Strip GND is connected to a MOSFET to turn it on / off.
Now for the issue:
When the LED Strip GND is connected to the MOSFET, the LEDs are all flickering and I cannot control the strip. The On/Off mechanism works fine. When I connect the Strip GND to the ESP32 / Common GND, everything works fine.
I am wondering why the flickering happens when using the MOSFET. It is a RFP30N06LE.
I do not think this is a power issue since using the common GND leads to a perfect behavior.
Thanks for the reply,
Sorry I made a mistake in the schematic, I updated it to reflect the actual wiring. The drain goes to the strip and source to GND.
If you do, then measure the gnd to drain voltage when the MOSFET is turned ON.
A better schematic can be drawn with pen(cil), ruler and paper.
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Hi @xfpd , that is pretty much what I am doing. After stopping sending data, and setting all LEDs black, the strip still consumes about 40mA. That's why I am using the MOSFET to turn it off. When turned off everything is fine, it is when the leds are ON that I encounter issues.
Thank you for the hints! I will proceed with the measurements. If my problem persists I will just draw the schematic in KiCad, I've been slacking on this for too long ahah
You could use a relay which is a "perfect switch" but the relay coil consumes power (when energized).
A solid state relay might work but since they are made with MOSFETs you may have more voltage drop than with an electro-mechanical relay. If you try a solid state relay, make sure to get one rated to switch DC. AC & DC solid state relays are not generally interchangeable.
I can think of two related possibilities causing hte problem -
The MOSFET isn't turning fully-on. That is, the drain isn't going close-enough to 0V (ground).
And you are using an ESP32 which is a 3.3V chip. The LED strip really wants 5V data.
The combination of those two things is probably causing flaky operation.
Adafruit recommends a level shifter for 3.3V controllers.
That's pretty low for 150 LED drivers but with battery power the amp-hours will add-up.
Well... That makes it harder to add a level shifter.
It could be normal part tolerances since I think you're on the hairy edge.
If the 5V regulator is adjustable try bringing it down to around 4.5V, or at least make sure it's not over 5V. Powering the LED strip closer to the 3V data signal may help. If it's not adjustable try a diode in series to the LED strip to get a small voltage drop. (With 150 RGB LEDs it should be rated for 10A or more.)
If the 5V regulator is adjustable try bringing it down to around 4.5V, or at least make sure it's not over 5V. Powering the LED strip closer to the 3V data signal may help
This solved the problem. I might have slightly increased the voltage when moving from the protoboard to the PCB. I will need a level shifter to have something clean, but for now it did the trick!
A trick, if doable, is to use a diode on just the first led of the chain, and use the full 5V from the second one. In this way the first led will do level shifting for the rest of the chain, and you can use a common 1N4007.
In the meantime, for prototype purposes, what is the risk to keep my setup with the regulator set to 4.6V (this is the voltage at which I do not have any flickering anymore)?