Hello,
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.
--Kevin