How to make arduino power off itself?

Hey all!

I'm building a thing that is started by a button (switch) press. It's gonna be battery operated and it may be unused for a long time, so I dont want to wear out batteries. The enclosure is big so I can fit two 4,5 batteries, but I want to make sure they last as long as possible.

So, one idea I thought of was that the arduino is shut down (not connected to the battery power) and the button press starts is (connects the battery power), and then I would like it to shut itself down (cut the battery power) after some things have happened, from the code.

There's no problem with a little start up delay after the click when starting...

Anyone can help me out with such a solution?

Or is there another (simple) way of doing this? I read something about sleep mode? But it seemed like loooootsa code...

Thanks
Fredrik

Hi Fredrik;

I had a similar requirement for a small battery powered Picaxe project I built a while back. I ended up using a small single coil latching 5vdc relay. It requires only using up one digital output pin. It draws no power after it 'sets' the relay and draws no power from the battery while waiting to be turned on. You only need to set the digital output pin to HIGH when first starting your program and set it to LOW when you wish to activate the auto power off function. Below are links to a drawing and a E-bay listing for the relay.

Lefty

http://www.picaxeforum.co.uk/attachment.php?attachmentid=1973&d=1225042207

http://cgi.ebay.com/2-pcs-5-Volt-Relay-Latching-2-Form-C-DPDT-AL5WNK_W0QQitemZ110318173778QQihZ001QQcategoryZ36328QQssPageNameZWD1VQQrdZ1QQcmdZViewItemQQ_trksidZp1638Q2em118Q2el1247

Thanks man, I'll look in to that!

/Fredrik

Hi,

I have a similar issue, and the above-mentioned drawing would be very helpful. Is there another link please ?

Thanks,

Vertigo