MOSFET switch: the standard way to switch a large load from an MCU
A voltage on the gate opens the channel. The threshold-voltage trap, Rds(on), and choosing a logic-level MOSFET.
When the gate-source voltage Vgs of an N-channel MOSFET is large enough, drain to source behaves like a small resistance (Rds(on)). Almost no current flows into the gate, so an MCU pin can drive it directly.
The threshold-voltage trap
A datasheet Vgs(th) = 2 V is the voltage at which it "barely starts to turn on" (usually defined at 250 µA). The Rds(on) for a properly turned-on device is given at Vgs = 10 V or 4.5 V. To drive from a 3.3 V MCU, you have to choose a logic-level MOSFET whose Rds(on) is specified at Vgs = 2.5 V or 3.3 V.
Loss calculation
10 A, Rds(on) = 10 mΩ → P = 10² × 0.01 = 1 W. Multiply by the package's thermal resistance to check the temperature rise.
Parts around the gate
- Gate resistor (10 to 100 Ω): sets the switching speed and reduces ringing.
- Gate pull-down (10 to 100 kΩ): keeps the MOSFET from turning half on while the pin is floating.
Gate charge
Fast PWM means charging and discharging the gate capacitance every cycle. Driving a MOSFET with a large gate charge Qg at tens of kHz from an MCU pin slows the switching and increases heating. That is when you need a gate driver.
Low-side switch circuit
Placing an N-channel MOSFET between the load and ground is the simplest arrangement. The MCU pin goes to the gate and the load sits between the supply and the drain.
Supply (+12V) ── load ── drain
│
MCU pin ─ 100Ω ─ gate source ── GND
│
100kΩ ── GND (pull-down)
- Gate series resistor (tens to hundreds of Ω): the gate looks like a capacitor, so a large current flows from the MCU pin at turn-on. The resistor limits it and reduces ringing.
- Pull-down resistor (10 k to 100 kΩ): keeps the MOSFET from turning on by itself while the MCU is in reset and the pin floats.
Three things to look for in the datasheet
| Item | Meaning | What to check |
|---|---|---|
Vgs(th) |
Voltage where it starts to turn on | Not the voltage where it is fully on |
Rds(on) @ Vgs |
On-resistance | Is a value given at your drive voltage? |
Qg |
Charge needed to fill the gate | Sets switching speed and drive current |
Drive a MOSFET with Vgs(th) = 2 V from 3.3 V and it has only just started to turn on, so the resistance is high and it heats up. Choose a logic-level MOSFET whose datasheet states a value at a low voltage, such as Rds(on) @ Vgs = 2.5 V.
Loss calculation
conduction loss P = I² × Rds(on) 5 A, 20 mΩ → 0.5 W
switching loss ≈ ½ × V × I × (t_on + t_off) × f
Raising the PWM frequency increases switching loss in proportion to the frequency. That is why a circuit that was fine at 20 kHz runs hot at 100 kHz. Driven directly from an MCU pin, the gate takes a long time to charge and this loss grows, so large MOSFETs and high frequencies use a gate driver.
Inductive loads always need a diode
Relays, solenoids and motors are coils. Cut the current suddenly and the coil raises the voltage to tens or hundreds of volts trying to keep the current flowing. Fit a diode (a flyback diode) across the load, pointing towards the supply, to give that current a path. Leave it out and the MOSFET dies within one or two operations.
Why the high side is harder
To switch the supply side of the load, the source of an N-channel MOSFET rises to the load voltage. Keeping it on requires the gate to go above the supply voltage, so you need a bootstrap circuit or a dedicated driver. In simple cases a P-channel MOSFET is used; when both top and bottom are switched, as in motor drives, a half-bridge driver is used.
Check yourself
- When choosing a MOSFET to drive from a 3.3 V MCU, which value should you look at instead of
Vgs(th)? - What is the conduction loss at 10 A with an Rds(on) of 10 mΩ?