[PIC] confusion about reading ac mains voltage with microcontroller

Status
Not open for further replies.

jit_singh_tara

Full Member level 6
Joined
Dec 22, 2006
Messages
325
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Delhi , India
Activity points
4,295
Hello frnds ,

Please clarify my doubt :

If we want to measure ac mains voltage rms .

1.We scale down 240Vac RMS(340V Peak) to say 3.53 AC RMS( 5V peak).
2. Now if we want to read this peak voltage which is with respect to neutral ,from adc of microcontroller , then since uC runs on 5V and Gnd , Will uC be able to read the 5V peak ac voltage .

What about the neutral of scaled 5v ac , and gnd of uc supply .

Can we read directly from mcu as the neutral and gnd are at different potential , or are they at same potential.
If they are at same potential can we connect them together Gnd and Neutral of the scaled 240V ac mains......



Please clarify how to read ac mains voltage directly from microcontroller adc for rms voltmeter.

thanks....
 

Don't confuse "common" and "neutral" and "ground". But forget all that for the moment.

I would suggest you use an isolation transformer; then you can connect one side of the secondary to your uP common, and the other side to your ADC input. And I would scale this to something less than a 5V output, otherwise you won't be able to distinguish between 240V and 260V.
 

Hi,

don´t forget that 230V AC also means -340V peak. so peak-to-peak is 680V.
Your ADC probably has only 0..5V input.

To get around this you acn use a resistor devider to downscale the mains voltage to +/- 2.5V.
Then a capacitor to ADC input, and also high ohmic bias voltag of 2.5V to the ADC input.
Then you see the 2.5VDC added with +/-2.5V AC. Mind to subtract the offset in software.

Hope this helps.
And take care of you - 230V is dangerous!

Klaus
 

i am posting pics of the design....

a.here is the pic of scaling down 240V rms ac to 3.65V rms (approx 5V peak).



measuring the voltage on oscilloscope as shown in figure below .with respect to neutral.





This much part is fine i am able to scale the ac voltage down to 5v peak ac wrt neutral .i.e oscillosope one lead to neutral and other lead to the resistor divider...

- - - Updated - - -

The problem is how do i connect this scaled voltage to :

1. LM324 circuit , which i am using to add an offset so that i can have the waveform going from 0v to 5V positive peak only .i.e
a. -5V peak : 0V .
b. 0V : 2.5V .
c. +5V peak : 5V .

I am again scaling down the 10V peak to peak ,of this 5V peak waveform as shown above post .

The problem is that when i connect this scaled ac voltage directly to opamp circuit the wave form output from the opamp is very distorted , it is no more a sine wave ,
i am running my lm324 with +-8V supplies.
I will post the pic as shown below the moment i connect my opamp pin2 through the resistor 2k .



I want to make a true rms meter , plz help me how to read the samples of the waveform , how to get a perfect waveform.....



Can i connect neutral to ground ? I know sounds strange but how do i measure ac voltage with uC which measures according to the ground .
 

hello,

use a transformer 230/9V (or 6V) to follow a safety situation...

i did a peak to peak measurment an obtain results like this


all details on my web page..C18 code

 
Hi,

here a picture with opamp as buffer.


To make it even easier you can leave the opamp and connect the signal Opamp+ directely to ADC.

This is a low cost solution with good results, but no safety and no filters...

Hope this helps
Klaus
 

Refer this project **broken link removed**
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…