Push Button ON/OFF Power Control
Sometimes you want to be able to turn an electronic instrument ON or OFF by momentarily pushing a button. This application note provides some always powered circuitry that detects a button press and switches ON the main power to your embedded system. Because it consumes almost no current in the OFF state, it's particularly useful for battery powered portable instruments. It is suitable for use in new products, medical devices, and analytical instruments.
The circuit is powered by a 2-6V battery or other power source, but draws only the tiny quiescent current of a quad 74AC00 CMOS NAND gate. The NAND gates form a latch that switches an N-MOSFET, that in turn switches a P-MOSFET to turn ON and OFF the power to the embedded system. The latch can be triggered from two sources, a momentary contact switch or one of the output pins of a processor in the embedded system.
Here's what it does:
- When battery power is first applied, the circuit comes up in its OFF state.
- When your embedded system is OFF, a momentary button press turns it ON.
- When the embedded system is ON, a momentary button press does not affect the latch, but it can be detected by the processor pin if it is configured as an input capture. The processor can then shut down the embedded system in an orderly manner.
- The processor pin can also be used to turn OFF power. After the processor pin detects a button press, or at any other time determined by the application program, the processor pin can be reconfigured as an output pin. Subsequently, setting the output pin to high causes the latch to switch to its OFF state after several seconds.
- The embedded system can be forced OFF by pressing and holding the button for more than three seconds.
To use the circuit optimally, your software should do the following:
- When the processor is first turned ON the processor pin should be configured as an input.
- Then configure the pin as an input capture so that it will call an interrupt service routine when it sees a rising edge.
- Your interrupt service routine should shut down the application program and all the I/O it controls.
- Once the application is shut down, the interrupt service routine should reconfigure the pin as an output and set it high.
- Setting the output pin high will reset the auto-on circuit to its OFF state after several seconds, turning OFF the embedded system, including the processor.
The input power voltage can be up to 26V, and should never be more than 30V, which is the source-drain breakdown voltage of the MOSFET power switch.
The P-MOSFET power switch deserves some discussion. On its input side it is protected by a 33V varistor and a zener diode prevents its gate-source voltage from exceeding its limits. You don't need the zener if your power supply never exceeds 20V.
The output of the switch is slew-rate limited to prevent current surges into the embedded system. Power-on surge current often destroys instrument power supply filtering capacitors, particularly tantalum capacitors. This circuit limits the turn ON voltage profile to a linear voltage ramp of two milliseconds duration. Once the switch is fully ON, it is no longer current limited, and supplies the full load current. The circuit is protected against false triggering by EMI/RFI sources.

