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.
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.
NOTE: All the voltage levels are measured using both CRO and DMM.