ESP32 Destroyed by MOSFET – Causes and Solutions

esp32esp8266mosfettransistors

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.

schematic

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?

Best Answer

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.