Power Enabling

Thread Starter

Nick Maestro

Joined Oct 16, 2014
5
I have a circuit that uses a PIC micro-controller to enable the batteries. So when the user turns it off, the PIC 'commits suicide' by disabling the batteries so that no current is drawn anymore. Now no devices have power. So when the batteries are not enabled, I have to use a SPST power switch, that shorts one side to ground, to somehow send battery power to the circuit to wake up the PIC and allow it to enable the batteries and sustain life.

The troubling requirement is that the switch is grounded. So I can power the other side and use a P-Channel MOSFET to enable the batteries when the switch is grounded. I've attached a diagram of this. But the MOSFET stays on no matter what, I can't get it to stop sending battery voltage into the circuit. Please help with any advice or alternative ideas to get this circuit to disable the battery voltage to the circuit when the switch is not pressed.PowerSwitchDiagram.PNG
*I have to use a voltage divider because the PIC is also connected to side 2 of the switch - to know when it is pressed. The batteries range from about 3.8 to 6.2 volts and the PIC can't handle more than ~6V.
 

RichardO

Joined May 4, 2013
2,270
You can replace R1 with a N-channel FET such as a 2N7002. If the PIC is powered off as well then you need a resistor (100k to 1 meg) from the gate of the 2N7002 to ground.
 

Thread Starter

Nick Maestro

Joined Oct 16, 2014
5
You can replace R1 with a N-channel FET such as a 2N7002. If the PIC is powered off as well then you need a resistor (100k to 1 meg) from the gate of the 2N7002 to ground.
Where does the gate connect? I'm assuming the source is grounded and the drain goes out to the P-channel FET gate.
 

kubeek

Joined Sep 20, 2005
5,795
I would delete R1 completly and make R2 around 100k or so. Use a bipolar npn transistor parallel with the switch. Why is that diode there?
You press the switch, and as soon as the pic wakes up it sets logic one on the output that feeds the base of the npn, should take no more than a few us to do that in code. Now the micro keeps that pin high for as long as it needs to be on. When it pulls it low the power goes off and you have to push the button again to run it again.

Also check that you have the source and drain connected correctly.
 

RichardO

Joined May 4, 2013
2,270
Where does the gate connect? I'm assuming the source is grounded and the drain goes out to the P-channel FET gate.
Sorry, I should have been more precise. Yes, the 2N7002 source connects to ground and the drain connects to the gate of your power P-channel FET. The gate of the 2N7002 connects to the output of your PIC. Leave the connections of your switch, R2 and the P-channel FET unchanged.
 

Thread Starter

Nick Maestro

Joined Oct 16, 2014
5
I would delete R1 completly and make R2 around 100k or so. Use a bipolar npn transistor parallel with the switch. Why is that diode there?
You press the switch, and as soon as the pic wakes up it sets logic one on the output that feeds the base of the npn, should take no more than a few us to do that in code. Now the micro keeps that pin high for as long as it needs to be on. When it pulls it low the power goes off and you have to push the button again to run it again.

Also check that you have the source and drain connected correctly.
The diode is there because there are a few voltage sources (batteries when enabled, power switch and wall plug) that feed into the same line (I call RawV) which then go into the voltage regulator. Each power source has a diode going into RawV.
 

Thread Starter

Nick Maestro

Joined Oct 16, 2014
5
I should clarify that I already have a functional battery enable. It is a load switch controlled by the PIC. The power switch, diagrammed above, is only temporary to power the PIC long enough to enable the batteries (a separate line). So I need the power switch PFET to stop allowing current through when it is not pressed. Otherwise, devices consume current while their supposed to be off.
 

Thread Starter

Nick Maestro

Joined Oct 16, 2014
5
Then just use R2 to hold the transistor closed, and delete R1 which is not needed anyway.
That's what I thought too. R2 keeps the gate voltage close to the battery voltage until the switch grounds it. Sounds perfect... except that the PFET still outputs a small voltage when the gate is high. Maybe I just need to find the right PFET that will stop the voltage fully.
 

kubeek

Joined Sep 20, 2005
5,795
... or the load is drawing a _very_ small amount of current.
That would be voltage caused by leakage current of the transistor. Such current will be completely insignificant with respect to the required load current. So if you measure voltage ath the point between the diode and the transistor and you are sure that this path is not the main supply, then just forget about it and regard the transistor as being turned off.
 
Top