I'm controlling a device that needs 12v and uses maximum of 2 amps (car fuel pump suction control valve). I'm using esp32 together with IRLZ44N logic level mosfet. I'm sending PWM signal with 1khz frequency to the gate from esp. It's very basic setup I used often with arduino. The mosfet is however getting very hot after about 20 seconds and melts breadboard. The esp32 also gets hot after few minutes and eventually stops working. I tried few different mosfets and already burned two esp32s.


simulate this circuit – Schematic created using CircuitLab

At first I thought the gate threshold is too low for this mosfet but turns out it's Vgs is as low as 2V to fully open. That wouldn't explain esp burning though.

What am I doing wrong here?

  • 1
    \$\begingroup\$ We need a schematic. But PWMing high frequencies doesn't work so well straight from a GPIO because the GPIO can't sink or source enough current to turn the MOSFET on and off fast enough. Also, when using a MOSFET as a switch you don't care about Vgth (is 2V the Vgth?) because that's the voltage where the MOSFET just barely starts to conduct. You want the Vgs that gets you the rated RDson which is much higher. \$\endgroup\$
    – DKNguyen
    Commented May 21, 2021 at 22:53
  • 1
    \$\begingroup\$ The max threshold voltage is 2V, that's not the voltage when the FET is low on resistance. What is your load? Is it inductive at all? If so do you have an anti-parallel diode to carry the inductive current on turn-off? What's your PWM frequency? We really need to see a schematic with more details. \$\endgroup\$
    – John D
    Commented May 21, 2021 at 22:55
  • 1
    \$\begingroup\$ The IRLZ44N needs at least 4V gate drive. You can see under the conditions column for the RDSon. Gate drive is still a potential issue. \$\endgroup\$
    – DKNguyen
    Commented May 21, 2021 at 23:43
  • 1
    \$\begingroup\$ Please complete your schematic with how the ESP32 board is powered. Do you have a freewheeling diode across your valve? \$\endgroup\$
    – winny
    Commented May 22, 2021 at 8:42

1 Answer 1


Your MOSFET will not turn on fully with Vgs=3.3V. You can use a 74HCT logic gate with a 5V power supply to convert 3V3 into 5V. The input voltage thresholds of HCT gates will read 3V3 levels correctly with good noise margin. Use a gate resistor on the FET, like 1kohms, to slow down the switching.

Since the load is inductive, the FET absolutely needs a freewheeling diode. Otherwise, at turn-off, the inductor will create a voltage spike on the FET and it will avalanche, which will make it heat up quickly. Without heat sink, it will smoke, fail in short circuit, and fry the ESP32.

  • 1
    \$\begingroup\$ After adding a diode it resolved my issues. Thanks! I previously worked with non inductive loads so that was new to me. \$\endgroup\$ Commented May 22, 2021 at 9:29
  • \$\begingroup\$ Good news! Have a nice day ;) \$\endgroup\$
    – bobflux
    Commented May 22, 2021 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.