This little circuit allows your microcontroller to cut the power off.
To turn the circuit on press the button.
To turn it off drive the "to microcontroller" signal high using whichever condition you like. For battery applications you might want to have a voltage reading on another pin (a voltage divider will do the job) and drive the pin high when a certain threshold has been reached.
INPUT is the voltage source (battery).
OUTPUT is the voltage applied to the circuit you want to switch off.
Can't be easier.
Parts Used [part number of this example]:
1 P-Channel Mosfet [IRF9Z24]
2 NPN Transistor [2N2222]
1 Push Button momentary switch
3 100k resistor
1 6k8 resistor
Step 1: Result
Short video of the circuit in action.