10 Min Read • Updated June 2026

MOSFET as a Switch: N-Channel, Logic-Level & PWM Control Explained

MOSFETs are the go-to switch for Arduino and ESP32 projects needing to control motors, high-power LEDs, solenoids, and heaters. Unlike BJTs, they need zero DC gate current and switch in nanoseconds. This guide covers everything from gate threshold to PWM motor control.

IRLZ44N N-channel MOSFET on PCB with Gate Drain Source terminals labeled and motor switching circuit overlay
Device Type

Voltage-Controlled Switch (FET)

Control Terminal

Gate (no DC gate current)

On-Resistance (RDS)

As low as 1–10 mΩ (power MOSFETs)

Logic-Level VGS(th)

1–3 V (turns on fully at 3.3/5V)

Switching Speed

Nanoseconds (10–100 ns)

Common Logic Parts

IRLZ44N, 2N7000, AO3400, IRF520N

How a MOSFET Works as a Switch

Definition: A MOSFET switch is a voltage-controlled semiconductor device that creates a conductive channel between Drain and Source when gate voltage exceeds the threshold, acting as an electronic relay with nanosecond switching speed.
  • [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.

Rule of Thumb: Use N-channel 95% of the time. Only use P-channel when you need a high-side switch and cannot afford a gate driver IC.

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.

PartVGS(th)RDS at 5V GateMax CurrentMCU Compatible
IRLZ44N1–2 V22 mΩ47 A✅ Yes (3.3V & 5V)
2N70000.8–3 V5 Ω200 mA✅ Yes (signal loads)
AO34000.45–1 V40 mΩ5.7 A✅ Yes (SOT-23)
IRF540N2–4 V~200 mΩ @5V33 A⚠️ Partial at 5V
IRF32052–4 V~400 mΩ @5V110 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.

  1. Gate Resistor (100Ω): Place between Arduino PWM pin and MOSFET Gate. Limits inrush current into gate capacitance, prevents ringing on high-frequency PWM.
  2. Gate Pull-Down (10kΩ): From Gate to Source (GND). Keeps MOSFET OFF when Arduino pin is floating (boot, reset). Critical for safety.
  3. Motor Wiring: Motor positive to VCC (12V battery). Motor negative to MOSFET Drain.
  4. Source to GND: MOSFET Source to shared GND (both motor power supply and Arduino GND must be common).
  5. Flyback Diode (1N4007): Across motor terminals, cathode (+) to Drain (motor negative side), anode (-) to VCC side. Absorbs back-EMF spikes.
⚠️ Critical: Always connect motor power supply GND to Arduino GND. Floating grounds cause erratic MOSFET switching and can destroy both the MOSFET and the MCU.

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.

📚 References & Sources

Was this article helpful?

Tap a star to rate — no account needed

Related Resources