Learn

The IRF520 MOSFET module: half on from 5 V, off from 3.3 V

Intermediate

Or see every lesson.

  • 465parts on the bench
  • 43boards running now
  • 1.00xreal time, on every board
IRF520 module and D4184 modulelive0.000 s 0.00x
Click the switch to drive both boards
One switch drives both boards’ inputs; each switches a 15 ohm load on 12 V.

The IRF520 MOSFET driver module, the small purple board with SIG, VCC and GND on a header and screw terminals for the load, is in a lot of Arduino kits and one of the most bought boards for switching a pump, a 12 V LED strip or a motor. It is also the subject of a steady stream of forum threads that start with “it works on my Uno but not on my ESP32” or “the MOSFET gets hot”. Both come from one line on the IRF520’s datasheet.

The circuit above puts it side by side with the other common board, the D4184 dual MOSFET module. One slide switch stands in for a board pin on both inputs, and each board switches a 15 ohm load on a 12 V supply, a load that wants 0.8 A. Press Run, click the switch over to HIGH, and read the current on each board.

How the board is wired

There is very little on the board, which is why it is cheap. SIG goes straight to the IRF520’s gate with no series resistor. A 1 k resistor from SIG to ground holds the gate off while the board pin is still an input, and a red LED with its own 1 k resistor also hangs from SIG to ground. VCC on the header is not connected to anything at all: the module needs no logic supply, only a ground shared with the board.

On the screw terminals, VIN and V+ are the same copper, the load supply’s positive side. V- is the MOSFET’s drain, so the load goes between V+ and V-, and the board switches its low side. GND on the screw terminal is the MOSFET’s source and the same net as GND on the header. Between them the two resistors take about 8 mA from a 5 V pin, which every board can give.

From a 5 V pin it is half on

With 5 V on the inputs the D4184 board passes 798 mA and drops 0.02 V. The IRF520 board passes 738 mA and drops 0.90 V, so the MOSFET turns about 0.67 W into heat. The datasheet gives a bare TO-220 62 °C per watt to the air, so with no heatsink that is about 40 °C above the room: hot to the touch, and the reason for the “MOSFET gets hot” threads. (The simulator does not model heat; that is the datasheet’s arithmetic.)

The IRF520’s datasheet quotes its on resistance, 0.27 ohm maximum, only with 10 V on the gate, and its gate threshold is anywhere from 2 to 4 V. The simulator puts the threshold at 3 V, the middle of that band, so from a 5 V pin there are only 2 volts of real drive above it. The channel comes out at about 1 ohm, and the part cannot pass much more than an amp however small the load is: give the board a load that wants 3 A and it passes about 1.1 A and drops most of the supply.

From a 3.3 V pin it is off, and the LED still lights

Change the logic supply, the 5 V symbol at the top left, to 3.3 V, the level of an ESP32 or a Pico, and run it again. The D4184 board still passes 797 mA. The IRF520 board passes 25 mA and leaves 11.6 V across the MOSFET: the load is off.

The board’s red LED is lit all the same. It is wired from SIG through a 1 k resistor to ground, so it shows that the input is high, not that the MOSFET is on. A real IRF520’s threshold varies from part to part, anywhere in that 2 to 4 V band, so one board may pass a few hundred milliamps from 3.3 V and the next nothing at all. None is fully on, and none can be counted on.

What to use instead

A logic-level MOSFET: one whose datasheet quotes its on resistance at 4.5 V or lower. The D4184 module is two AOD4184A in parallel, each 9.5 milliohm at 4.5 V, and it is fully on from 3.3 V. On a breadboard an IRLZ44N, an IRLB8721 or an FQP30N06L does the same job, wired as a low-side switch with a 10 k pull-down on the gate. All of them are in the parts panel under MOSFET.

If you have the IRF520 board already, it is fine for loads of a few hundred milliamps from a 5 V board, or with its gate driven from a 10 V or 12 V source through a small transistor. Neither board has a flyback diode, so a motor, a pump or a solenoid needs a 1N4007 across it on either one.

Questions

Why does my IRF520 module not work with an ESP32?

The IRF520 needs about 10 V on its gate to be fully on, and its threshold is 2 to 4 V. An ESP32 pin gives 3.3 V, which leaves it almost off. Use a logic-level MOSFET board such as the D4184 module.

Why does my IRF520 module get hot?

From a 5 V pin the IRF520 is only half on, about 1 ohm instead of 0.27, so at three quarters of an amp it turns about two thirds of a watt into heat. A logic-level MOSFET stays cold switching the same load.

Is the D4184 module a drop-in replacement?

Almost. Its trigger and ground go where SIG and GND went, the supply goes on VIN+ and VIN-, and the load goes between OUT+ and OUT-. It is fully on from 3.3 V or 5 V and switches far more current. Like the IRF520 board it has no flyback diode, so a motor still needs one.

How do I wire a MOSFET module to an Arduino?

SIG goes to a digital pin and the header’s GND to the Arduino’s GND; VCC on the IRF520 board is not connected to anything. The load supply’s positive goes to VIN or V+, the load goes between V+ and V-, and the supply’s negative goes to the GND screw terminal. The module then switches the load’s low side.

Can I dim a lamp or set a motor’s speed with a MOSFET module?

Yes, with analogWrite() on a PWM pin into SIG. The 12 V lamp dimmer project does exactly that on a D4184 module, with a knob on A0 setting the PWM on pin 9. An IRF520 board takes PWM the same way, but from a 5 V pin it is only half on even at full duty, so its load never gets quite the whole supply.

The LED on the module is on but the load is not. Why?

The LED is wired to the SIG input, not to the load, so it shows that the pin is high. It lights even when the MOSFET is passing almost nothing.

Build this for real

Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.