MOSFET
Overview​
The lab has an N-channel and a P-channel MOSFET (in the transistor parts, as "N-Channel MOSFET" and "P-Channel MOSFET"). Both are enhancement-mode parts solved with the SPICE Level 1 (square-law) equations, in the offline engine and in NGSpice alike. The pins sit in a row, G, D, S from left to right; Swap D/S shows them as G, S, D.
The small (i) on a placed MOSFET, and on its tile in the parts list, opens a short panel: what the part does, how to drive a motor with it, the most common mistake, and a link to a PWM motor example circuit.
Presets​
The MOSFET's settings start with a Preset. Picking one fills the part's strength (KP, the lab's beta in mA/V²) and its threshold voltage; the threshold stays editable afterwards.
- Small signal (2N7000-like): the default, and what every MOSFET placed before presets existed keeps. KP 0.1 A/V², threshold 2.1 V, about 1.3 Ω between drain and source when fully on. For LEDs, buzzers and logic.
- Power (IRF540N-like), N-channel: KP 3.25 A/V², threshold 3 V, 44 mΩ with 10 V on the gate.
- Logic level (IRLZ44N-like), N-channel: KP 11.4 A/V², threshold 1.5 V, 25 mΩ with only 5 V on the gate (35 mΩ at 4 V), for a microcontroller pin.
- Power (IRF9540N-like), P-channel: KP 1.22 A/V², threshold 3 V (the gate 3 V below the source), 117 mΩ at -10 V.
The power presets take their on-resistance and threshold from the Infineon datasheets of those parts (KP = 1 / (RDS(on) × (Vgs − Vth))). They are not the parts themselves: Level 1 has no gate charge, no capacitances and no heating.
How to use​
A MOSFET as a switch​
- N-channel, on the low side: the load between the supply and the drain, the source to ground. It turns on when the gate is more than the threshold above the source.
- P-channel, on the high side: the source to the supply, the load between the drain and ground. It turns on when the gate is pulled more than the threshold below the source, and off when the gate is taken back up to the source voltage.
Driving a DC motor​
- Pick Power (or Logic level when the gate is driven from 5 V or 3.3 V). A Small signal MOSFET carries milliamps: in series with a motor of under 1 Ω it takes most of the voltage and the motor does not turn.
- Put a flyback diode across the motor, cathode to the + side, so the motor's current has a path when the MOSFET turns off.
- Drive the gate through 100 to 220 Ω, and put 10 kΩ from gate to source (a pull-down; a pull-up to the source on a P-channel part) so the MOSFET stays off while nothing drives the gate.
- For speed control, drive the gate with a square wave (a few hundred Hz, the 490 Hz of an Arduino's PWM pins for example): the motor sees the battery for the duty cycle's share of each period.
The PWM motor example linked from the MOSFET's (i) panel and from the MOSFET page is this circuit: a 12 V battery, the default 12 V motor, a flyback diode, a Power N-channel MOSFET and a 490 Hz square wave at 50 % duty.
Troubleshooting​
- The motor does not turn. Check the MOSFET's Preset first: Small signal cannot drive a motor. Then check the motor's ratings: under load a DC motor starts only with about 27 % of its rated voltage across it (the lab's motor at its default 25 % load). A 48 V motor on a 12 V battery gets 25 % and will not start, even wired straight to the battery; set its Load to 0 % or pick a 12 V motor.
- Three MOSFETs in series (an H-bridge plus a PWM switch). Each one adds its own on-resistance, so a bridge of Small signal parts leaves the motor well under a volt. On the Power preset the same bridge turns the motor.
- With NGSpice on, a PWM motor turns slowly. For a circuit with a square-wave source the lab runs NGSpice for ten periods of the wave from rest (about 20 ms at 490 Hz), so the motor only starts to turn there; the offline engine keeps running and reaches the motor's full PWM speed.
- The P-channel part stays on. Its gate has to come back up to the source voltage to turn it off; a gate at 0 V leaves a P-channel high-side switch fully on.