WS2812B Strip flickering when using MOSFET to cut power

Hello,

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 and sorry for the poor schematic quality, I currently only have a KiCad PCB schematic available.

Is mosfet connected as in your picture? In case, you have to swap drain and source, drain (middle pin) go to the strip, source to GND.

Ciao, Ale.

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 all you are doing is cutting ground to the LED, you still have the signal pin sending data, and probably acts as a ground when "0".

Why don't you just send "color black" then stop sending data?

HI, @oxmose

Do you have a DMM? Digital MultiMeter?

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.

Tom.... :smiley: :+1: :coffee: :australia:

  • Use a High Side Switch configuration with a P channel MOSFET.
1 Like

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

Thanks!

Thank you for the advice, sadly I have the constraint to only use this MOSFET at the moment. I will see if I can change it in the future.

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.

Thanks for the answer!

Could it be possible that the MOSFET is defective?
I used the same setup on a protoboard and it worked. The only thing that I changed are:

  • Protoboard is now a PCB
  • The MOSFET is the same reference but is just a different part than the one used on the protoboard setup.

And I agree 40mA is not much, but already too much for the battery I can afford to use in this project.

Well... That makes it harder to add a level shifter. :frowning:

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.)

I will try that, if nothing works I will add the level shifter, I have to update the PCB anyway since I am adding new stuff to it.

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!

Thanks!

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.

Ciao, Ale.

1 Like

That a neat trick, I will try that too.

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)?

That you get better battery life...

That's smart!!!

The rest of the LEDs can go full-brightness.

1 Like

Yes, but it's not my found, comes from here:

Ciao, Ale.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.