How a MOSFET Works as a Switch
- [MOSFET gate] [controls] [Drain-Source channel conductivity]
- [VGS above threshold] [enables] [full conduction with milliohm resistance]
- [Logic-level MOSFET] [switches] [high-current loads from 3.3V/5V MCU pins]
An N-channel MOSFET has three terminals: Gate (G), Drain (D), Source (S). In a switch circuit, the load connects between VCC and Drain; Source connects to GND. When the MCU applies a voltage above VGS(th) to the Gate, the channel opens and current flows through the load. When Gate = 0V, the channel closes.
N-Channel vs P-Channel MOSFET: Which to Use?
⚡ N-Channel (Low-Side Switch)
Turns ON when Gate is HIGH. Source connects to GND — load is between VCC and Drain. Easiest to use with MCU pins directly. Lower RDS(on), higher electron mobility. Examples: IRLZ44N, 2N7000, AO3400, IRF520N.
⚡ P-Channel (High-Side Switch)
Turns ON when Gate is LOW (below Source voltage). Source connects to VCC — load is between Drain and GND. Needs level shifting for MCU control. Higher RDS, harder to drive. Examples: IRF9540, AO3407, FQP27P06.
Logic-Level MOSFETs: Essential for Arduino & ESP32
The single most important concept for makers: not all MOSFETs are created equal for MCU use. Standard power MOSFETs like the IRF540N need 10V on the Gate to fully conduct. With only 5V from an Arduino, RDS(on) might be 10× higher than datasheet spec — causing heating, voltage drop, and unreliable motor control.
| Part | VGS(th) | RDS at 5V Gate | Max Current | MCU Compatible |
|---|---|---|---|---|
| IRLZ44N | 1–2 V | 22 mΩ | 47 A | ✅ Yes (3.3V & 5V) |
| 2N7000 | 0.8–3 V | 5 Ω | 200 mA | ✅ Yes (signal loads) |
| AO3400 | 0.45–1 V | 40 mΩ | 5.7 A | ✅ Yes (SOT-23) |
| IRF540N | 2–4 V | ~200 mΩ @5V | 33 A | ⚠️ Partial at 5V |
| IRF3205 | 2–4 V | ~400 mΩ @5V | 110 A | ❌ Needs gate driver |
MOSFET PWM Motor Control: Step-by-Step Wiring
Combine a MOSFET with PWM signals to control motor speed without an H-bridge (for single-direction motors). This circuit handles up to 47A with an IRLZ44N.
- Gate Resistor (100Ω): Place between Arduino PWM pin and MOSFET Gate. Limits inrush current into gate capacitance, prevents ringing on high-frequency PWM.
- Gate Pull-Down (10kΩ): From Gate to Source (GND). Keeps MOSFET OFF when Arduino pin is floating (boot, reset). Critical for safety.
- Motor Wiring: Motor positive to VCC (12V battery). Motor negative to MOSFET Drain.
- Source to GND: MOSFET Source to shared GND (both motor power supply and Arduino GND must be common).
- Flyback Diode (1N4007): Across motor terminals, cathode (+) to Drain (motor negative side), anode (-) to VCC side. Absorbs back-EMF spikes.
Common MOSFET Switch Mistakes to Avoid
❌ Using Standard MOSFET with 3.3V/5V
IRF540N, IRF3205 etc. need 10V gate to fully conduct. At 5V, RDS is 5–20x higher — the MOSFET overheats and cannot switch the load properly. Always check the datasheet graph of RDS vs VGS.
❌ No Gate Pull-Down Resistor
Without a 10kΩ pull-down, the gate floats during MCU startup/reset — the MOSFET can randomly turn on and damage your load or motor.
❌ No Flyback Diode on Inductive Loads
DC motors, solenoids, and relay coils generate back-EMF spikes of 50–300V when switched off. These destroy the MOSFET in microseconds without a flyback diode.
❌ Separate Ground References
If motor supply GND and MCU GND are not connected, VGS is measured incorrectly — the MOSFET may not switch at all or switch at wrong voltage levels.
Frequently Asked Questions
How does a MOSFET work as a switch?
An N-channel MOSFET switches by applying voltage to its Gate. When VGS exceeds threshold (typically 2–4V for logic-level parts), the Drain-Source channel conducts with milliohm resistance. Below threshold, the channel is open. Unlike BJTs, no DC gate current flows — only charging/discharging the gate capacitor during transitions.
What is a logic-level MOSFET and why do I need one for Arduino?
Logic-level MOSFETs (IRLZ44N, 2N7000) have VGS(th) of 1–3V and reach spec RDS at 5V gate voltage. Standard MOSFETs need 10V+ gate for full conduction — at 5V their RDS is 5–20x higher, causing heating and unreliable switching. Always choose a logic-level MOSFET for direct Arduino/ESP32 control.
Do I need a gate resistor for a MOSFET?
Yes. Place 100Ω–1kΩ in series between MCU pin and Gate to limit spike current into gate capacitance. Also add 10kΩ pull-down from Gate to Source to keep MOSFET OFF when MCU pin is floating during startup or reset.
Why does my MOSFET get hot when switching a motor?
Heat comes from: (1) high RDS(on) if gate voltage is insufficient, (2) switching losses at high PWM frequency (I²RDS × duty cycle), (3) missing flyback diode causing repeated avalanche events. Fix: use logic-level MOSFET, add heatsink for loads above 3A, add flyback diode.
Can I use a MOSFET to control a motor with PWM?
Yes — connect load between VCC and Drain, Source to GND. Apply Arduino PWM via 100Ω gate resistor. The motor averages the duty cycle as speed. Use IRLZ44N for up to 47A. Add 1N4007 flyback diode across motor and ensure common GND between motor supply and Arduino.
Conclusion
MOSFETs are the preferred switch for modern electronics — zero gate drive power, nanosecond switching, and milliohm on-resistance make them far superior to mechanical relays and BJTs for most high-current applications. The key is selecting a logic-level MOSFET matched to your MCU voltage, adding the gate resistor, pull-down, and flyback diode — then your Arduino or ESP32 can reliably switch motors, solenoids, and LED strips up to 40A+.
Ready to control motors bidirectionally? See our H-Bridge motor driver guide which uses four MOSFETs to reverse motor direction. For speed control fundamentals, read What Is PWM.
