The circuit in this diagram will help you to measure the voltage of the mains.
R1=R2=1 MOhm R3=39 KOhm, R5=3.3 KOhm, R4=10 KOhm C1= 10uF tantalum. All the resistors except R4 should be 1% metal film.
The reverse voltages of the diodes in the bridge rectifier should be 600V minimum, such as 1n4006 or 1N4007. The linearity of the output is fairly good in the voltage range 40 to 264 Volts.
IMPORTANT NOTE: Since lethal voltage is introduced to the circuit please be extremely careful not to touch any part of the circuit with bare hand or with any conductor.
Another way is to use a small transformer 220 - 11V and 1VA. In this case the bridge rectifier does not work as the forward voltage drops of the diodes introduce 1.4 V, thus for small voltages there may be no output at all. Also the transformer itself introduces very high nonlinearity.
To overcome the first problem an ideal rectifier (with two OP/AMPS) should be used. To overcome the second problem (nonlinearity) assume that the voltage output of the transformer is linear in a small window such as 0 -20, 20.1 to 40, 40.1 to 50 etc, and put a multipoint calibration program in yourcontroller