I have recently built and installed a UPS for my PC that seamlessly switches to inverter power once a power-cut occurs. The problem is that once the batteries run out, my computer dies as usual.
Firstly I need the Arduino to recognize when grid power is off, from then on it should safely shutdown my PC. I am thinking of using a "Genuino Uno" and a simple 240V AC to 5V DC converter that will act as a signal to the Arduino that grid power is still on. I will power the Arduino from a separate power source.
My question is if the Arduino alone is able to monitor a loss of 5V DC power or do I need some sort of sensor component? Otherwise I've seen a "Non-invasive AC current sensor" (https://store.arduino.cc/product/E000020) that is able to monitor current, and therefor I would safely be able to clamp it around my PC's live wire, right?
Finally, Is it possible to shutdown a Windows 7 PC automatically once loss of power is achieved? If so, How?
Thank you, Since I am new to the Arduino and this forum, all help is appreciated! :)
Hey! I actually built the very first USB UPS on the market! It was very many years ago, so hopefully my info isn't dated.
Windows does have native power management that you can interface to if you follow the Power Device Spec (which I helped write) -> http://www.usb.org/developers/docs/devclass_docs/pdcv10.pdf. This means you can't use the Uno or any Arduinos that use a USB Serial Converter. I'm not sure how much effort it would take to make a direct USB Arduino like the Leonardo operate as a power device.
BTW - to enable the native power management in Windows 7, plug in your UPS and then go to "Hardware and Sound"->"Power Options"->"Edit Plan Settings"->"Change advanced power settings"->"Battery"->"Critical battery action"->"Shut Down". When I was doing this for a living in the 90s, Apple and Windows native power management both supported UPS shutdown with some sort of file saving. Linux had something that one of our employees did in his spare time, but I didn't work with it. I remember Windows not saving data for much more than Microsoft products, which might not even be relevant today since Office seems to always have a copy of my lost work even if the PC crashes.
Following the Power Device Spec is a little easier said than done, as it is large and only a few of the usages are used by the OS's native power management. You might be able to guess from the names in the Advanced Power Options which need to be supported. Otherwise you could check which usages another UPS used that works with Windows and implement the same HID Report Descriptor they did.
As far as detecting the power failure, you ask if you "need some sort of sensor component" but then you say that you already have a UPS that "seamlessly switches to inverter power once a power-cut occurs." How are you sensing the power failure now?