When placing a microprocessor-based portable device in your desk drawer for weeks or months, you should, of course, turn it off to save battery capacity (unless it includes a real-time clock, or requires storage of volatile data). To save as much power as possible, it's usually best to turn off the processor, its peripherals, and all power-supply components.
A simple circuit (Figure 1) enables a single pushbutton to turn the power off and on. It includes a single OR gate (IC2) and a second device (IC1) that combines a low-dropout linear regulator with microprocessor-reset circuit in a SOT23, QFN, or ultrachip-scale package.
The single-gate OR circuit (TinyLogic NC7SZ32 in SC70 or chip-scale package) features low quiescent current, and is the only circuit powered during the OFF time. A user turns the device on by closing the ON/OFF pushbutton switch, which produces a logic high at input 1 of the OR gate. The gate output drives the LDO's SHDN input high, causing the LDO output to ramp up toward its preset voltage.
The LDO RESET output of IC1 remains low until the LDO output voltage has stabilized for the desired reset timeout period. When IC1 de-asserts its RESET output, the processor initiates code execution and drives a general-purpose output (GPO) high. With GPO high, the device remains in power- ON mode when the pushbutton is released, but to ensure a proper turn-on sequence the ON/ OFF pushbutton must remain closed for an interval that includes the LDO turn-on time (100s of microseconds), the reset timeout period (100s of milliseconds to 10s), and the code-execution time for GPO high (100s of microseconds to one millisecond).
To minimize the possibility of accidental turn-on due to a short pushbutton closure, include a delay of several seconds between the processor's emergence from reset and the GPO output's transition to high. (The LDO and P power up when the switch is closed, but will automatically turn off unless the pushbutton remains closed for several seconds.)
The μP's general-purpose input (GPI) is low during normal operation, and is monitored by the P for a low-to-high transition. To initiate a power-OFF sequence, drive GPI high by closing the ON/OFF switch. Use processor code to de-bounce the switch and to monitor the GPI input for the desired turnoff timeout period. (That is, wait for the switch to remain closed for a few seconds before shutting down the device.)
The Figure 1 circuit accepts a +5V supply and provides +3.3V at the regulator output. Supply current for the entire circuit is 139μA with no load, and only 0.9μA in shutdown. IC1 starts under any load from 0mA to 300mA.