MOSFET

An enhancement-mode MOSFET, N and P channel, 2N7000 and IRF540N style: a voltage on the gate switches the channel between drain and source.

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 pin order is the schematic's, not any one package's, the same way the transistor's is.

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 30 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). vto, beta and lambda override the model card and are off at zero.

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

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.