DESIGNMISSION 004 · MOSFETs · Inductive loadsBeginner-friendly

Your GPIO Can't Drive This

A controller must switch a 12 V relay coil from a 3.3 V MCU. Build a safe interface that works during normal operation and stays off while the GPIO is high-impedance at reset.

Interface requirements

The relay wiring is fixed: one coil lead remains connected to +12 V.

120 mA coil current≤ 8 mA initial GPIO gate-charging current≤ 0.15 V switch dropDefault OFF during reset2× voltage/current marginClamp inductive turn-off
  1. 01Build design
  2. 02Verify design
Circuit overview
LIVE SCHEMATICCURRENT DRAFT
Selected relay driver circuitThe selected topology shows every load-current connection. Gate and drain-source paths remain separate. The diode cathode faces the positive coil terminal in the valid clamp network.MCU GPIOVOH ≥ 2.7 VPIN ≤ 8 mACoil requirement: 12 V / 100 Ω = 120 mAK1 · 100 ΩNO CLAMPGPIO supplies the coil
Required coil current120 mA
Current task
Current task
Technical references

Engineering notes

GPIO role: the pin commands the switch. It should not be the load's power source.

Gate drive: VGS(th) only describes the start of conduction. Qualify the switch using guaranteed RDS(on) at an available gate voltage.

The 470 Ω gate resistor limits initial ideal charging current to about 7 mA at 3.3 V. Gate current is transient and capacitive; after settling, the 100 kΩ pull-down draws about 0.033 mA. The evaluator also accounts for the small gate-voltage reduction from this resistor divider. This slow relay exercise does not calculate gate-charge timing or qualify real GPIO pulse behavior.

Reset behavior: a pull-down keeps the MOSFET off before firmware configures the pin.

Turn-off: coil current cannot stop instantly. The flyback diode provides a controlled path and limits drain stress.

Compare the candidate datasheets at the available gate voltage.

Exercise boundary. The relay is modeled as a 12 V / 100 Ω load for this mission. Candidate drain-current ratings are only a coarse screening requirement, not a thermal sign-off. A real release would also check coil-resistance tolerance and temperature, MOSFET derating/SOA, PCB thermal resistance, diode current and recovery behavior, switching transients, and supply variation.