Power up arduino at the push of a button, then dow

Hej,

I'm hoping the following is possible, for a project of mine.

I have some Arduino Pro Mini's that I want to use in very small spaces (so far so good). But now here's the thing, the arduino's should be completely powered down, not using any power at all (so sleep is not an option) and at the push of a button, power up, do setup() and loop() and then completely power off again..

Is this possible? I will probably need specific buttons/switches or transistors to do this, but I can't find any examples.

Please help me out, thanks!

and at the push of a button, power up, do setup() and loop() and then completely power off again.

You realize that loop() is called in an endless loop, right?

The only way I know to do this it by using a relay, preferrably a latching relay. The button goes to the SET coil and to the Arduino. Press to set the relay and apply power, press again and the Arduino detects this and RESETs the relay, thus commiting suicide. Needs 2 pins, one to read the button and another to control the relay.

If you don't want to press again to power off then just do so at the bottom of loop. Only needs one pin to control the relay.

The above could probably be implemented with transistors with some thought.

You realize that loop() is called in an endless loop, right?

Ofcourse, but if I can code something in the loop or setup that shuts the arduino down again.. Its hardly endless...

And thanks a lot for the suggestions! Will look into latching relays and the link from sparkfun.

I have a similar problem for my project, if you are interested i can post some planning schematics i threw together a few weeks ago. I haven't tested or assembled yet, it's a lower priority at this stage...