---
title: High-side MOSFET switching
date: 2025-06-22
layout: post
---
Needed low-power switching for the [fingerprint door
lock](../fpm-door-lock-lp/). Servo and FPM draw high quiescent current--had to
cut power electronically during sleep. MOSFETs can do this.
Schematics belong to Simon Fitch.
## Problem with simple low-side switching
Typical approach: GPIO → gate of N-channel MOSFET on low side, pull-down
resistor between gate and drain. Works if MCU and load don't share common
ground. Doesn't work when they do (like controlling a component powered by the
same MCU).
Issue: source potential = gate potential - threshold voltage. Example: 3.3V
gate - 1.5V threshold → 1.8V at load--not nearly enough for a servo. Raising
the gate potential above source is not always practical. Solution: high-side
switch.
## P-channel high-side switch

M1 is P-channel (high-side), M2 is N-channel (level converter). MCU output low
→ M2 off → R1 pulls M1 gate to +6V → servo off. MCU output high → M2 conducts →
M1 gate drops to 0V → servo on.
Note: IRF9540 in the schematic doesn't work. VGS (-10V) for
RDSon too much for 3.3V ATmega328P to drive. NDP6020P is the only
suitable through-hole MOSFET I could find.
## N-channel high-side switch

Less common but works if you have voltage high enough to drive the gate. Both
M1 and M2 are N-channel. MCU low → M2 off → M1 gate rises above threshold →
servo on. MCU high → M2 on → M1 gate drops → servo off. R2 prevents
high-impedance power-up from switching servo on.
M2 needed in both topologies for level conversion (0V ↔ +6V or +9V). Carries
<1mA. Gate-source threshold must be lower than MCU supply. Common choices:
2N7000, 2N7002, BSS138.
Note: D1 flyback diodes protect MOSFETs from voltage spikes caused by inductive
loads (servos, relays).
## A BJT alternative

Simpler, cheaper, more available. Q2 conducts when MCU outputs high. Q2
amplifies Q1's base current. Unlike MOSFETs (voltage-driven), BJTs are
current-driven. R3 and R4 must be calculated for desired base currents. Guide on BJT
switches.
## Which topology?
MOSFETs preferred in professional work—more efficient when on. Harder to drive
at 3.3V due to VGS requirements for full saturation (low
RDS(on)).
N-channel: Lower on-resistance, cheaper, more efficient than P-channel. Harder
to drive high-side (gate must be above source—requires extra circuitry like
MOSFET drivers).
Used P-channel high-side for the door lock redesign. Simpler to drive from 3.3V
MCU, no driver needed.
## Further reading
- Different MOSFET
topologies
- How to read
MOSFET datasheets
- How to use a
transistor as a switch
- Guide to
selecting and controlling a MOSFET for 3.3 VDC logic applications
- Driving a large
relay from a 3.3 VDC microcontroller using an NPN Darlington transistor