I made a simple circuit based on an ESP32 for my watering system.

I built this circuit to switch a 12 V pump on and off:

enter image description here

The circuit is powered by a USB power bank and a boost converter to convert 5 V to 12 V. The pump is switched using an NCE6050A N-channel MOSFET. I've added an XKC-Y23A liquid sensor to detect when the water is running low.

The circuit worked properly for several days but after that it stopped working.

I noticed that the AMS1117 LDO converter and the ESP32 chip on my DEV kit board became very hot.

I suppose that something burned it out, but I can't understand what is wrong with the circuit. Can anyone help me find the cause of the issue?

  • 2
    \$\begingroup\$ Do some measurements on the circuit. For example, is the FET shorted out, did it pass 12V to ESP IO pin and blow up thr ESP, and that's why AMS1117 heats up? \$\endgroup\$
    – Justme
    Feb 18 at 9:41
  • 1
    \$\begingroup\$ The NCE6050 is unsuitable as you only supply 3.3V to the gate. The datasheet only shows a line for 4.5V and above. Select a more suitable mosfet or add circuitry to switch the gate to a higher voltage. \$\endgroup\$
    – Kartman
    Feb 18 at 9:45
  • 1
    \$\begingroup\$ it seems working @3V i.stack.imgur.com/q3HuG.png . \$\endgroup\$
    – Antonio51
    Feb 18 at 9:55
  • 2
    \$\begingroup\$ @Angel0ne The datasheet you linked has the maximum Vgs listed as +-20V. I think you're looking at the maximum Vgs(th) voltage, which indicates the voltage required to pass 250uA. \$\endgroup\$ Feb 18 at 12:35
  • 1
    \$\begingroup\$ Carrying 10A at 3V is indeed shown in Figure 1, but that's a 'typical' part - we don't know if yours is better or worse than 'typical'. It's very little headroom. You really want to be using a logic-level FET with Vgs (th) <<2V, or putting 5V or 12V on the gate. \$\endgroup\$ Feb 18 at 12:39

1 Answer 1


You should have a flyback diode across the load, otherwise the MOSFET will likely avalanche and die eventually due to pump motor and wiring inductance.

You should be using a logic level MOSFET with guaranteed Rds(on) at 3.3V or less, not 10V as the one you have. Unless you can convince your supplier to only sell you 'typical' units and not ones that merely conform to the datasheet limits. You may have trouble finding one in a TO-220 package, most are SMT. If you find such a MOSFET you can add a large-ish series gate resistor and protect the ESP32 via that, however it will slow the MOSFET switching and that's hard on the MOSFET. Also don't divide it down by having a G-S resistor that reduces the Vgs(on) if you do this.

If you want to use the particular MOSFET you have (with the flyback diode) you can make a simple gate driver with a couple transistors that will shift the 3.3V to 12V.


simulate this circuit – Schematic created using CircuitLab


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.