An idea for soft power with no quiescent loss - Page 1
Forum section: electronics / projects

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 31, 2014, 04:07:09 am
content: I would like for a single button to switch a battery-powered device on/off but I would also like the button to have other functionality once the device is switched on. For example, once switched on, a momentary press changes mode but holding down for 3 seconds switches the device off. This would normally be achieved using the microcontroller's sleep mode but the combined current consumption of the sleeping microcontroller, voltage regulator, etc may be hundreds of uA. Not great if the device is going to sit on the shelf for a few weeks/months.I've attached a circuit of what could be a handy solution. When the circuit is off (e.g. when battery connected for first time), nothing is powered. Pressing the button switched on the circuit and the microcontroller must then immediately set two tri-state pins to GND and VDD to latch the circuit. The button then has no effect of the power and its state may be read with a third microcontroller pin. The microcontroller turn itself off by returning its GND and VDD outputs to Hi-Z.Is this kind of circuit already common practice? All comments welcome.

author: Rufus
author_rank: Super Contributor
timestamp: October 31, 2014, 04:24:24 am
content: It won't work. The processor pin connected to the MOSFET gate has a diode to VDD which will pull the MOSFET gate low when power is off. Also when you try to turn off the MOSFET gate still sees difference between your battery and regulated supply.A processor with 5v tolerant pins and open drain output option might work if the battery voltage isn't too high. Otherwise you need another transistor to isolate that pin.

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 31, 2014, 07:17:23 pm
content: oops. I didn't think of that ...a hazard of posting ideas at 3am.I've given it a bit more thought and attached an alternative solution. This circuit does not require anything from the microcontroller other than a pull low to switch off The microcontroller pins must be tolerant of the expected voltages. A dual transistor package could be used to provide both the transistor and the diode to reduce the BOM to only 4 parts.What do you think? Is there a risk that the floating transistor base could false trigger?EDIT: Gait should be pulled high by resistor

author: Rufus
author_rank: Super Contributor
timestamp: October 31, 2014, 08:02:27 pm
content: We have been here before. There is a better circuit herehttps://www.eevblog.com/forum/suggestions/single-button-power-and-input-with-microcontroller/

author: 8086
author_rank: Super Contributor
timestamp: October 31, 2014, 08:03:40 pm
content: Also I was reminded of this from ages back:https://www.eevblog.com/forum/projects/mosfet-power-switch-with-auto-off/msg120253/#msg120253

author: lewis
author_rank: Frequent Contributor
timestamp: October 31, 2014, 08:12:48 pm
content: I'd probably do something like this. It's the cheapest solution I can think of.Switch + R2 turns on the transistor which turns on the PFET. R3 is necessary to protect the input of the MCU from the battery voltage. At power-up, MCU immediately turns on On/off output to latch the transistor on and keep the PFET on for as long as desired. Because there is 0.6V at the base of the transistor, R2 now acts as a pulldown for the switch, although 0.6V might not be 'low' enough for a 3.3V MCU. Use ADC or comparator input instead. Pressing the switch while powered up is still detected through R3. MCU clears on/off output low to turn off power. Floating base might be a problem, 1M from on/off to ground will sort it, lower if active power consumption is not an issue.

author: dannyf
author_rank: Super Contributor
timestamp: October 31, 2014, 09:37:13 pm
content: QuoteQuoteQuoteDepending on how you define those terms, the answer ranges from "sure" to "no way".

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 31, 2014, 10:14:01 pm
content: Thanks for the links, I knew I was reinventing the wheel. I've attached my circuit with the previously missing pull up/down resistors. I built the circuit (LED load, no microcontroller) and quiescent loss is ~20 nA according to uCurrent.Quote from: Rufus on October 31, 2014, 08:02:27 pmWhich of the circuits you are referring to in that thread? I assumethis one. In what way do you think it is better? It uses fewer components but requires firmware to latch. My suggested circuit latches without a microcontroller; this is very important if the microcontroller is to be allowed to reset without loosing power.Quote from: 8086 on October 31, 2014, 08:03:40 pmLooks almost identical to mine (p-channel MOSTFET instead of PNP) but lacks the feedback to latch without a microcontroller. This could easily be added. How would you compare the circuits?

author: Rufus
author_rank: Super Contributor
timestamp: October 31, 2014, 10:28:02 pm
content: Quote from: sebmadgwick on October 31, 2014, 10:14:01 pmBetter because it doesn't apply the battery voltage to any processor pin. Your current circuit applies full battery voltage to the processor input pin before the processor is even powered.

author: dannyf
author_rank: Super Contributor
timestamp: October 31, 2014, 10:39:40 pm
content: Quote1. When the switch is closed, what happens to the microprocessor input pin?2. When the microprocessor outputs a on the base, what happens between it and the ground?

author: sebmadgwick
author_rank: Regular Contributor
timestamp: October 31, 2014, 10:41:31 pm
content: An issue with my feedback for latching without firmware is that capacitive loads a difficult to switch off. The microcontroller would need to pull the PNP base low until the load has discharged, which is not possible because the microcontroller would brown out first.Quote from: Rufus on October 31, 2014, 10:28:02 pmYes, that is appealing, and given the issue I just described, I think I preferthe circuit you linked.1)Do you have any thoughts on the ability of the microcontroller to reset without causing power to be cut?2)Is there a simple way the circuit can be made to switch on when power is connected for the first time (e.g.cap across the button)?

author: dannyf
author_rank: Super Contributor
timestamp: October 31, 2014, 10:44:24 pm
content: A simpler solution for you to complete:1) pnp/p-ch switch on;2) push button to ground the base/gate - to turn on the switch;3) push button is by-passed by a npn/n-ch controlled by the mcu.That's the gist of it. Latching can be done by applying the right voltage on the npn's base / n-ch's gate.