Electronics > Beginners

Switch mode power button



I've got a project I'm experimenting with that involves a small device powered by a single AAA cell that will use a PWM/PFM switch mode regulator circuit for logic-level power.  For maximum battery life, I'd like to be able to power down this regulator circuit when the device isn't in use, but I'm only planning on having one single momentary button on the device which must be multipurpose (i.e. an input to the microcontroller).

Would it be possible to use this momentary button to first connect the power shutdown pin to battery, then after the microcontroller gets up and running, switch the button to be an input to the microcontroller?  The thought being as soon as the microcontroller starts up, it could set an output pin high to keep the regulator going, and then switch the momentary button from the battery/shutdown to the input pin on the micro.  Then, when the microcontroller decides it's time to shut down, it simply clears the pin.

If you think this is a good idea, how's the best way you know to switch the button from the power circuit over to the microcontroller?

This is what I'm thinking:  Maybe drive a transistor to switch one leg of the button from the battery to the input pin?  That way the other leg of the button would always be connected to the shutdown pin of the regulator, which should always be high as long as the microcontroller is running.  I'm probably missing something obvious here though, so I can definitely use some pointers.

Edit:  Would I even need a transistor for this, or could I use a diode and a pull-down resistor to isolate the battery from the input pin?

Thanks in advance for the enlightened responses.


interesting problem,

As long as there will be a voltage between one terminal of the button and gnd and that voltage always changes between ~0 and >3V when pressed then you will be able to detect that with the mcu as an input with no problems. So as long as you keep that in mind and design around it you can design whatever else you need on the button to enable/disable the power without worrying about using the button for mcu input later.

If you find it tricky to design it that way then another option maybe to use a push-button that has two separate contacts inside. That way you can have one for the mcu input and one for enabling power and they're totally separate.
You could even look at a system where the two sets of contacts engage at different points, kinda like on a camera where you press the button a little and it focuses, then press more and it takes the pic.

Another way again that you could do it would be to include a supercapacitor on the board.  Have a seporate circuit powered by the 1.5V AAA that will disable the switchmode power supply when the capacitor voltage is charged and reenable when the capacitor volts reaches say 3.5V or less. That way the mcu can run directly off the capacitor and go into deep sleep whenever it needs to save energy. After a week (or however long it takes the capacitor to run flat) the switchmode psu is automatically enabled, charges the capacitor back up, switches off and the process starts again. This way may not give you as long a battery life as fully disabling the powersupply until the button is pressed but it will extend the battery life a huge amount compaired to running the switchmode psu all the time.

You could also run a low power latch directly off the AAA and tie SET to the button and RESET to a spare mcu output, Then connect the latch output to the switchmode IC enable/disable pin. (Hopefully it will trigger from 1-1.5V).
Doing it that way would mean the latch would enable whenever someone pressed the button, turning on the power supply. The mcu could then turn off the power supply itself after X seconds or whenever it wanted to.

And there is also the standard way of using the button to connect the battery volts to the psu enable pin through a resistor then having the mcu programmed to pull one of its outputs high as soon as its starts. Then connect that output to the psu enable pin through a resistor as well to hold the psu enabled once the mcu starts. The mcu can then pull it low later to switch off.

I'm sure there are plenty of other ways to do this as well..

hmm... sounds like the circuit on a couple of my softstart flashlights!

im not sure how did it, but they include a buck/boost converter, sleep, soft start/stop, single button interface, very low voltage up to 4.2v input. i would assume the mcu remains powered from the battery in sleep mode, listens for the button on a pin, then enables the buck/boost converter as needed. i might have a picture of the board somewhere....

Take a look at the appnotes for the MCP1640.

In AN1311, Single Cell Input Boost Converter Design, they use a single button and an output of the PIC12F617 to enable the converter and a FET to switch the load.
AN1337 is about battery life optimization, here they use a FET to drive the enable input indirectly with a PIC10F206 and use another output to change the output voltage.

The enable input of the works with TTL levels of the (low) input voltage. If I read the datasheet correctly it also accepts it's own output voltage.

So you could get way with a button to enable the converter, and then use a output (and some resistors) to keep it up. Another contact of the same button as MCU input.


[0] Message Index

There was an error while thanking
Go to full version