MOSFET voltage drop and LED flickering

I've build a LED strip controller using NodeMCU and a transistor STP16NF06FP according to the schematic below:

LEDs were powered with 24 V power supply and I want to regulate it by changing the voltage using PWM on mcu. So for the simplicity's sake I output 255 on PWM pin D5 and the voltage output is ~16 V instead of ~24V also LEDs are flickering.

When I power NodeMCU from USB instead of voltage stabiliser then it is not flickering, but the voltages remain the same.

How to get rid of flickering and get a higher voltages? Max power output from power supply is 0.5 A and it is enought to power LEDs.

When I mount IFRZ44N instead of STP I get ~16 V but the LEDs barely light.
With TIP120 there is no flickering but the output is ~16.7 V (so still a voltage drop, I wanted to replace to MOSTFET as these should have less voltage drop than NPN).

Here is the code for NodeMCU https://bitbucket.org/mdczaplicki/smarthome/src/master/node_mcu/node_mcu.ino

• Is the LED strip rated for 24 VDC operation ? Jul 26, 2019 at 14:00
• @RussellMcMahon correct Jul 26, 2019 at 14:13

The STP16NF06FP requires 10V Vgs to drive it reliably fully on. You are giving it 3.3V approximately.

You either need to find a logic-level MOSFET that is rated for 3.3V or lower Vgs or make a gate driver circuit to give more voltage to the gate.

• According to my datasheet Vgs is 20 V, but I see now. Is it smart to use second transistor to control this one or is it an overkill and I should buy for example: PSMN2R7-30PL? Jul 26, 2019 at 14:20
• If your PWM frequency is slow you could use a jellybean NPN BJT with a base resistor and pullup to +12. Eg. 1K for each resistor. 1/4W for the pullup. PWM logic is reversed (high = off). Jul 26, 2019 at 14:23
• I've got no 12 V in my circuit, though isn't TIP120 an NPN BJT? I think I will go with logic level mosfets, maybe I will buy more of them just to have them. Is there any you could recommend for my specification? Jul 26, 2019 at 14:41
• You could add a 78L12 or 78M12 etc. For only 0.5A I'd probably use a AO3400A because I happen to have a reel of them on hand, but the SOT-23 is pretty easy to fry if anything bad happens (like input floating) so a 10K-100K gate-source is a good idea. Jul 26, 2019 at 14:45
• Marek, the 20V spec on Vgs for the 16NF06FP is the absolute max voltage. The recommended drive voltage to turn the FET fully ON is 10V. Jul 26, 2019 at 15:01