+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 20 of 25
  1. #1
    Newbie level 4
    Points: 593, Level: 5

    Join Date
    Oct 2009
    Location
    india
    Posts
    5
    Helped
    2 / 2
    Points
    593
    Level
    5

    AC voltage measurement using pic microcontroller

    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 .....

  2. #2
    Advanced Member level 1
    Points: 6,346, Level: 18

    Join Date
    Nov 2004
    Posts
    444
    Helped
    24 / 24
    Points
    6,346
    Level
    18

    AC voltage measurement using pic microcontroller

    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.


    3 members found this post helpful.

  3. #3
    Advanced Member level 2
    Points: 9,513, Level: 23
    hameeds01's Avatar
    Join Date
    Aug 2005
    Location
    Islamabad Pakistan
    Posts
    599
    Helped
    76 / 76
    Points
    9,513
    Level
    23

    Re: AC voltage measurement using pic microcontroller

    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


    2 members found this post helpful.

    •   Alt16th November 2009, 11:02

      advertising

        
       

  4. #4
    Advanced Member level 1
    Points: 6,346, Level: 18

    Join Date
    Nov 2004
    Posts
    444
    Helped
    24 / 24
    Points
    6,346
    Level
    18

    AC voltage measurement using pic microcontroller

    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


    1 members found this post helpful.

  5. #5
    Advanced Member level 2
    Points: 9,513, Level: 23
    hameeds01's Avatar
    Join Date
    Aug 2005
    Location
    Islamabad Pakistan
    Posts
    599
    Helped
    76 / 76
    Points
    9,513
    Level
    23

    Re: AC voltage measurement using pic microcontroller

    Quote Originally Posted by garg29
    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



  6. #6
    Newbie level 4
    Points: 593, Level: 5

    Join Date
    Oct 2009
    Location
    india
    Posts
    5
    Helped
    2 / 2
    Points
    593
    Level
    5

    Re: AC voltage measurement using pic microcontroller

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


    1 members found this post helpful.

  7. #7
    Advanced Member level 2
    Points: 9,513, Level: 23
    hameeds01's Avatar
    Join Date
    Aug 2005
    Location
    Islamabad Pakistan
    Posts
    599
    Helped
    76 / 76
    Points
    9,513
    Level
    23

    Re: AC voltage measurement using pic microcontroller

    measure the value of vx via digital volt meter
    for eg if vx = 7v
    then select
    R1 = 1k , R2 = 2.5k


    1 members found this post helpful.

  8. #8
    Newbie level 4
    Points: 593, Level: 5

    Join Date
    Oct 2009
    Location
    india
    Posts
    5
    Helped
    2 / 2
    Points
    593
    Level
    5

    Re: AC voltage measurement using pic microcontroller

    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 ?


    1 members found this post helpful.

  9. #9
    Advanced Member level 2
    Points: 9,513, Level: 23
    hameeds01's Avatar
    Join Date
    Aug 2005
    Location
    Islamabad Pakistan
    Posts
    599
    Helped
    76 / 76
    Points
    9,513
    Level
    23

    Re: AC voltage measurement using pic microcontroller

    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


    5 members found this post helpful.

    •   Alt17th November 2009, 16:21

      advertising

        
       

  10. #10
    Newbie level 1
    Points: 523, Level: 4

    Join Date
    Jan 2010
    Location
    UK
    Posts
    1
    Helped
    0 / 0
    Points
    523
    Level
    4

    Re: AC voltage measurement using pic microcontroller

    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;



    •   Alt3rd January 2010, 19:15

      advertising

        
       

  11. #11
    Full Member level 4
    Points: 2,455, Level: 11

    Join Date
    Oct 2008
    Posts
    238
    Helped
    32 / 32
    Points
    2,455
    Level
    11

    Re: AC voltage measurement using pic microcontroller

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

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



  12. #12
    Newbie level 1
    Points: 391, Level: 4

    Join Date
    Oct 2010
    Posts
    1
    Helped
    0 / 0
    Points
    391
    Level
    4

    Re: AC voltage measurement using pic microcontroller

    Quote Originally Posted by hameeds01 View Post
    measure the value of vx via digital volt meter
    for eg if vx = 7v
    then select
    R1 = 1k , R2 = 2.5k
    What the code of D1 and D2?

    Tks.



  13. #13
    Advanced Member level 1
    Points: 4,225, Level: 15
    sahu's Avatar
    Join Date
    Oct 2009
    Location
    Uttar pradesh (INDIA)
    Posts
    460
    Helped
    51 / 51
    Points
    4,225
    Level
    15

    Re: AC voltage measurement using pic microcontroller

    can u post ckt + code hear.



  14. #14
    Member level 1
    Points: 746, Level: 5

    Join Date
    Dec 2010
    Posts
    37
    Helped
    6 / 6
    Points
    746
    Level
    5

    Re: AC voltage measurement using pic microcontroller

    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


    1 members found this post helpful.

  15. #15
    Newbie level 1
    Points: 255, Level: 3

    Join Date
    Jul 2011
    Posts
    1
    Helped
    0 / 0
    Points
    255
    Level
    3

    Re: AC voltage measurement using pic microcontroller

    i connect the circuit, but in ADC value is varied continuously , but the DC voltage is not varied



  16. #16
    FvM
    FvM is offline
    Advanced Member level 5
    Points: 162,921, Level: 96
    Awards:
    Helpful gold

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    25,677
    Helped
    7957 / 7957
    Points
    162,921
    Level
    96

    Re: AC voltage measurement using pic microcontroller

    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.


    1 members found this post helpful.

  17. #17
    Newbie level 4
    Points: 171, Level: 2

    Join Date
    Apr 2012
    Posts
    7
    Helped
    0 / 0
    Points
    171
    Level
    2

    Re: AC voltage measurement using pic microcontroller

    Any one please give the embedded c code and circuit diagram for the above A/D conversion... Plzzz...



  18. #18
    Banned
    Points: 498, Level: 4

    Join Date
    Feb 2012
    Location
    Thodupuzha
    Posts
    65
    Helped
    4 / 4
    Points
    498
    Level
    4

    Re: AC voltage measurement using pic microcontroller

    If you only want to measure AC mains voltage, it is better to first step down (300/5 or any other ratio). Then add a capacitor filter. The output DC will be equal to Max value of the AC. Then divide it by (square root of 2) to get (secondary voltage) rms AC voltage. Multiply it by 300/5 to get mains voltage.



  19. #19
    Member level 5
    Points: 753, Level: 6
    Prince Vegeta's Avatar
    Join Date
    May 2012
    Posts
    84
    Helped
    0 / 0
    Points
    753
    Level
    6

    Re: AC voltage measurement using pic microcontroller

    Quote Originally Posted by lijoppans View Post
    If you only want to measure AC mains voltage, it is better to first step down (300/5 or any other ratio). Then add a capacitor filter. The output DC will be equal to Max value of the AC. Then divide it by (square root of 2) to get (secondary voltage) rms AC voltage. Multiply it by 300/5 to get mains voltage.
    can u post a circuit of this?

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



  20. #20
    Member level 3
    Points: 726, Level: 5

    Join Date
    Aug 2011
    Posts
    58
    Helped
    2 / 2
    Points
    726
    Level
    5

    Re: AC voltage measurement using pic microcontroller

    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?????????



+ Post New Thread
Please login
Page 1 of 2 12 LastLast

LinkBacks (?)