The difference from the bipolar transistor is the one that matters on a breadboard. A transistor's base is a diode, so it draws current and needs a base resistor in front of it. A MOSFET's gate is a plate of metal behind an insulator: it draws nothing at all, so a board pin drives it directly and the whole drive circuit is a wire.
Pins
| Pin | What it does |
|---|---|
D |
Drain. The load hangs off here. |
G |
Gate. A voltage here (no current) opens the channel. |
S |
Source. Usually ground on an N-channel low-side switch. |
The legs are drawn where the real part has them, the same way the transistor's are.
A 2N7000 held flat face toward you, legs down, reads S G D from the left. The
TO-220 parts (IRLZ44N, IRF540N, IRF9540N), printing toward you, read G D S, with
the tab joined to the drain. The BS250 is drawn as Diodes Inc.'s BS250P, the one
still made, which reads D G S; older BS250s from other makers were S G D, so for
one of those, or anything else, the datasheet's pin diagram is the one to follow.
The other TO-220 parts (IRF520, IRFZ44N, IRF3205, IRLB8721, FQP30N06L, IRF4905,
IRF9Z34N) read G D S as well. The SOT-23 parts (AO3400A, AO3401A, BSS138) are far
too small for a breadboard and are drawn on the little breakout they are sold on, its
header pins numbered as the chip's: G S D.
Changing the model moves the legs to match, as on the transistor.
Properties
model: 2N7000 (N-channel, TO-92, a 200 mA logic-level switch), IRLZ44N
(N-channel, TO-220, a 47 A logic-level power part), IRF540N (N-channel, TO-220,
a 33 A power part whose numbers are quoted at a 10 V gate), BS250 (P-channel,
TO-92, for small high-side switching) or IRF9540N (P-channel, TO-220, a 23 A
high-side switch). Then the later ones: IRF520 (N, TO-220, the 9 A part on the
purple driver module and in the Arduino Projects Book, specified at a 10 V gate),
IRFZ44N (N, TO-220, 49 A, specified at 10 V; not the logic-level IRLZ44N), IRF3205
(N, TO-220, 110 A, at 10 V), IRLB8721 (N, TO-220, 62 A, logic level), FQP30N06L (N,
TO-220, 32 A, logic level), AO3400A (N, SOT-23, 5.7 A, logic level), BSS138 (N,
SOT-23, the 200 mA part in every level shifter), AO3401A (P, SOT-23, 4 A, logic
level), IRF4905 (P, TO-220, 74 A) and IRF9Z34N (P, TO-220, 19 A). vto, beta and
lambda override the model card and are off at zero.
legs is package (the model's real order, above, which every new part gets) or
schematic, which draws D G S from the left whatever the model. Older projects
open with schematic, so their breadboards keep every leg in the hole it was in.
What the model gets right
Level 1, Shichman-Hodges: the square law, solved by Newton-Raphson along with everything the part is wired to.
Vgst = Vgs - Vto
Vgst <= 0 Id = 0 cut off
Vds < Vgst Id = beta (Vgst Vds - Vds^2 / 2)(1 + L Vds) triode
Vds >= Vgst Id = beta Vgst^2 (1 + L Vds) / 2 saturation
| model | channel | Vto |
beta |
Rds(on) at 10 V |
at 5 V |
|---|---|---|---|---|---|
| 2N7000 | N | 1.82 V | 0.157 A/V² | 0.78 ohm | 2.0 ohm |
| IRLZ44N | N | 1.5 V | 12.99 A/V² | 0.0091 ohm | 0.022 ohm |
| IRF540N | N | 3.0 V | 3.25 A/V² | 0.044 ohm | 0.15 ohm |
| BS250 | P | -2.4 V | 0.0094 A/V² | 14 ohm | 41 ohm |
| IRF9540N | P | -3.0 V | 1.221 A/V² | 0.117 ohm | 0.41 ohm |
| IRF520 | N | 3.0 V | 0.529 A/V² | 0.27 ohm | 0.95 ohm |
| IRFZ44N | N | 3.0 V | 8.16 A/V² | 0.0175 ohm | 0.061 ohm |
| IRF3205 | N | 3.0 V | 17.86 A/V² | 0.0080 ohm | 0.028 ohm |
| IRLB8721 | N | 1.85 V | 23.58 A/V² | 0.0052 ohm | 0.013 ohm |
| FQP30N06L | N | 1.75 V | 6.84 A/V² | 0.018 ohm | 0.045 ohm |
| AO3400A | N | 1.05 V | 9.06 A/V² | 0.012 ohm | 0.028 ohm |
| BSS138 | N | 1.15 V | 0.0498 A/V² | 2.3 ohm | 5.2 ohm |
| AO3401A | P | -0.9 V | 4.63 A/V² | 0.024 ohm | 0.053 ohm |
| IRF4905 | P | -3.0 V | 7.14 A/V² | 0.020 ohm | 0.070 ohm |
| IRF9Z34N | P | -3.0 V | 1.43 A/V² | 0.10 ohm | 0.35 ohm |
The later ten follow one rule, so any of them can be checked against its datasheet:
Vto is the middle of the datasheet's VGS(th) band and beta puts the channel at
the datasheet's maximum RDS(on) at the gate voltage it is quoted at, 10 V for a
standard part and the 4.5 V or 5 V figure for a logic-level one, because that is the
gate a board pin gives it. Level 1 has one beta, so a logic-level part comes out
better than its datasheet at 10 V (the IRLB8721 is 0.0052 ohm here against 0.0087
maximum): the square law falls faster with gate voltage than a real part does.
Deep in triode (a switch that is on), the channel is a resistor of
1 / (beta (Vgs - Vto)), which is where Rds(on) comes from and why it falls
as the gate goes higher. That is the number to watch: a 2N7000 driven from a
5 V pin has four times the channel resistance it has at 10 V, and from a 3.3 V
pin it is worse again. The operating point agrees with ngspice 42 on the same
model card to better than a tenth of a percent.
The logic-level part is the one worth pointing at. An IRLZ44N from a 5 V gate is 0.022 ohm, which is the number on its own datasheet at five volts and the whole reason it exists. An IRF540N on the same gate is seven times worse, because its number is quoted at ten volts and its threshold is 3 V. That is what "logic-level" means, and it is the difference between a board pin driving a motor and a board pin warming one up.
The part is symmetric between drain and source, the way the real device is, so wiring one in backwards passes current backwards rather than doing nothing.
The body diode is modeled
The bulk of a discrete MOSFET is bonded to its source, and that bond is a pn junction across the channel: anode on the source for an N-channel part, on the drain for a P-channel one. It conducts the moment the drain goes a diode drop the wrong side of the source, whatever the gate is doing. Every card here carries one, and it is why:
- a half bridge does not destroy itself when the load's inductance pushes the output past a rail,
- a single MOSFET is not a bidirectional switch: off, it still conducts one way, which is what two of them back to back are for,
- and a battery put in backwards finds a path through the part.
Its curve is fitted to the datasheet's VSD at the rated source current plus one
assumption (0.75 V at a hundredth of that current), because a datasheet gives one
point and a curve needs two. The assumption is named in how faithfully a part
behaves.
What it does not model
No reverse recovery in the body diode, so it turns off in nothing flat, which is
the one number a bridge designer actually wants from it. No gate charge, so it switches in nothing flat and there is no gate drive
current to work out. No sub-threshold conduction: below Vto the channel is
exactly off, where a real one is exponentially nearly off. No temperature and no
thermal limit at all. And level 1 has no short-channel behavior, so it is
honest for a switch and optimistic for an amplifier.
Common mistakes
Leaving the gate floating. A gate with nothing on it holds whatever charge it last had, for as long as it likes, and a real one picks up hum from across the room. Wire the gate to something in both states: a switch across both rails, a pin that is always driven, or a pull-down resistor beside the pin.
Driving an IRF540N from a 5 V pin and expecting its datasheet Rds(on). Its
threshold is 3 V, so a 5 V gate leaves it barely on; that is what a
"logic-level" part means and why the 2N7000 is the one for a board pin.
See it in action
MOSFET switch is built around this one part doing its one job, with the gate on a slide switch and no gate resistor anywhere. Open it at /templates.
MOSFET vs BJT switches the same load with an IRLZ44N and a 2N2222 and compares the heat, and reverse polarity protection uses an IRF9540N's body diode and channel as an almost lossless guard against a battery put in backwards.