I've soldered a small PCB around an ESP32 with following components:
- ESP32 Dev v4
- Water pump with 12-24V and 4.5-6W rating
- Power supply with 12V and 1A rating
- Capacitive sensor with analog output IRFZ44N : N-MOSFET
The circuit does the following:
Measure soil moisture and turn on the water pump accordingly. When the soil is too dry, the ESP32 pulls the gate of the MOSFET high, which shorts the drain over source, source is connected to GND. The gate is normally pulled to GND with a 1k pull-down resistor.
The circuit was working fine with 5V power supply over PSU USB or laptop USB.
However, when I plugged in the 12V rated PSU, the ESP32 literally burnt to death.
Please check my hand-drawn schematic here:
Soldering was fine (since it worked for 5V as well):
I've previously powered an ESP32 using a 12V PSU since the on-board AMS1117 linear regulator tolerates this voltage.
I've also checked the polarity of the PSU before plugging it in. The linear regulator still seems to work since it outputs 3.3V, however the ESP32 vaporated.
I can not see any major flaws in my design. I just think it is a bad practice to switch GND instead of 12V with the MOSFET but I just did that out of convenience because I had N-MOSFETs lying around here.