Electronic – PFET to turn on/off system power

analogmosfetpmospowerpower supply

I have a Raspberry PI board connected to some external circuitry, and am using Microchip MCP23008 I2C GPIO expander chips to control external LEDs and motor circuitry. One important part of this external circuitry is a 12V buck-boost switching power supply which is powered off of a 9V battery. The buck-boost regulator does not have an enable pin, and I am working out a way to cut the power to the regulator.

I already have a working 9V low-battery indicator circuit (shown below), which turns on the green LED if the battery is supplying a voltage greater than 7.0V, and if the voltage dips below 7.0V, the red LED is enabled. The circuit should also cut off the current coming out of the source of Q4.


Circuit – Version 1

Device Under Test (DUT)


I have two questions with respect to this circuit:

First, does the cutoff logic make sense? My assumption is that if the red LED is off, no current is going through D3, R6, and Q2, so the voltage at the node between R6 and the collector of Q2 would be the same as the power rail connected at the top to D1, D2, D3, and Q4's drain. If the red LED is on, there's a 0.7V drop across it, then a moderate drop across R6 (ie: estimated current, (7.0V-0.7V) / 330R = 19mA, so a 6.27V drop across the resistor roughly), and since this will make the Q4 bias less than that connected to Q4's drain, Q4 is turned off, cutting off power to the buck-boost converter. I'm convinced I'm overlooking V_ce on Q2 though.

Second, is it safe to assume the regulator can run from the output of the source of Q4 and D4? My estimates suggest that I will, when drawing current, have a 0.2V drop (V_ds) across Q4, and another 0.3V drop across D4.


Edit: Adding updated circuit as per earlier suggestions.

Circuit – Version 2

Device Under Test (DUT)


Edit 2: Updating as per latest answers.

I updated the circuit to reflect that of the answer provided by @DanLaks. Attaching DC sweep simulation.

DC Sweep Simulation


Best Answer

There's a couple issues with your circuit. I'll try to address them and answer your specific questions. My answer is based on your "Version 2" circuit.

First, the value for R7 is a bit high. When the battery is still good, that resistor is keeping the current into the base of Q1 very low, which allows very little current through the green LED. The voltage drop across R5 is therefore small, which means Vce of Q1 will be somewhat large. If it's too large, there'll be enough voltage to turn on Q2, which will activate the red LED as well. I'd recommend reducing R7 by an order of magnitude. 4.7k should work better.

I think you may have a misunderstanding of how a P-channel MOSFET works. They work the opposite of a N-channel. When the voltage at the gate is less than the voltage at the source, the transistor will conduct. When the voltage at the gate is equal to (or slightly less than) the source, the transistor will not conduct. The way you have the gate connected, it will actually cause the opposite to happen. When the battery is good, the red LED is not conducting. You correctly assessed that the voltage at the bottom of R6 will be approximately equal to the power rail. That will make the gate also equal to the power rail, which means the Q4 will be off. When the red LED is conducting, the voltage at the gate will be pulled down and cause Q4 to turn on.

There are probably several ways to cause the gate of Q4 to go low when the battery voltage is high and low when the battery voltage is low. Personally, I would use a stable voltage reference and a comparator to get a nice, crisp transition. But to keep in the vein of your design, here's an alternative that's similar to the flavor of your circuit.

schematic

simulate this circuit – Schematic created using CircuitLab

You can see the transistor logic to turn on and off Q4 is similar, but I tap off of the node between D1 and R8 and feed it into the base of a new npn. You could almost use Q1 instead of placing a new transistor, but the base of Q2 causes current to flow through D2, R5, and R9, and thus the voltage there isn't quite what we want.

One thing to consider with the automatic switch off is that you might experience power oscillations. When the circuit downstream of U3 drains the battery enough for the cutoff to activate, the sudden relaxation on the battery may cause its voltage to bump back up above the threshold. This will turn Q4 back on, which will cause the circuit to start draining current again, which will repeat the cycle. Possibly for a long time. If this is not acceptable, you will have to work hysteresis into the circuit.

To address your specific question about D4, yes, you can use that diode there. As long as the voltage at the VIN pin of U3 is with acceptable range after the diode drop. And obviously D4 must be able to comfortably handle the maximum amount of current into the circuit downstream. The same is true, obviously, for Q4. In addition, you have to account for the voltage drop across Q4 due to the Rds(on) of the transistor.

You say you're using a 9V battery. Is this a standard 9V alkaline used in smoke detectors and such? If so, I'm curious how much current you expect to draw out of it. Those kinds of batteries tend to have (relatively) high internal resistances and can't source very much current before their voltage starts to drop off considerably. If you're only in the 10's of milliamps, you're probably ok. Much higher and you might run into voltage problems.