Why a Solid-State Circuit Interrupter Over a Mechanical Relay?
When you need to protect a microcontroller-driven load from overcurrent, the instinct is often to slap a mechanical relay and a glass fuse in series. But in embedded systems, a solid-state circuit interrupter built around a logic-level MOSFET and a comparator offers massive advantages. Mechanical relays suffer from contact bounce, coil flyback spikes that can brownout your ESP32, and contact welding if they trip under a heavy short-circuit load. A fuse, meanwhile, is a one-time-use thermal device that requires physical replacement and has a slow, unpredictable melt curve.
By designing an electronic circuit interrupter using an N-channel MOSFET on the low side, we achieve microsecond switching speeds, silent operation, and resettable overcurrent protection. We avoid the complexity of a high-side P-channel topology, which requires a charge pump or an extra NPN transistor to drive the gate above the supply rail. The low-side N-channel approach lets a 3.3V GPIO directly control the gate, provided you select the right logic-level MOSFET.
Topology & Node Map: The Low-Side Electronic Interrupter
This topology uses a shunt resistor to sense current and an LM393 comparator to pull the MOSFET gate low when the threshold is exceeded. Here is the node map for the circuit:
- Node A (12V Source): Main power supply positive rail.
- Node B (Load +): Connected to the positive terminal of your motor, solenoid, or LED array.
- Node C (Load - / Drain): The return path from the load, connected directly to the MOSFET Drain pin.
- Node D (Sense / Source): The MOSFET Source pin, which also connects to the high side of the shunt resistor and the non-inverting input of the LM393.
- Node E (System Ground): The low side of the shunt resistor, the LM393 ground, the ESP32 ground, and the 12V supply return. All grounds must be bonded here to prevent ground loops from falsely tripping the comparator.
Behavior Matrix & Failure Mode Extremes
Understanding what happens when components fail is what separates a hobbyist circuit from a robust design. Here is the behavior matrix detailing how the interrupter reacts to extreme faults.
| Element | Normal Operation | If Element Shorts | If Element Opens |
|---|---|---|---|
| Shunt Resistor | Drops ~0.25V at 5A | Sense voltage drops to 0V; interrupter loses overcurrent protection (load runs unchecked). | Load loses ground path; circuit stops. MOSFET source floats up to 12V, potentially killing the LM393. |
| MOSFET (Drain-Source) | Acts as a closed switch (Rds_on ~ 4.5mΩ) | Load is permanently powered; interrupter cannot turn off the load. Gate control is bypassed. | Load loses power; circuit stops safely. |
| Gate Pull-down (10kΩ) | Keeps gate at 0V when ESP32 GPIO is high-Z | ESP32 GPIO is shorted to ground; microcontroller pin may burn out if driven HIGH. | Gate floats during ESP32 boot; MOSFET may partially turn on, overheating the die. |
| LM393 Comparator | Output goes low when V_sense > V_ref | Output pulls gate low permanently; load cannot be turned on. | Loss of protection; relies entirely on ESP32 software to monitor the shunt via ADC. |
Design Walkthrough: Sizing the Components
Let's size this circuit interrupter for a 12V DC motor that draws 3A nominally but stalls at 5A. We want the hardware to trip at exactly 5A to protect the wiring without nuisance tripping.
1. The Shunt Resistor:
We need a voltage drop that the LM393 can easily read but that won't waste excessive power. Let's target a 0.25V drop at our 5A trip point. Using Ohm's Law (R = V / I), R = 0.25V / 5A = 0.05Ω. Power dissipation is I²R = 25 * 0.05 = 1.25W. We will use a 0.05Ω, 2W metal film resistor to give it thermal headroom.
2. The Reference Voltage Divider:
The LM393 inverting input needs a 0.25V reference. Powering the divider from the ESP32's 3.3V rail, we use a 10kΩ resistor to ground and a 120kΩ resistor to 3.3V. V_ref = 3.3V * (10 / 130) = 0.253V. This is tight enough to trip reliably at 5.06A.
3. The MOSFET Selection:
Because the ESP32 outputs 3.3V, we need a logic-level MOSFET with a low Vgs(th) and a low Rds(on) at Vgs = 3.3V. The Infineon IRLB8721 is a bench favorite. At Vgs = 3.3V, its Rds(on) is roughly 4.5mΩ. At 5A, it will dissipate only 0.11W, meaning it won't even need a heatsink for continuous operation. Avoid the IRF520 or standard IRFZ44N; they require 10V on the gate to fully enhance and will overheat rapidly when driven by a 3.3V GPIO.
4. Flyback Protection:
Since we are driving an inductive motor, we must place a 1N5819 Schottky diode in reverse parallel across the motor terminals (cathode to Node A, anode to Node C). This clamps the inductive kickback when the MOSFET turns off, preventing the drain voltage from spiking above the MOSFET's 30V Vds rating.
Breadboard Testing & Verification Steps
- Verify the Unpowered Gate: With the 12V supply off and the ESP32 unprogrammed (GPIO floating), use your multimeter to check resistance between the MOSFET Drain and Source. It should read open (OL). If it reads near zero, your MOSFET is blown or wired backward.
- Check the Reference Voltage: Power the ESP32 and the LM393 (but keep the 12V load supply off). Measure the voltage at the LM393 inverting input. It must read 0.25V (±10mV). If it reads 0V, check your pull-up and divider solder joints.
- Test Normal Switching: Connect a small 12V LED or a 100Ω dummy load. Drive the ESP32 GPIO HIGH. Measure the voltage at Node D (Source). It should read near 0V, indicating the MOSFET is fully enhanced and pulling the load to ground.
- Force the Trip: Connect your 12V motor. Write a simple ESP32 sketch to turn the GPIO HIGH. While the motor runs, momentarily short the 0.05Ω shunt resistor with a piece of wire (or use a bench power supply with a current limit to simulate a stall). The LM393 should instantly pull the gate low, cutting power to the motor. The ESP32 can then read the fault state via a secondary GPIO connected to the comparator output.
FAQ: Electronic Circuit Interrupter Edge Cases
How does a solid-state circuit interrupter differ from a standard fuse?
A standard fuse relies on the thermal mass of a metal element melting, which takes milliseconds to seconds depending on the fault current. This slow reaction time allows high-current spikes to pass through, which can damage sensitive silicon or cause voltage sags on the microcontroller's power rail. A solid-state circuit interrupter uses a comparator to detect overcurrent and turns off the MOSFET in microseconds. Furthermore, a fuse is a destructive, one-time component, whereas the electronic interrupter is fully resettable via software once the fault condition clears.
Can I use an ESP32 GPIO directly to drive the circuit interrupter MOSFET?
Yes, but only if you use a true logic-level MOSFET like the IRLB8721, AO3400, or CSD17571Q5A. Standard power MOSFETs (like the IRF520 or IRFZ44N) have a gate threshold voltage (Vgs_th) that might barely turn them on at 3.3V, leaving them in the linear (high-resistance) region. In this state, they act like a heater and will destroy themselves in seconds under load. Always check the datasheet's Rds(on) specification specifically at Vgs = 3.3V or 2.5V, not just the 10V column.
Why does my electronic circuit interrupter trip on motor startup?
DC motors draw a massive inrush current—often 5 to 10 times their nominal running current—during the first few hundred milliseconds of startup as the rotor accelerates and back-EMF builds. If your interrupter is sized exactly to the nominal running current, it will view this startup surge as a short circuit. To fix this, you have two options: increase the shunt resistor threshold to accommodate the stall current, or implement a 'soft-start' or 'trip-delay' mechanism in software by ignoring the comparator fault signal for the first 200ms after turning the GPIO HIGH. For hardware-only delay, adding a small capacitor (e.g., 100nF) across the LM393 sense inputs can introduce a microsecond-level RC delay, though software blanking is far more precise.






