Many MCU designs are intended to control power to devices such as motors, actuators, or other electronic subsystems. This power switching usually involves using a power device like a bipolar transistor or MOSFET that the MCU controls, through a level shifter if necessary.
This MCU-based power control has a potential weakness. If the device to be controlled is defective or fails in a way that overloads the system power supply, the microcontroller’s own input power may drop, causing the MCU to reboot. When the processor reboots, the default condition is typically one of no power to the controlled device, and so everything seems to work again -- that is, until the device is powered again.
This kind of self-correcting failure mechanism is usually a recipe for difficult troubleshooting. To avoid the situation, it is desirable to maintain power to the processor at all times to help with system troubleshooting, while protecting the power-controlled circuit against excessive currents.
The typical solution to this problem is to use one of those chips designed for hot-plugging (hot swap controller). One of my favorites is the LT1910 fault-protected high-side driver from Linear Technology. I like it because it works over a wide voltage range (not just 3 V or 5 V) and can restart autonomously or be controlled with one pin. However, in my opinion, there are several issues with using such chips: They are single-sourced and not inexpensive, they still require a number of external components, and if you want to monitor the chip (i.e., detect when faults occur) as well as control it, you will need two lines to the MCU (although the LT1910 can be configured to use just one).
Before such chips were available, I designed my own solid state circuit breaker for just such applications, and it still offers many advantages. The design uses two bipolar transistors, a P-channel MOSFET, and a handful of passive components. The LT Spice model schematic below shows values suitable for a 12 V supply voltage, approximately 700 mA maximum load current, and a 5 V logic interface to the MCU (Figure 1). You can adjust R4 and R8 for different supply or logic voltages, and change R1 to alter the load current. (Note that V2, D1, R6, and R7 are parts of the load simulation and not part of the circuit breaker itself.)
|Figure 1.||Solid-state circuit breaker for microcontrollers LT Spice model schematic.|
The main disadvantage of this circuit compared to integrated hot-swap controllers is the relatively large voltage drop through the sense resistor R1, which is sized to drop about 0.7 V at the current value where the circuit is supposed to trip. Another disadvantage is the trip point's variability. Because the trip point depends on the Vbe of Q1 it is temperature sensitive, changing at a rate of about 1.8 mV/K (0.25%/K). If your application can tolerate these modest shortcomings, however, the circuit is inexpensive, uses widely available components, and is quite flexible.
An advantage over most hot-swap controllers is that the circuit provides status and control through a single connection: the Ctrl_Status pin. After turning the circuit breaker ON, the processor changes the Ctrl_Status pin to an input and then needs only to periodically check the pin's status to ensure the breaker has not tripped. Here is how it works:
The Ctrl_Status point ties to an I/O pin of a conventional microcontroller. Unless you want the power-controlled device to come up automatically at power-up, you should use an I/O that can be configured to provide a high logic level at power-up. The high level ensures that Q1 and Q2 will be ON and the gate of the P-channel MOSFET M1 will be near the source potential, keeping the MOSFET in the OFF state at power-up.
To turn the breaker on and apply power to the load, the processor momentarily sets the Ctrl_Status pin to a low state (long enough to discharge C1), then sets the pin as an input (high impedance). The low pulse turns off Q2, which then turns off Q1 and lets M1’s gate go to ground, turning the MOSFET ON. As long as the Ctrl_Status pin remains in high impedance, Q1/Q2 will both remain OFF and the MOSFET will remain ON.
If an overload occurs, Q1 will turn ON, which will turn Q2 ON and both Q1/Q2 will keep each other ON (and the MOSFET OFF) until the Ctrl_Status pin is brought low again.
If the load includes filtering capacitors, the output current may momentarily exceed the trip threshold during a normal turn on. To prevent such parasitic triggering at power-on with capacitive loads, you only need to lengthen the low pulse on the Ctrl_Status pin. As long as the Ctrl_Status pin is maintained low, Q1 will keep the MOSFET in current limit, but Q2 won’t be able to close the latch. The current limit action will avoid a large current spike on the power supply.
Capacitor C1 provides an additional filtering in cases where the load may draw short current spikes during normal operation. During those spikes, Q1 will provide current limit, but the circuit will not latch unless those spikes exceed a duration that the value of C1 determines.
The LT Spice simulation output below shows the circuit breaker tripping (Figure 2). You can see the current ramping up and the output voltage dropping to zero when the current reaches about 750 mA.
|Figure 2.||Solid-state circuit breaker for microcontrollers in LT Spice simulation.|
I have used this circuit in many designs and have been quite happy with it.