Intro: Detect AC Line Failure
there is a lot of expensive arduino modules available to do that, this method is most effective & cheap way. measuring light which coming from NE-2 neon lamp gives us an idea about voltage quality. also same setup can be used to validate your 12v inverter is really sine wave or not.
you can see actual AC waveform when you render incoming readings in a realtime graph: http://psychip.net/video/ac-line-detection-with-t...
Step 1: Find a Screwdriver With Test Feature
remove the NE-2 neon lamp from it, you can salvage from anywhere else but you have to attach a 100k resistor in this case.
Step 2: Attach a Photoresistor
attach a photoresistor and wrap it with a black tape to prevent any external light source.
Step 3: Connect to Arduino
solder an 220v (in eu) male plug to neon lamp's legs and connect ldr's legs to arduino gnd and any available analog pin. rest of stuff upto your software development skills.