Introduction: Arduino Microcontroller Self Power Off
This short instructable presents a very simple way of auto powering off your microcontroller. I'm using an Arduino, but it should work for others in the very same way. I've searched myself for this for a while and found the solution in this application note: http://www.onsemi.com/pub_link/Collateral/AND9093-... . The solution presented here is simpler than others I found, and it works for higher voltages than the 5V used out there. What you need:
- 1x P-MOSFET - I'm using an IRF9640, although this is overkill - the board is using only 50mA incl. the display
- 1x Small signal N-MOSFET - I'm using a BS170
- 1x Resistor 4,7k or 10k - anything between 1k and 10k should do
- 1x push button to power on the controller
The following figure shows the circuit:
Step 1: Build Up the Circuit
Build the circuit as shown in the diagram. It is important to use the Vin pin of the arduino as the 9V need to go through its 5V converter.
Step 2: Implement Your Code
The example shows the code required to turn D7 (any other will do as well) HIGH after powering on the Arduino. Then, after 5 seconds, D7 is set to LOW, thus powering off the device.
Replace the 5 seconds delay with your code.
I've measured ~55mA when the Arduino is on, including the display, and I could not measure any current when it was off.