Command for auto-off?

I would like my Arduino-controlled gadget to shut itself down after 5 minutes, to save the battery. It will then be powered up again by switching the power toggle switch manually. Is there a way to tell the Arduino to power down programmatically after some delay?


There are ways to minimize power consumption by sleeping the Arduino. It can then be woke up using an external interrupt.

What is the Arduino doing that it can shut off after 5 minutes with no negative impact?

Thanks for your quick reply!
So I guess that is a no?

My gadget is doing something that takes less than 5 minutes (prefer not to discuss this) and the user may forget to turn it off. I have wasted two 9V batteries already from this. I don't think a power-saving but still on mode is what I want. I want it to actually switch off, using a timeout function.

So I guess that is a no?

Correct, there is no way for the Arduino to automatically shut itself without the aid of additional circuitry.

power down sleep mode can be pretty low tho.
If you have arduino powered from 9V into barrel jack connector, then the regulator is still working, the USB/Serial chip is still powered, the power LED is stil powered.
External circuit to interrupt power into the barrel jack is needed, as noted above.

Maybe you can discuss what sort of external circuit one would use for the simplest manually-resettable arduino-controlled self-power-interruptor. A mechanical relay?


I was thinking a p-channel mosfet to source 5V to the circiut.
Gate pulled up to 5V to turn it off.
Momentary power switch pulls gate low to turn it on, uC then holds gate low to maintain power on, when done it drives gate high to kill power, pullup holds it high to keep power off.

Be sure to use a Logic Level part so it switches correctly at 0/5V levels.

This might help:

It lets you turn on/off something with a push-button, plus there is a logic level input that lets the device (ie the processor) turn itself off. Then you push the button to turn it on again.

Also you can use techniques here: Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors

But one of the first things it to not use an Arduino board as such, and certainly not a 9V battery.