# Implement MicroController Power Switch and re-use the button for other features

This is similar to other questions, but I feel it is different because of the reuse of the "power" button.

I want a "latching" Momentary Power button.

Behavior:

1. User Pushes momentary button, holds down as long as necessary and the device powers up.

2. Between Power On and Off the same button will be re-used for other functions

3. When it is held down for 5 +/- seconds the MicroController will turn itself off.

Design Constraints:

1. Battery provides between 3.7V to 2.9V during it's usable life

2. The Voltage regulator requires Vin +/- 0.3V on the Enable Pin, 3.1V output.

3. MicroController operates at 3.1V

4. MicroController Output Pin High state is 2.7V Max

Debouncing: In this case I'm not concerned about debouncing the switch, if the user doesn't hold it down long enough for the MicroController to set it's Digital Output pin High the device doesn't power on.

I've worked up the following schematic, which kind of works.

Falstad Circuit Simulator of my schematic

It assumes 3.7V from the battery. Uses an Analog Input for the Power button, which then uses the variation in voltage to determine if the button has been pressed. In the current design the difference is 0.12 V (from 3.4 to 3.52), but the MicroController has a 12 bit ADC so that shouldn't be a problem, in addition I can adjust the sensitivity range of the ADC.

Questions:

What is the difference between reality and the simulator?

Is there a better way?

How can I get a greater voltage difference on the button input? I've tried many different combinations but they increase the voltage range above the 3.6V Input High Maximum specified in the datasheet.

I'm not excited about the "Leakage current" when the uC Controlled Power Pin is Low, any suggestions?

This is variation on my answer to this question. Like Mike, I am also using a P-channel MOSFET. The OP stated: "The Voltage regulator requires Vin +/- 0.3V on the Enable Pin", and "MicroController Output Pin High state is 2.7V Max". Therefore when the battery voltage is above 2.7v, the µC will be unable to supply the required voltage to meet the voltage spec for the Enable lead. So I am using the control lead of the µC to control the MOSFET, which in turn switches the battery voltage (or Vin) to the Enable lead.

Initially, the control lead from the µC is configured as an input. When the button is pressed, battery power is applied through a Schottky diode (keep Vf below 0.3v) to enable the regulator. The µC then configures the control lead as an output and grounds it, keeping the enable lead high through the MOSFET (which keeps the voltage at the battery level). Meanwhile, the button can be used as an input.

The circuit should draw very little power (less than 1 µA) when the µC is powered down, assuming the regulator shuts down completely when the Enable lead is low.

This eliminates the cost of the LTC2954 chip which runs over $2 in 500 unit quantities. This circuit should be under 10 cents in quantity (except for the switch and regulator). • "The button being used as an input" is the INT pin in my circuit. There's nothing saying you must connect it to an interrrupt; that's just the usual case since interrupts are usually used to wake a device up from sleep. Also, the power your circuit will draw with power off is the off-state quiescent current through the supply's VIN pin. It has to use some power to monitor the state of ENAB. – Mike DeSimone May 13 '12 at 12:25 • Problems: 1) GPIO output "POWER ON" from uP must not have ESD diode to VDD, which is not the usual case. 2) The diodes (even if Schottky) make Venable<(Vin-0.3). 3) You don't need the upper diode. 4) Input "To uP" must withstand 3.7 V, and must be (at least weakly) pulled down, so you need a resistor divider there. – Telaclavo May 13 '12 at 12:50 • @Telaclavo - 1) can be fixed by driving an external FET. 2) shouldn't be a problem. This diode only drops 0.1V at 10mA! – stevenvh May 13 '12 at 12:55 • @stevenvh 1) He doesn't need two FETs. 2) Right, I hadn't seen schottky datasheets in a while. – Telaclavo May 13 '12 at 13:00 • @MikeDeSimone I missed the discussion of the INT output of the LTC2954 in your post. I looked at three datasheets, and the typical current draw on the Enable lead when shutdown is 100 nA. Ok, not zero. I have edited my question. – tcrosley May 13 '12 at 14:41 Many micros, expecially the ones designed for low power such as the MSP430, have a zero power interrupt. The CPU goes to sleep rather than completely powered down. In this mode it takes a few uA. When the button is pressed it is woken by an interrupt (i.e. power on as far as the user is concerned) after which on it can monitor the pin for some input and turn off or do some other function depending on the way the pin is pressed. No need for any external circuits (other than the button). See this TI app note for an example • I'm actually using an ATMega micro, but the same concept would apply. It does have a constant drain, although I like that it's a controlled low uA draw. I'm using a rechargable battery and expect it to be charged more than once a week in most cases (consumer device) so this is a good solution. – James May 12 '12 at 22:49 • With this approach, the LDO regulator should have a very low quiescent current (because it will always be on). Some consume a lot. – Telaclavo May 12 '12 at 23:17 • I'm using the NCP512 and according to the datasheet if it's going to convert anything it wants to convert 1mA (Microcontroller only needs about 10uA). If this is true once charged the device would last about 16 days, before requiring to be recharged. While this is probably acceptable, I'm hoping it's a little bit better. – James May 12 '12 at 23:20 • @James The NCP512 may consume up to 90 uA, and the LTC2954-1 of the other answer may consume up to 12 uA. If standby current is very important, go for the LTC. – Telaclavo May 12 '12 at 23:32 • The uA spent while sleeping are nothing. When actively used, I'm expecting 20-50 mA and have specc'ed a 400 mA battery. I got the 1 mA usage from the following line in the datasheet. "Ground Current (Enable Input = Vin, Iout = 1.0 mA to Io(nom.))". Is that a valid interpretation or is the Quiescent Current a better gauge? – James May 12 '12 at 23:58 You probably want a Push-Button Controller, such as the LTC2954-1. They're available in TSOT-23 at around$5 each in small quantities. This is going to perform a lot better than trying to keep your MCU from raining the battery. And yes, the simulation is probably close enough to reality.

VIN can fall all the way to 2.7 V and it will still work. The circuit above shows a PFET for switching the regulator on or off, but if your regulator has an active-low enable input, you can just hook EN up directly. EN is an open-drain pin, so you don't have to worry about what the high voltage is; the regulator will need to pull up its EN pin itself, or you can put in a pullup resistor. If it has an active-high enable (haven't seen many of those), you can put an NFET and a couple pullups in between the controller EN and the converter EN to invert the level.

When your system is running, pressing the button for a short time will pull INT low. Again, this is an open-drain pin which doesn't care what your VCC is, just add a pullup resistor. Further, there's a KILL input that the MCU can use to turn the power off itself. The capacitor on PDT sets how long a "short" INT press is vs. a "long" OFF press.

Linear makes several similar controller chips (all LTC295_ numbers) with various features; look through them to be sure to get the right one.

• I'm expecting to manufacture in enough quantity that a cost over a $1.00 needs to be considered very closely. The rest of my electronic parts total about$5 in 100 unit Qty. The parts count in the simulation is 6 with a cost of under $0.20 but your suggestion addresses the constant power drain. – James May 12 '12 at 22:45 • The LTC2954CTS8-1#TRMPBF is$2.13 each in a spool of 500 from Digi-Key. – Mike DeSimone May 13 '12 at 0:00
• "EN is an open-drain pin, so you don't have to worry about what the high voltage is". That's what I used to think as well, but only recently we had a question about open-drain logic ICs with clamping diodes to Vcc. – stevenvh May 13 '12 at 10:16
• In this application, the ESD diode would pull to Vin, so unless your DC/DC converter has a boost mode, that's not an issue. – Mike DeSimone May 15 '12 at 13:13