AC Measurement


Closed Thread
Results 1 to 19 of 19

Thread: AC Measurement

  1. #1
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94

    Question AC Measurement

    Hello - I want to monitor and display AC voltage (120V 60Hz). I have scoured all the posts that I could find that dealt with AC and was not able to come up with exactly what I am interested in. I found some that got close but then fizzled out...

    I am interested in monitoring my line voltage over the a range of 120V +/- 5V (115 - 125V) and I only need a resolution of 1 V. I am not interested in voltages out of this range.

    If I feed my 120V through a transformer, rectify it and get it to a voltage (<5VDC) to feed into a PIC ADC (10 bit), will this work?

    The math works: Let's say I have 5V DC output that represents 125V AC input. At 10 Bits ADC resolution, that means that 1 bit (step) = 4.9 mV DC or 122.5 VAC. A drop of 1 V AC input to 124V AC would equate to 40 mV DC drop from 5 V to 4.96 VDC. This easily gives me the resolution that I need.

    I guess my question is if the circuit as described above will give me the response that I need. Is there a way to do this without a transformer (like the transformerless power supply)? I realize the safety implications but I want to keep this as small as possible.

    Thanks!

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    You could read the whole thread bellow
    http://www.picbasic.co.uk/forum/show...t=degree+60hz\

    Check the last one. I like the idea of 0.707 Vpeak but never experimented is as now. In theory and if your timings are good, it works.

    If properly design, something around the transformerless PSU idea may also works.
    Last edited by mister_e; - 10th November 2006 at 22:13.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    have a look at this
    Attached Images Attached Images

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default "High voltage" monitoring

    Hi, Atom

    The safe way would be :

    1) to use a Voltage to frequency converter , LM 331 i.e., on the HV side. ( after applying a, say 100v, offset to your mains ...)

    2) to transmit the freq. via an Opto-coupler ( 1Kv min rated !!! ... ) or an optic fiber to the measuring unit.

    It will be much easier to do a freq counter with the Pic ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Smile

    Hello All - Thanks for the replies. Using the RMS to DC converter chip as suggested by bbarney seems like the easiest way to go, but the chip costs $15 US which significantly inpacts the overall cost of my project. SO, at least for now, I am going to investigate some other options. I may come back to this if nothing else works.

    I am considering Mister_e's suggestions - the most interesting of which is the modification of the transformerless power supply (Melanie's design):
    (http://www.picbasic.co.uk/forum/atta...1&d=1139474240)

    Steve: would you care to further elaborate on that approach? Is it possible to get the 120 AC voltage down to the 5V DC range and be able to detect 1V changes in the incoming AC? The transformerless power supply has a Zener in it - if I am not mistaken, that essentially chops off voltages above it's rating (in this case, 12V).

    Acetronics: If I gather your response correctly, it sounds like you are addressing frequency measurement. At this time, I am interested in voltage measurement. Please let me know if I misunderstood...

    Again, Thanks!

  6. #6
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Melanie, you are invited, too!

    Melaine - Since this is (hopefully) a modification of your design, I thought I would invite you to participate and maybe take a break from the somewhat heated debate over fusing in the other thread... (BTW, I agree with you wholeheartedly. I was an electrical safety officer at a national laboratory here in the States, and I shut down operations at an entire facility because they used some equipment fused N:G). Aaaannywaaayy.... that's not the topic here... Can you give any comments on my objective?

    Thanks!

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Atom058
    Hello All
    Acetronics: If I gather your response correctly, it sounds like you are addressing frequency measurement. At this time, I am interested in voltage measurement. Please let me know if I misunderstood...

    Again, Thanks!
    Hi, Atom

    YES, you are ...

    the goal is to convert the mains dangerous voltage to a proportionnal frequency and THEN to use an opto coupler to transmit the info to a low voltage ( = safe ) part of the meter.

    so, you count a freq which is proportionnal to your voltage. C.Q.F.D.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  8. #8
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Alain - My apologies! After looking at the spec sheet, this does sound like a promising prospect after all. It looks like I need to get the voltage down to 10V or thereabouts to input into this chip. Is that correct? I tried searching for LM331 to see if any others have used this but could not find any reference to it. I even tried the Google search, too. Can you recommend a good way to get my incoming AC down to a level acceptable for input into this chip?

    Thanks!

  9. #9
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    126


    Did you find this post helpful? Yes | No

    Default

    I have measured 240v using this IC. I used two 240v minature transformers in series across the mains to measure the voltage. This became ~6v on the (series connected) secondary side that I then fed to the NSC RMS to DC convertor IC.

    I used the 'two transformer in series' trick as I had once read about it in Elektor as a way to improve the linearity of the small cheap transformers I was using.

    It worked real well, only issue was the cost of the ICs. I also worked on doing various half wave and full wave recification schemes, but after smoothing found the lag was an issue.

    Bill

  10. #10
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Bill - Thanks for your reply. I searched a little through the Elektor Forum and was not able to find anything like what you were describing. Can you point me in the right direction? Also, after looking at the spec sheet for the LM331, can you tell me if the circuit that they have diagrammed is necessary in it's entirety? Did you have a simpler design?

    Thanks! Atom058

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1185&stc=1&d=116343790 0">

    On a PIC with ADC and comparator on the same pin it could be possible.

    Comparator interrupt to detect the zero crossing, you wait 'till 0.707 Vpeak - x offset delay, then take an ADC reading.

    OR use 2 I/o, one INT (let's say INT0) + ADC.

    But i think the poor psu may suffer if you need many mA.... Could be handy to use high efficiency LED display.

    EDIT: another maths approach using samplings... process the long RootMeanSquare stuff... or by 0.707*Vpeak.
    Attached Images Attached Images  
    Last edited by mister_e; - 13th November 2006 at 18:09.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #12
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Steve - Thanks for the diagram. It looks to me to be a modification of the transformerless power supply with the addition of a resistor divider network to provide the input to my PIC. Is that correct?

    I don't intend to power my PIC or anything with this - so the current capability of the circuit is not important. I just need to know how to condition the AC so that I can read the voltage.

    I like your idea of triggering an interrupt (like for the AC Lamp Dimmer circuit you helped me out with), waiting a few uS and then start measuring the voltage on an ADC input. I would then find the highest value and from that I can calculate the voltage. However, I believe that I need to get the incoming voltage to the ADC pin to 5V or below. Isn't that correct? That seems to be the $64 question... how do I get the 120V AC input to some level that is acceptable for an ADC input? Is this accomplished with the resistor divider circuit that you presented?

    I appreciate your help!

    Thanks!

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Atom058
    I believe that I need to get the incoming voltage to the ADC pin to 5V or below. Isn't that correct?
    In fact the Vpeak must be lower than 5 volt. So a Vac(rms) of 5*.707=3.535 Vac(rms)

    how do I get the 120V AC input to some level that is acceptable for an ADC input? Is this accomplished with the resistor divider circuit that you presented?
    Yes. Maybe a dual secondary transformer (like the one you used for the DImmer) could work. This will also provide your insulation. So you use one output for your PIC and plah plah, the other for your reading.

    Maybe it will work good... maybe not... in theory yes... but i feel some potential bugs... interesting to know your results.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    126


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Atom058
    Bill - Thanks for your reply. I searched a little through the Elektor Forum and was not able to find anything like what you were describing. Can you point me in the right direction? Also, after looking at the spec sheet for the LM331, can you tell me if the circuit that they have diagrammed is necessary in it's entirety? Did you have a simpler design?

    Thanks! Atom058
    It was in a print edition in late 80s - let me see if I can find it in the archive and scan it. It was a mains voltage monitor in UK Elektor.

    The Circuit I used actually had the Maxim MX636 (I incorrectly mentioned NSC before) version of the AD636 (I used it because it was part of the free samples that were available at the time.) I used transformers for isolation as I didn't want to blow up the PIC, the computer, or myself !

    Not sure of the merit of converting voltage to frequency rather than just doing an RMS measurement in either hardware or software after stepping the voltage down. Have a look at Circuit Celler a while back - Jeff Bachiette (sp?) did an article using the Alegro current sensors where he did some RMS measurements in software to work out the peak current at the peak of the mains cycle - it might help. He did it in a 12f873 using PBP. Let me go out to the shed and see if I can find the article. The code should be on the CC site.

    Bill.

  15. #15
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Bill - Thanks for your help! That would be great if you can find that Elektor article. And the pointer to Circuit Cellar - I'll be pouring over that site...

    Steve (and/or Bill?) - I have a transformer question that hopefully you can answer: Let's say I have a transformer that takes 120VAC and gives me an output of 12VAC. If I have a 2V (1.67%) drop at the input, will I have a corresponding drop at the output (12 * 0.0167 = 0.2V)? In this case, my input would be 118VAC and my output would be 11.8VAC. If so, does anyone have a feel for how linear it is? Again, my voltage of interest is only between 115V - 125V AC.

    Thanks!

  16. #16
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    126


    Did you find this post helpful? Yes | No

    Default

    It depens on the linearity of the transformer. Small transformers tend to have quite bad regulation and this can greatly affect the linearity. This is why the Elektor article had two in series so the 230v primaries were only run at 115v to move the transformers response into a more linear region.

    Best suggestion I can make it to get a voltmeter of the appropriate type and measure the mains voltage at the same time you measure the output of the transformer to see if it is linear. If you can find a variac it makes it very easy as you just ramp up/down the voltage and plot the i/p to transformer o/p ratio.

    I'll have a look for the CC info - I have found the folder with it in - Its ISSUE 164 - March 2004
    FROM THE BENCH Intelligent Current Sensing: Harness the Power of the ACS750 Hall Effect Current Sensor, by Jeff Bachiochi, p.68

    Code is at ftp://ftp.circuitcellar.com/pub/Circ...-Bachiochi.zip

    Bill.

  17. #17
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Wink Microchip AN's ... of course !!!

    See Here:

    http://ww1.microchip.com/downloads/e...tes/00220a.pdf

    That's the smart way ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  18. #18
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Thumbs up

    Alain! Thanks for the link to the ap note! That looks like what I am trying to achieve. I have ordered the parts for the input side of the circuit as well as a variable transformer (for testing).

    Bill - I found the index listing for the article that you told me about but it is not available for viewing. Is there a way to get a copy of the article from them?

    I will try to put together the circuit from the ap note and let everyone know how it goes and post my results. Keep your fingers crossed!

    Thanks everyone!

  19. #19
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Talking Final Result

    Hello All - As promised, when I came up with a suitable solution, I would post it. Here it is... It works well for my application - I just need a good response between 110 and 125VAC. I used a split-bobbin transformer, bridge-rectified it and put it through a voltage divider (that has a trimmer on it so that you can adjust the output a little). Simple and cheap solution. Get nice values over the range I am interested in (about 1VDC over 15VAC range).

    Enjoy! And thanks!

    Atom058
    Attached Images Attached Images

Similar Threads

  1. Circuit Diagram for interfacing AC to PIC IC?
    By wellyboot in forum Schematics
    Replies: 3
    Last Post: - 8th March 2008, 19:40
  2. How to read AC mains with an inductance coil
    By KB3BYT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th February 2008, 12:02
  3. AC Measurement problems
    By Charles C in forum Off Topic
    Replies: 0
    Last Post: - 25th October 2005, 17:13
  4. Special Offer AC -AC adapter
    By lester in forum Adverts
    Replies: 0
    Last Post: - 9th September 2005, 07:52
  5. Detecting AC current
    By rhino in forum Off Topic
    Replies: 8
    Last Post: - 8th July 2005, 21:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts