Single Phase Energy Meter using Atmega32

atmegavoltage dividervoltage measurement

Version 1 :

We are trying to measure the input voltage from the AC mains (which theoretically should be 230 V). The circuit to measure this is a simple resistor divider network as shown below.

enter image description here

The values of the resistors are chosen such that it will generate corresponding step down voltage across 20k resistor which is fed into the micro controller.
EX. When the AC mains voltage is 240 V then the output voltage across 20k resistor should be 2.4V.

  • Before connecting the resistor network to the single ended ADC input of atmega32 – 2.4V across 20k
  • After connecting the resistor network to the single ended ADC input of atmega32 – 1.56V across 20k

The input impedance of the ADC of Atmega32 is high as mentioned in the datasheet. Hence there is no scope of loading effect.

Version 2 :
To remove the ambiguity of ground in version 1 we gave differential input across 20k to the adc on pin0 and pin1 as shown below. But still we are getting the same results.

enter image description here

NOTE:
All the voltage levels are measured using both CRO and DMM.

Best Answer

You are doing two things wrong as far as I can see.

Firstly, a 230VAC mains supply is a sinewave at 50 or 60Hz and has a positive peak amplitude of \$\sqrt2\$ x 230V = 325.3 volts and a negative peak amplitude of the same. This means the full peak to peak input voltage into your device is 6.5 volts peak to peak (assuming an attenuation of 100 which I think you are aiming for). I think this goes well beyond the ADC input range and may well damage your device.

The second problem is that your attenuator will have a common mode voltage of half AC voltage i.e. 115V AC. Usually, because the neutral wire is grounded, this means the AC voltage will try and lift your circuit to this voltage and (hopefully) if you have your design grounded, it will fail but in doing so you will have shorted out half the attenuation resistors meaning your attenuation is now only 50:1.

These are the main issues as I see them. Because you may not have been aware of these problems it is STRONGLY advised that you choose a safer method of extracting the AC voltage i.e. use a step down ISOLATING transformer.

AC MAINS IS QUITE OFTEN LETHAL.