detecting power loss and sending shutdown to remote

Hi folks - trying to come up with the best way to handle this. I have a widget plugged into a wall socket and when power is shut off to that socket I need to send a shutdown command elsewhere, wirelessly. The basic component s already complete, except for knowing when to send the shutdown. One option is using capacitors to buffer enough power for a shutdown command then detecting the power loss, another is adding battery backup and detecting the switch to battery. Any other ideas or implementations of this idea? I have to be alive long enough to get a confirmation back of the shutdown msg I sent out, so it could be several seconds worst case.

I'm thinking battery is the best way since it fulfills more use cases, but I am hoping someone has expertise in this area already!


A simple solution might be to use a trickle charger to keep a battery topped up. Always run the Arduino on battery power in parallel with the trickle charge. Put a diode in the trickle charge circuit so the battery won't back-feed power to it. Then check the charge voltage upstream of the diode. If the voltage is 0 the power os off. You could probably arrange a voltage divider so there is a digital HIGH when the power is on and a LOW when it isn't.


Interesting idea, I’ll explore it. Thanks!