220V AC detection

Here's a suggested circuit (note the changes for 220VAC at the bottom):

Before anyone rush off to implement the above reference, you may want to note that this will put in excess of 300V across the current limiting resistor and this is typically outside specifications for most common resistors.

Also you need to verify that your mains supply is of the star shaped type (has a hot and neutral wire). Many AC generators will not and some countries (I know of Albania and Norway) use a delta shaped mains net.

If you don't know how to handle the above issues properly in relation to your mains supply, you are better off with the proposed idea from retrolefty (using an isolation transformer) and sense on the low voltage side.