Loading header...

MOSFET as Switch for Embedded Systems

Microcontrollers can make logic signals; MOSFETs let those signals control real power. A GPIO pin that can source a few milliamps can command LEDs, pumps, relays, heaters, and motors when the MOSFET, load, supply, and protection parts are chosen correctly.

Learning Objectives

By the end of this lesson, you should be able to:

  • wire a basic N-channel low-side switch;
  • choose a logic-level MOSFET from VDS, ID, RDS(on), and gate-drive requirements;
  • calculate conduction loss and first-pass temperature rise;
  • add gate and inductive-load protection;
  • identify when a high-side driver or protected load switch is required.

Low-Side Switch

The simplest embedded MOSFET switch uses an N-channel MOSFET between the load and ground.

flowchart LR V["+ supply"] --> L["Load"] --> D["MOSFET drain"] D --> S["MOSFET source"] --> GND["0 V"] MCU["MCU GPIO"] --> RG["Gate resistor"] --> GATE["Gate"] PD["Gate pulldown"] --> GND

When the gate is driven high enough above the source, the MOSFET turns on and current flows through the load. When the gate is low, current stops. The controller and the load supply must share a reference ground unless isolation is intentionally designed.

Choosing the MOSFET

For a 12 V, 2 A load controlled from a 3.3 V GPIO, check these values:

Check Rule of thumb Reason
VDS(max) at least 2x supply for simple low-voltage loads allows spikes and tolerance
ID above load current at board temperature package ratings are often optimistic
RDS(on) specified at VGS = 2.5 V or 3.0 V proves logic-level turn-on
VGS(max) not exceeded by driver or transients gate oxide is fragile
Qg small enough for GPIO or driver limits switching speed and heat

Do not use VGS(th) as the turn-on voltage. It is a near-off measurement.

Loss Calculation

Conduction loss is:

$$
P_\text{cond}=I_D^2R_{DS(on)}
$$

For 2 A and 50 mohm:

$$
P = 2^2 \times 0.050 = 0.20\ W
$$

Switching loss matters when PWM frequency is high or transitions are slow:

$$
P_\text{sw}\approx \frac{1}{2}V_{DS}I_D(t_r+t_f)f_s
$$

For slow loads at low PWM frequencies, conduction loss often dominates. For power converters and fast PWM, gate drive and switching loss become critical.

Inductive Loads

Motors, relays, and solenoids store magnetic energy. When current is interrupted, voltage rises according to:

$$
v=L\frac{di}{dt}
$$

Provide a safe current path: flyback diode for DC coils where slow release is acceptable, TVS or Zener clamp for faster release, snubber for noisy contacts or long wiring, and a motor driver IC for bidirectional motors.

Gate Network

A practical embedded switch normally includes 22 Ohm to 220 Ohm series gate resistance, 10 kOhm to 100 kOhm gate-to-source pulldown, short gate wiring, short source return, and a gate driver when current, frequency, or gate charge is high.

High-Side Switching

High-side switching disconnects the positive supply from the load. It is useful when the load must remain referenced to ground, but it is harder than low-side switching. Use a P-channel MOSFET for simple low-current systems, an N-channel MOSFET with a high-side driver for efficiency, or a protected smart switch IC for automotive or industrial loads.

Common Mistakes

  • Connecting a motor directly to a GPIO pin.
  • Forgetting the common ground in a non-isolated low-side circuit.
  • Omitting the flyback diode or clamp for a coil.
  • Assuming any MOSFET turns fully on from 3.3 V.
  • Using PWM with long wires and no EMI control.

Summary

A MOSFET switch lets firmware control power, but the design must handle gate drive, heat, inductive energy, grounding, and startup states. Begin with an N-channel low-side switch, use a logic-level part, calculate I^2R loss, and add protection before connecting real loads.

Further Reading

  • Texas Instruments, Load Switch and Power Path Basics.
  • Infineon, Driving MOSFETs in Low-Voltage Applications.
  • STMicroelectronics, Protection of MOSFETs in Automotive Loads.

Mind Map

mindmap root((MOSFET Switch)) Core concept GPIO controls gate MOSFET carries load Low side is simplest Formulas Pcond equals I squared RDSon Psw half V I tr plus tf fs Coil spike v equals L di dt Applications LEDs Relays Motors Heaters PWM control Design rules Logic level RDSon Gate pulldown Flyback path Shared ground Practical checks Startup off state MOSFET temperature Supply spikes PWM edges Common mistakes Using threshold voltage No coil clamp GPIO overload Wrong high side drive