I need a circuit that can detect when electricity goes out and sends a signal to the serial port of my PC, so that a program that continously listens to the serial port can understand the situation and send a poweoff command to the operating system. I already have a simple UPS but I need such an extra circuit because UPS doesn't last for long.
I have two purposes:
1- Learn how to build such a circuit.2- Save my PC from unhealthy shutdowns.
I have only beginner's knowledge of electronics so any resource, URL, etc. that provides clear instructions will be very useful.