Shorted neutral to microcontroller ground.

Ac to measure is 220vac/50hz, mains vary from 170Vac to 300vac & freq could be 50 or 60hz from mains supply.

2. On this divider I was thinking of placing a capacitor for filtering also, for noises. How to calculate value of this capacitor:

a) make a low pass filter, block freq above 60Hz

b) make a band pass filter, pass only 50/60Hz component only

c) make a software based filter

3. With a divider of 330K & 2.2K, MCU will see a equivalent thevenin by 2.2K parallel to 330K i.e 2.18K

If I look at this: http://www.electronics-tutorials.ws/filter/filter_2.html

What fc should I select, but keeping in error margins of all resistors & capacitors?

or should I select 60Hz ?

If I select 60Hz, then fc = 1/2*pi*R*C

C = 1.21uF, nearest I have is 1uF.

With 1uF fc will be: 72Hz

Are these calculations correct?

4. Similarly for band pass, values can be found. http://www.electronics-tutorials.ws/filter/filter_4.html

5. Or should I use software filter? I am sampling using:

a) Sample every 500us after for 50 readings i.e 25ms. Find the highest point, this is peak.

b) find 25 peaks like this & store it in array.

c) sort this array, reject lowest 5 & highest 5. Take avarge of mid 15 values

d) this is peak, divide by root2, to get rms.

What cut off freq should be selected keeping in mind all variation of resistors & caps assuming 1% resistors & X7R caps.

6. Currently I am able to measure values which are near to its calibrated values. 2 point calibration is done.

Just curious to know how to calculate these values.