You bought an IRF540N to drive an LED strip or a motor from the Arduino. You wired it up, the load ran but weakly, and the MOSFET got very hot. The MOSFET isn't faulty; the problem is that it's not fully on.
The trap: Vgs(th) doesn't mean "on"
In the datasheet you'll find Vgs(th) (the threshold voltage), for example 2 to 4 V. Many people think that since 5 V is greater, the MOSFET will turn on. But:
- Vgs(th) is the voltage at which the MOSFET starts to conduct, at a very small current (usually 250 µA).
- What matters to you is RDS(on): the MOSFET's resistance when on, and at which Vgs it was measured.
| MOSFET | RDS(on) measured at |
|---|---|
| IRF540N (standard) | Vgs = 10 V |
| IRLZ44N (logic level) | Vgs = 10, 5 and 4 V |
The rule: if the datasheet gives RDS(on) at 4.5 or 5 V, it works with the Arduino. If only at 10 V, it doesn't. The letter L in the name (IRLZ44N) usually means logic level, but the datasheet is the judge. See reading a datasheet.
There's also a graph in the datasheet called typical output characteristics: current curves at each Vgs. Look at the 5 V (or 4.5 V) curve: if it reaches the current you need with a small voltage across the MOSFET, you're fine.
Why does it get hot?
Heat = I² × RDS(on):
- A MOSFET fully on (0.03 Ω) at 5 A → 25 × 0.03 = 0.75 W. Acceptable.
- The same MOSFET half on (1 Ω, say) → 25 W. It'll burn out.
Work it out with the Ohm's law calculator, and see the heatsink.
The correct circuit (low side)
- The source to ground.
- The drain to the load's negative, and the load's positive to the supply.
- The gate from the Arduino pin through a 100–220 Ω resistor (protecting the pin from the momentary charging current).
- A 10k resistor from gate to ground so the MOSFET doesn't turn on by itself while the Arduino restarts.
- A diode across the load if it's a motor, relay or coil.
- A common ground between the Arduino and the load's supply.
The basics are in what is a MOSFET.
With PWM: gate charge
The gate acts like a capacitor that must be charged and discharged each time. In the moment between on and off, the MOSFET is half on and heats up. The faster the PWM, the more often those moments occur.
- With the Arduino's normal PWM (490 or 980 Hz), the Arduino pin and a 220 Ω resistor are perfectly adequate.
- With high frequencies (20 kHz so the motor's whine disappears) and a large MOSFET, the microcontroller pin is slow to charge it. Then use a gate driver (a chip such as the TC4420) that charges the gate with a high current.
- In the datasheet this figure is called Qg (total gate charge), in nanocoulombs. Smaller = easier to switch fast.
Popular MOSFETs
| MOSFET | Package | Voltage | RDS(on) guaranteed at |
|---|---|---|---|
| IRLZ44N | TO-220 | 55 V | 4 and 5 V |
| IRLB8721 | TO-220 | 30 V | 4.5 V |
| FQP30N06L | TO-220 | 60 V | 5 V |
| AO3400 | SOT-23 | 30 V | 2.5 V |
| IRLML2502 | SOT-23 | 20 V | 2.5 V |
The current on the first page (such as 47 A) is measured with the package ideally cooled. In practice, a TO-220 without a heatsink handles only a few amps before getting very hot. Calculate with RDS(on) as above, not with the big number.
With an ESP32 (3.3 V)
Even the IRLZ44N isn't guaranteed at 3.3 V (the datasheet specifies it down to 4 V). You have options:
- A MOSFET specified at 2.5 V, such as the AO3400 (SMD), for moderate currents.
- A small transistor or a gate driver chip to raise the gate to 10 or 12 V.
- A ready-made MOSFET module stated to work at 3.3 V.
Must the load stay connected to ground? (High side)
The circuit above switches the load's negative. If the load's ground must stay fixed (such as another device sharing the same ground), you need to switch the positive: a P-channel MOSFET on the positive, with a small N transistor controlling its gate. You can't put an N-channel on the positive and drive it directly from the Arduino, because the gate needs to be above the supply voltage.
Testing it with a multimeter
- Diode mode: red on the source and black on the drain → about 0.5 V (the internal diode). The other way → OL.
- Turn it on: touch the gate with red and the source with black for a moment (this charges the gate).
- Measure drain to source again: if it's now close to zero, the MOSFET turned on and stayed on, which means it's healthy.
- Turn it off: connect the gate to the source with your finger or a wire, and the reading returns.
If you find zero between drain and source in both directions from the start, the MOSFET is burnt out (shorted).
Common faults
| Fault | Usual cause |
|---|---|
| The load is weak and the MOSFET hot | Not logic level, or too little gate voltage |
| The load is always on | The MOSFET is burnt out, or the gate floats without the 10k |
| The Arduino resets when the motor starts | No diode, or a shared, weak supply |
| The MOSFET doesn't turn on at all | No common ground, or the pins are swapped |
| A whine from the motor | The PWM frequency is in the audible range |
The bottom line
Before buying a MOSFET for a microcontroller project, look for RDS(on) at 4.5 V (or 2.5 V for 3.3 V). And if the MOSFET is getting hot and the load is weak, the first thing to suspect is that the gate isn't getting enough voltage.
FAQ
MOSFET or relay? A MOSFET is for DC, can handle PWM and has no moving parts. A relay can handle 220 V AC and isolates the circuit. See the relay module.
Can I connect two MOSFETs in parallel? Yes, for high currents, each with its own gate resistor, and mount them on the same heatsink.