I need to switch on/off a cooler system that draws 20A at 12V using an ESP32 GPIO pin.

The ESP32 GPIO pins work at 3.3V logic with maximum 40mA of current.

Do you have a simple and safe solution to solve this problem?

I thought of using a MOSFET (e.g IRL540) with a resistor of 1k between the GPIO pin and the MOSFET gate:


simulate this circuit – Schematic created using CircuitLab

Could it be a good solution?

Editing afters some comments

The cooler system is composed by three Peltier Cells that drains maximum 20A. It is attached to a power supply that transform 220AC to 12V DC - 20A max.

Diode between Drain and 12V to protect the MOSFET
I've updated the schema with the diode between drain and 12V, Can you please confirm is it mounted in the right way? Thanks

  • 1
    \$\begingroup\$ Not very good. The FET you chose is not really ment to switch 20A with 3.3V Vgs. \$\endgroup\$
    – Justme
    Mar 27, 2021 at 22:45
  • 1
    \$\begingroup\$ And there is nothing to pull M1's gate high so it will never turn on. \$\endgroup\$
    – Transistor
    Mar 27, 2021 at 23:05
  • \$\begingroup\$ 20A with 1V drop means you need a small CPU heatsink and fan to cool chip with 20W \$\endgroup\$ Mar 28, 2021 at 0:17
  • \$\begingroup\$ I don't like these low-side switching things when I don't know all the details of what is connected to the "cooler system" and the MCU system. If there is any other common ground connection between MCU and cooler, then high side switching should be used. Like PMOS on the high side, with the gate switched by NMOS or NPN BJT. Otherwise, this basic setup could work, but with a different FET. \$\endgroup\$
    – user57037
    Mar 28, 2021 at 0:45
  • \$\begingroup\$ Yes what kind of cooler system? At 240W, it's either a compressor, a fan or a peltier apparatus, and if it's more than one device, like a Peltier array, parallelism is your friend. Please check out The XY Problem on Stack Exchange or on Wikipedia. \$\endgroup\$
    – K H
    Mar 28, 2021 at 3:37

1 Answer 1


The choice of switch depends on your preference for size of heatsink and far more choices if you choose low Vt (threshold) logic-level SMT. and use twisted pairs for lower RF impedance and lower EMI.

If using a higher Ron , such as your choice of FET you would need a small CPU heatsink and 2W fan to cool 20W of switch losses of 1V on a proposed 12Vx20A =240W load that would only get 11V at this current and less on startup.

Consider the Switch Power loss vs contact resistance

R [mΩ] . . . . Pd [W] @ 20A . . . Type . . . . . Heat
78 . . . . . . . . 31 . . . . . . . . . . . . IRL540 . . . fail
8 . . . . . . . . . . 3.2 . . . . . . . . . . many SMT . . . needs >=5W heatsink 1 THT part $18
400µOhm . . . 160 mW . . . . . . SIR178DP-T1-RE3 $2.46 . . . needs SMT DIY soldering /w Cu area.enter image description here

Last option probably would need heavy traces or wire to large terminal block for welding wire to minimize cable resistance to same as switch on a small copper breadboard.

Be sure to include reverse diode from Drain to 12V because all wire has inductance and if your fridge has a pump, much more energy stored will kick back.

  • \$\begingroup\$ Thanks for the answer. Unfortunately I can't use a SMT but just PTH components. Do you think the IRL40B209 could fit my needs? The Rds is 1.6 mOhm at 4.5 Vgs, this produce just 400 mW as Pd. Regarding the reverse diode between Drain an 12V, Have I to check something to chose the right one? Thanks \$\endgroup\$
    – Angel0ne
    Mar 28, 2021 at 7:40
  • \$\begingroup\$ always using worst case, 1.6 mohm @ Vgs = 4.5V, 1.6m x 200^2= 640 mW Rja = 60'C/W so 38'C jcn. rise is OK without sink, but surge current on pumps is usually 8 to 10x DC rated. That's 64 to 100x rated power and heat rise but not Peltier type.. So be sure you gave me the right specs. A 1A diode like 1N400x can handle 30A non-repetitive surge so OK. If you learn how I compute , it is better. 5.5V is better than 4.5V as Ron reduces slightly. A small heatsink is best but often active voltage with sink live. Learn how to solder SMT on a piece of copper test coupon as SMT FET=better \$\endgroup\$ Mar 28, 2021 at 12:02
  • \$\begingroup\$ Also poor connections and cable can be > 1 mohm, so be sure what you do has enough pressure and/or conductor cross-section area and understand how to estimate it and measure drop. Next time choose proper logic level FETs in SMT \$\endgroup\$ Mar 28, 2021 at 12:04
  • \$\begingroup\$ The cooling system is made by 3 Peltier Cells that drains max 20A. Just to be sure, the diode 1N400x needs to be plugged with the cathode attached to the drain on the anode attached to 12V isn't it? Thanks \$\endgroup\$
    – Angel0ne
    Mar 28, 2021 at 12:29

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.