I can directly measure the DC voltage on R1 resistor. I use internal reference from Arduino Uno board (compatible board with ATmega328 microcontroller) so maximum value for U2 can be
U2 = U1*(R1+R2)/R1 = 1.1*(1+22)/1=25.3V
AC voltage U1 so DC voltage U2 = U1*1.41-Udiode
If we put value in equation
U1 = (U2+Udiode)/1.41
because I use trafo U0 = k * U1.
For tests, I use a trafo imprinted 220V/2x12V 200mA but if I measeure voltage from secondary coil
I found 11V when main voltage is 220V, so k = 220/11=20. I use an 1N4007 diode and Udiode=0.65V.
I use an LED display with 4 digit 7-segment drived by TM1637 (who I present on base blog in article named Afisaj cu 4 cifre controlate de TM1637 si Arduino and sketches are at https://github.com/tehniq3/TM1637-display):
Schematic for display put on Arduino Uno is:
I write main-voltage_0.ino sketch and upload in Arduino board and I made a movie named main supply voltage measured with Arduino