I was working on a project that I wanted to run for 30 seconds and then permanently disconnect from power. The project was a battery powered kids toy. Kids will not remember to turn a power switch off after playing. So to conserve the battery I wanted to have a momentary switch that would turn on the toy and then after 30 seconds it would turn itself off.
I was able to find some similar circuits and adapt them to this application. The circuit uses 2x MOSFETs, a pushbutton, and a digital output on the Arduino.
How it works:
I will explain the operation below.
This circuit allows an Arduino to disconnect itself from power. The Drain, Gate, and Source on the MOSFETS are marked with "D","G", and "S".
First I will give some details about the MOSFETS. I need to find out what conditions cause the MOSFET to be "ON" or "OFF". ON means there is very low resistance between Drain and Source (marked as D and S in the circuit above). In other words, ON is a closed switch. MOSFETS are turned ON or OFF based on the value of Vgs which is the voltage difference between the gate and the source pins.
In the schematic Q1 is an N channel MOSFET. To find out the behavior of this device we can look in the datasheet and see that the Vgs(th) is between 2.0 to 4.0 Volts. That means it is an enhancement mode MOSFET. Vgs(th) is the threshold where the MOSFET will begin to turn ON. Q2 is a P channel MOSFET. The datasheet shows that Vgs(th) is between -2.0 to -4.0 Volts which means it is also an enhancement mode MOSFET. The table below shows the behavior of these MOSFETS for different values of Vgs.
Using the table above I will go through the circuit operation by looking at the 3 states: