AC voltage measurement using pic microcontroller

Status
Not open for further replies.

rohil20

Newbie level 4
Joined
Oct 26, 2009
Messages
5
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Location
india
Activity points
1,334
Hello,

I am new to microcontrollers and am making a project to read ac mains voltage using pic microcontroller (pic 16f72).
But I am unable to find the circuit to step down the ac voltage to DC and that too to the max. level of 5 volts and what will be the ratio of input ac and the input to the ADC of the pic ,for the calculation in pic code for display purpose.

Can anybody help me with this .....
 

simply put a diode & a resistor divider but this is not a proper method for good & accurate results use a step down transformer & then precision rectifier. search on net for precision rectifier.
 
here it is



set the values of R1 & R2 by measuring Vx across capacitor

5(R1 + R2) = R2 Vx

0 volts means 0v main supply
5 volts means 220v main supply
 
hameeds01 i think there's slight problem with your circuit....with this method, due to diode, the minimum AC voltage that will be displayed will be somewhere around 30 volts below that till zero it will show "0" because the diode will eat up 0.7v
 
garg29 said:
hameeds01 i think there's slight problem with your circuit....with this method, due to diode, the minimum AC voltage that will be displayed will be somewhere around 30 volts below that till zero it will show "0" because the diode will eat up 0.7v

Transformer secondary voltage = 6v & the peak voltage will be more than that
 

Thanks hameeds01 for a promt reply
Can you please mention the value of R1 and R2.
 
Reactions: bugme

    bugme

    Points: 2
    Helpful Answer Positive Rating
measure the value of vx via digital volt meter
for eg if vx = 7v
then select
R1 = 1k , R2 = 2.5k
 
hameeds01

there is one point where I have a doubt is when the ac will varry from say 160V- 250Volts AC then will the input to the microcontroller's ADC will vary or not ?
 
here it has assumed that the Maximum Main AC voltage is 255v
u can change the max limit according to ur requirments

Main_max_volt = 255

(5/Main_max_volt) x present_main_volt = volt_to_ADC

for eg::

if present_main_volt = 0v then
5/255x0 = 0.0v & ADC = 000

if present_main_volt = 160v then
5/255x160 = 3.137v & ADC = 160

if present_main_volt = 200v then
5/255x200 = 3.921v & ADC = 200

if present_main_volt = 220v then
5/255x220 = 4.313v & ADC = 220

if present_main_volt = 250v then
5/255x250 = 4.901v & ADC = 250

now u don't need any calibration just simply convert the ADC Register value to ASCII & display it on ur screen thatz it

Don't forget to press helped me button

hameeds01@yahoo.com
 
Hi there,

This circuit is very interesting, I will give it a try. Now a question if I wanted to measure a maximum of 350VAC ( a seocndary of a transfomer for example), what would you do in that case? Also, if I wanted then to masure the rectified voltage of that secondary (PSU for example) of around 480VDC, woudl you use a voltage divider?

Thanks for the insight,
Ronald;
 

For AC voltages above 220 use two transformers with the primary in series.(see attachment)

In the second case the divider would not work...
 

it is surjeet
first i have to tell you that pic 16f72 has 8bit adc ,so u will get 255volt maximum, about to 300volt ac u should use 10bit adc,
which u will get in pic16f676
 
i connect the circuit, but in ADC value is varied continuously , but the DC voltage is not varied
 

The original circuit presented by hameeds01 implements a RC discharge time constant of 35 ms (10 uF * 3.5k). The will discharge to about 56 % of it's maximum value during each 20 ms period. This behaviour is by design, although not further discussed in the present thread. You have to manage it in your software somehow, e.g. by averaging the measurements.

It should be also mentioned, that the circuit is measuring Vpeak rather than Vrms. You can correct it for a sine voltage, but if the AC voltage is distorted, the result won't be correct.
 
Reactions: tpetar

    tpetar

    Points: 2
    Helpful Answer Positive Rating
Any one please give the embedded c code and circuit diagram for the above A/D conversion... Plzzz...
 


can u post a circuit of this?

also, is this better than taking samples of the AC voltage?
 

what should i do for measurement of 500V without transformer??????????

in that case i want to measure current upto 20A so how can i measure this both parameters?????????
 

what should i do for measurement of 500V without transformer??????????

in that case i want to measure current upto 20A so how can i measure this both parameters?????????

500v? in that case your voltage divider circuit will be made to convert 500v to 5v peak. I don't know about current really.
 

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…