Aziz Bench

IRF540N as a switch with Arduino and ESP32

A 100 V, 33 A standard MOSFET. Like the IRF520 it needs 10 V on the gate: from a microcontroller use a gate driver or a logic-level part.

Transistor
IRF540N
N-channel MOSFET · TO-220 · Infineon (IR)
Max voltage
100 V
Max current
33 A
RDS(on)
44 mΩ at 10 V
TO-220 pinout
1G2D3S

From a 3.3 V or 5 V pin

PinVerdictWhyIn free air
ESP32 · 3.3 VNothreshold up to 4 V—
Arduino Uno · 5 VNot guaranteednothing guaranteed below 10 V—

In free air at 25 °C, with the junction 25 °C below its 175 °C maximum and θJA 62 °C/W, at the guaranteed RDS(on) raised with temperature.

Specifications

TypeN-channel MOSFET
PackageTO-220
Maximum voltage100 V
Maximum current33 A
Threshold VGS(th)2 … 4 V
RDS(on), maximum44 mΩ at 10 V (16 A)
Gate voltage limit±20 V
Gate charge71 nC at 10 V
Thermal resistanceθJA 62 °C/W · θJC 1.2 °C/W
Maximum junction temperature175 °C
Datasheet usedInfineon (IR)

Pinout

PinFunction
1Gate
2Drain
3Source

Printed face toward you, leads down: pin 1 is on the left. The metal tab is connected to pin 2.

Similar parts

PartPackageRDS(on) at 3.3 VRDS(on) at 5 VMax voltageMax current
IRF540NTO-220nono100 V33 A
2N7000TO-92no5.3 Ω60 V200 mA
BS170TO-92nono60 V500 mA
AO3400ASOT-2348 mΩ32 mΩ30 V5.7 A
Si2302SOT-2375 mΩ57 mΩ20 V2.6 A
IRLML6344SOT-2337 mΩ29 mΩ30 V5 A
IRLZ44NTO-220no25 mΩ55 V47 A
IRLB8721TO-220no16 mΩ30 V62 A
IRF520TO-220nono100 V9.2 A

Tips

Keep the 10 kΩ from gate to ground: while the microcontroller boots its pins float and the MOSFET could turn on by itself.

Every coil needs a flyback diode across it, cathode to the positive supply. Without it the voltage spike at turn-off can destroy the transistor at the first switching.

A TO-220 in free air sheds little heat: fit a heatsink, insulated if the tab must not touch it (the tab is the drain or collector).

Open the calculator →Check the IRF540N with your own load, supply, PWM frequency and temperature.

Other transistors

Frequently asked questions

Does the IRF540N work with a 3.3 V ESP32?

No: its threshold can be as high as 4 V, so a 3.3 V pin may not turn the IRF540N on at all. Use a MOSFET guaranteed at 2.5 V such as the AO3400A, or a gate driver.

What is the IRF540N pinout?

TO-220: 1 gate, 2 drain, 3 source. Printed face toward you, leads down: pin 1 is on the left. The metal tab is connected to pin 2.

Source of the figures: Infineon (IR) datasheet (PDF)