Electronics
MOSFET as a switch, explained
A MOSFET works as a switch because the voltage on its insulated gate opens a channel between its drain and source. Below a set threshold voltage only a tiny leakage flows. Well above it, the channel is fully open and acts like a tiny resistor, so the load gets almost the whole supply. Unlike a bipolar transistor's base, the gate needs no steady current.
Switched by voltage
What matters is VGS, the gate's voltage measured from the source. In an N-channel MOSFET used as a low-side switch, the source goes to ground, the load sits between the supply and the drain, and the gate takes the control signal. Once VGS passes the threshold, Vth, the channel starts to conduct.
The gate is really a small capacitor. It takes a quick gulp of charge to switch, then holds it with almost no current flowing in. That's why a sensor's divider or a microcontroller pin can hold a big MOSFET on. Left unconnected, though, a gate can drift on or off by itself, so real designs add a pull-down resistor from gate to source.
Live experiment
Past the threshold
5 V drives an LED through 150 Ω into a logic-level MOSFET with a 1.6 V threshold. Slide the gate voltage up slowly from 0 V and watch the plot of the LED's current: nothing, a glimmer, then fully on.
“MOSFETs and flyback diodes” is lesson 6 of 6 in Silicon Ridge, Electronics World 5. Free with an account. Lessons unlock in order, so you’ll do the 33 before it first.
Fully on is not the threshold
At Vth a MOSFET only just conducts. More current needs more gate voltage: a fraction of a volt above threshold for tens of milliamps, a few volts for amps. So design for the gate voltage at which the datasheet quotes its on-resistance, RDS(on): 4.5 V for logic-level parts, 10 V for standard ones. Fully on, it wastes:
Example: a 24 V, 48 Ω solenoid draws 0.5 A through a logic-level MOSFET with RDS(on) = 0.15 Ω:
That's 38 mW, cool to the touch. Driven with too little gate voltage, the same part would sit partly on and run hot.
Coils kick back
Relays, solenoids and motors are coils, and a coil's current can't stop at once. When the MOSFET turns off, that current needs somewhere to go, and with nowhere to go it drives the drain voltage up until something gives. A flyback diode across the coil, cathode to +, gives it a loop. While the coil is on, the diode is reverse-biased and does nothing. At switch-off it holds the coil about a volt beyond the supply while the current dies away, with time constant τ = L ÷ R.
Where you'll meet them
LED-strip dimmers, relay boards for microcontrollers, and the motor drivers in drones and e-scooters all switch with MOSFETs, with a flyback path for every coil.
Free lesson
Now build it yourself
Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.
“MOSFETs and flyback diodes” is lesson 6 of 6 in Silicon Ridge, Electronics World 5. Free with an account. Lessons unlock in order, so you’ll do the 33 before it first.
Or start from the very first lesson, no account neededWork it out
Practice questions
Three quick questions from the lessons. Pick an answer to check it.
Show the answer
Answer: voltage. The gate is insulated, so no steady current flows into it. The gate voltage opens the channel between drain and source.
- Why not “current”? The gate is insulated from the channel, so almost no steady current flows into it. Control by current is how a bipolar transistor (BJT) works.
- Why not “resistance”? There's no gate resistance to set. The gate's voltage changes the resistance of the channel between drain and source.
Show the answer
Answer: A big voltage spike. A coil's current can't stop at once. With no path, it forces its way across the opening switch as a huge spike, called kickback.
- Why not “A short circuit”? A short circuit is a path with almost no resistance. Here the switch opens and removes the path, so the coil's voltage shoots up instead.
- Why not “Nothing much”? A coil stores energy in its magnetic field, and that energy has to go somewhere. With no path for the current, it shows up as a sudden spike.
Show the answer
Answer: 0.2 Ω. R = V ÷ I = 0.004 ÷ 0.022 ≈ 0.18 Ω. A silicon diode at the same current looks like 30 Ω.
- Why not “2 Ω”? 2 Ω at 22 mA would drop 44 mV, ten times the 4 mV measured. R = V ÷ I = 0.004 ÷ 0.022 ≈ 0.18 Ω.
- Why not “20 Ω”? 20 Ω at 22 mA would drop 0.44 V, over a hundred times the 4 mV measured. A fully on MOSFET's channel is a fraction of an ohm.
- Why not “200 Ω”? 200 Ω at 22 mA would drop 4.4 V, not 4 mV. Turn 4 mV and 22 mA into volts and amps before dividing: 0.004 ÷ 0.022 ≈ 0.18 Ω.
“MOSFETs and flyback diodes” is lesson 6 of 6 in Silicon Ridge, Electronics World 5. Free with an account. Lessons unlock in order, so you’ll do the 33 before it first.
Questions people ask
What gate voltage turns a MOSFET fully on?
Not the threshold voltage: at V_th it only just starts to conduct. Use the gate voltage the datasheet quotes R_DS(on) at, usually 10 V for standard MOSFETs and 4.5 V for logic-level ones. A 3.3 V board needs a MOSFET whose R_DS(on) is quoted at 2.5 V or so.
Does a MOSFET gate draw current?
Almost none once it's charged. The gate is insulated, like the plate of a small capacitor: it takes a brief gulp of charge to switch, then holds it. That's why a weak microcontroller pin can hold a large MOSFET on.
Why do MOSFET circuits need a pull-down resistor and a flyback diode?
A pull-down from gate to source keeps an unconnected gate from drifting on by itself. A flyback diode across a coil, such as a relay or motor, gives the coil's current a loop when the MOSFET turns off, so it can't kick back a high voltage and damage the MOSFET.
Related topics
- Transistor as a switch, explainedA trickle into the base switches a big current: cutoff, saturation and the base resistor.
- How does an inductor work?A coil that fights changes in its current, the high-voltage spike it makes, and how to tame it.
- How does PWM work?How a pin that's only on or off dims an LED: duty cycle and analogWrite's 0–255.