How to do some processing after on/off switch switched off

Hi,

I have a project where I want to do some processing (write some data to eeprom) after the on/off switch has been switched to off.

From my reading of other posts it seems the only way to do this is to use the Pololu mini switch (here Pololu - Mini Pushbutton Power Switch with Reverse Voltage Protection, LV). As I understand it I will have to connect the "on" side of my switch to the "on" pin on the mini switch, and the off side to a digital pin on the Arduino. When the program sees the "off" pin on the Arduino go high (or low), then the user has switched off the device. So now the program can save its data to eeprom, and then send a high pulse to the "off" pin on the mini-switch, which will then power down the device. Would this work?

I would rather like to have the on/off switch as a momentary button, push on to start, push again to save data and switch off, but I don't see how this could be done using the Pololu mini switch. Another dedicated processor might work, but then it would have to be on all the time, and in sleep mode most of the time presumably. I'd prefer to avoid that if I can.

All advice gratefully received,

Ian

I guess a capacitor might keep Arduino going for a short period after you release the switch but it is down to you to let Arduino know the switch is indeed off, and it needs to do something quickly.