A MOSFET is a type of transistor, and the key difference is that it's controlled by voltage, not current. That makes it the first choice for driving large loads: motors, LED strips, heaters, and inside every buck and boost regulator.
The pins
- Gate: the control pin.
- Source: in an N-channel MOSFET it's usually connected to ground.
- Drain: the load connects between it and the supply.
How does it work?
The gate is completely insulated from the rest by a very thin layer. When you apply a voltage to it (relative to the source), a channel forms between source and drain, and current flows.
And because the gate is insulated, no steady current flows into it. That's the opposite of a BJT, which needs base current the whole time it's on.
The key specs
- Vgs(th): the voltage at which the channel starts to open. Careful, this is not the full turn-on voltage. At Vth the MOSFET barely passes a tiny current.
- Rds(on): the channel's resistance when fully on, at a specific gate voltage stated in the datasheet. The lower it is, the less the MOSFET heats up (P = I² × Rds).
- Vds: the maximum voltage between drain and source.
- Id: the maximum current, which depends heavily on cooling.
The most common mistake: a non-logic-level MOSFET
The IRFZ44N, for example, is very popular, but its Rds(on) is specified at Vgs = 10 V. Drive it with 3.3 V from an ESP32 and it won't turn on properly; it'll heat up and may burn out under load.
The fix: choose a logic-level MOSFET, meaning Rds(on) is specified at 4.5 V or less, or at 2.5 V if you're working at 3.3 V. Examples: the IRLZ44N and the AO3400 (SMD). Or use a driver circuit.
Wiring tips
- A small gate resistor (about 100 Ω) protects the microcontroller pin from the gate's momentary charging current.
- A 10 kΩ resistor from gate to source keeps the MOSFET off while the microcontroller is still starting up.
- A protection diode across any load with a coil (motor or relay), exactly as with an ordinary transistor.
- Cooling: calculate P = I² × Rds(on). If it's more than about 1 W, consider a heatsink or a copper area.
A worked example: a 12 V 3 A LED strip
With an IRLZ44N on a 5 V Arduino pin:
- Rds(on) at Vgs = 5 V is about 0.025 Ω (from the datasheet).
- Heat = 3² × 0.025 ≈ 0.23 W.
- A TO-220 package without a heatsink rises about 62 °C per watt in free air, so about 14 °C above ambient. Very comfortable without a heatsink.
If you used an IRFZ44N with the same 5 V on the gate, it wouldn't turn fully on, its real resistance could be several times the rated figure, and the heat several times too. With 3.3 V from an ESP32 it's worse. The choice is covered in detail in the logic-level MOSFET article. And to know whether it needs cooling, the heatsink article explains the calculation.
The MOSFET and PWM
The gate is insulated, but it's really a small capacitor (hundreds or thousands of picofarads). Every time the MOSFET switches on or off, the microcontroller pin has to charge or discharge that capacitor:
- With the Arduino's normal PWM (490 or 980 Hz) there's no problem at all.
- At high frequencies (tens of kilohertz and above), the MOSFET spends longer halfway between on and off, and that time produces heat. Here you need a gate driver (a chip that charges the gate with a high current) or a MOSFET with a small gate charge.
The 100 Ω gate resistor slows the charging slightly, which reduces noise and ringing in the wires. PWM basics are in the PWM article.
The diode inside the MOSFET
Every ordinary MOSFET has a diode between source and drain called the body diode, which comes from how it's made. In an N-channel MOSFET this diode conducts from source to drain. So the MOSFET only blocks current in one direction; in the other, current flows through the diode even when it's off.
This matters in two places: in H-bridge circuits that reverse a motor, and in reverse polarity protection with a MOSFET, which relies on exactly this diode.
Testing a MOSFET with a multimeter
For an N-channel part like the IRLZ44N, in diode mode:
- Red on source, black on drain: about 0.4–0.6 V, that's the body diode.
- Reversed: OL (no conduction).
- Charge the gate: touch red to the gate and black to the source for a moment. Now drain to source will show conduction (a very small reading), because the gate is charged and the channel is open.
- Discharge the gate by touching gate and source together, and the conduction disappears.
If in step 1 you find zero in both directions, the MOSFET is shorted. MOSFETs are sensitive to static on the gate, so hold them by the body. See the ESD article.
MOSFET, transistor or relay?
| BJT transistor | MOSFET | Relay | |
|---|---|---|---|
| Control | Base current | Gate voltage | Coil current |
| Large currents | Heats up | Excellent | Excellent |
| Speed and PWM | Good | Excellent | No |
| AC and mains | No | No (directly) | Yes, with isolation |
| Noise and lifetime | Silent, long life | Silent, long life | Clicks, limited cycles |
So for DC, large currents and PWM: a MOSFET. For 220 V or when you need full isolation: a relay. And for small loads, an ordinary transistor is enough.
N-channel and P-channel
- N-channel: the most common and cheapest, with lower Rds(on). It sits between the load and ground.
- P-channel: sits between the supply and the load, useful when you need to switch the + rather than ground, such as for reverse polarity protection.
If you want an introduction to transistors in general, start with the transistor article.
FAQ
Can I put several MOSFETs in parallel for more current? Yes, and MOSFETs share current well among themselves because their resistance rises as they heat up. Give each one its own gate resistor.
The MOSFET gets very hot even when it's not switched on? Most likely the gate is floating with no 10 kΩ resistor to ground, so the MOSFET is half on. Or the resistor is wired wrongly.