To switch (activate/deactivate) higher-voltage circuits from a microcontroller, you’re really choosing an isolation + switching method that matches:
- Voltage & current of the load
- AC vs DC
- Switching speed (slow on/off vs PWM)
- Isolation requirement (safety/EMC)
- Failure mode you can tolerate (stuck ON is dangerous)
Below is a practical decision guide, then concrete wiring patterns and real part examples.
1) Decision logic: pick your switching “class”
A) DC load, low/medium current, want efficiency → MOSFET switch
- Best for: 12V/24V solenoids, LED strips, DC motors (on/off), heaters
- Pros: efficient, cheap, fast (PWM capable)
- Cons: needs correct MOSFET + gate drive + protection
Choose low-side vs high-side
- Low-side (N-MOSFET): easiest, cheapest
- High-side (P-MOSFET or high-side driver): needed when load must stay referenced to ground or for automotive conventions
B) AC mains load (110/230VAC) → Relay or Triac SSR
- Best for: lamps, heaters, mains pumps
- Pros: simple, isolation is common, safe when done right
- Cons: mechanical relays wear; triac SSRs leak current and aren’t for DC
C) Need galvanic isolation or noisy environment → Optocoupler + switch
- Best for: industrial systems, long cables, high EMI, safety isolation
- Pros: strong noise immunity, safety barrier
- Cons: slower, extra BOM, layout/creepage rules
D) Need to switch “anything” including unknown loads → Relay
- Best for: prototypes, universal switching, low frequency
- Pros: load-agnostic, real isolation
- Cons: size, coil power, lifetime, contact arcing
2) The most common (and safest) patterns
Pattern 1 — DC load with low-side N-MOSFET (most common)
Use when: DC loads where switching the return (ground) is acceptable.
Wiring
- Load + → +V (e.g., 12V)
- Load − → MOSFET Drain
- MOSFET Source → GND
- MCU GPIO → gate resistor → MOSFET Gate
- Gate pulldown to GND
- Flyback diode across load if inductive (relay/solenoid/motor)
Typical values
- Gate resistor: 33–220 Ω
- Gate pulldown: 100 kΩ
- Flyback diode: Schottky/fast diode sized for current
Part selection
- MOSFET: logic-level N-MOSFET (low Rds(on) at 3.3V/5V gate)
- If PWM or large MOSFET: consider a gate driver
Example parts (no vendor preference, just common families)
- N-MOSFETs: IRLZ44N (older but common), AO3400A (small loads), AOD4184A (mid power)
- Flyback diode: SS34, 1N5819 (small), UF4007 (faster than 1N4007)
Procurement impact: MOSFET selection changes thermal design and heatsink needs; diode selection changes EMI and reliability.
Pattern 2 — DC load with high-side switch (safer ground, common in automotive)
Use when: you can’t “lift” the load ground, or you need the load referenced to chassis ground.
Options:
- P-MOSFET high-side (simple for low current)
- Dedicated high-side switch IC (best for robustness)
- N-MOSFET + driver/charge pump (for high current, low losses)
Recommended for products: High-side switch IC
- Built-in current limit, thermal shutdown, diagnostics (depends on part)
- Much more tolerant of shorts and hot-plug
Example part families
High-side switch ICs: BTS/PROFET-style, TPS1H/TPS2H-style, VNQ/VND-style
(choose by voltage/current/channel count)
Procurement impact: IC high-side switches reduce field failures and simplify safety compliance, but cost more than a discrete MOSFET.
Pattern 3 — Relay module (universal on/off, slow switching)
Use when: AC mains, unknown load type, or you need real isolation.
MCU cannot drive relay coil directly (usually).
Use:
- NPN transistor or N-MOSFET coil driver
- Flyback diode across coil
- Separate supply for the coil (often 5V or 12V)
Example driver parts
- NPN: 2N2222, S8050
- Coil diode: 1N4148 (small relays) or 1N4007
- Relay: SRD-05VDC-SL-C class modules (for learning), or industrial relays for products
Procurement impact: Relays have lifecycle (mechanical), contact ratings, and sourcing variability; specify contact type and derate.
Pattern 4 — Solid-state relay (SSR)
For AC loads: Triac SSR
- Pros: silent, long life, easy isolation
- Cons: leakage current, heat at high current, not for DC
Examples
- SSR modules: SSR-xxDA style (AC output, DC input control)
- Prefer “zero-cross” for heaters/lamps, “random turn-on” for phase control
For DC loads: MOSFET SSR
- Pros: isolation + DC switching
- Cons: higher cost, on-resistance causes heat
3) Protection you should almost always add (affects success rate)
Inductive loads (relays, solenoids, motors)
- Flyback diode (DC) or RC snubber / MOV (AC)
- Optional: TVS diode on the supply rail to clamp spikes
MCU pin protection
If the switch driver is off-board / long cable:
- series resistor (100–1k)
- ESD diode/TVS near connector
Procurement impact: Adding protection parts is cheap insurance—dramatically reduces returns and “random reset” complaints.
4) Quick “choose this” table
| Your load | Best default | Notes |
|---|---|---|
| 12V LED strip (on/off or PWM) | Low-side N-MOSFET | Add fuse if long strip |
| 24V solenoid | Low-side N-MOSFET + flyback | Diode must handle current |
| DC motor (on/off) | N-MOSFET + flyback/TVS | For direction control use H-bridge |
| AC heater/lamp | Relay or AC SSR | SSR leaks; relay clicks |
| Automotive load | High-side switch IC | Handles faults better |
| High noise/industrial | Optocoupler + MOSFET/relay | Layout & creepage matter |
5) Two common failure modes (and fixes)
1. MCU resets when load switches
Cause: supply dip / ground bounce / EMI
Fix: separate power rails, star ground, bulk cap (≥470 µF) near load, diode/TVS, shorten high-current loop.
2. MOSFET runs hot
Cause: wrong MOSFET (not logic-level), high Rds(on), inadequate gate drive
Fix: choose MOSFET specified at your gate voltage, reduce switching losses, add driver or heatsinking.

Top comments (0)