PDA

View Full Version : AC Measurement



Atom058
- 10th November 2006, 21:04
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!

mister_e
- 10th November 2006, 22:10
You could read the whole thread bellow
http://www.picbasic.co.uk/forum/showthread.php?t=4351&highlight=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.

bbarney
- 10th November 2006, 23:12
have a look at this

Acetronics2
- 11th November 2006, 09:58
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

Atom058
- 11th November 2006, 16:09
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/attachment.php?attachmentid=781&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!

Atom058
- 11th November 2006, 16:17
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!

Acetronics2
- 11th November 2006, 16:19
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

Atom058
- 11th November 2006, 17:03
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!

bcd
- 13th November 2006, 00:55
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

Atom058
- 13th November 2006, 16:14
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

mister_e
- 13th November 2006, 17:11
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1185&stc=1&d=1163437900">

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.

Atom058
- 13th November 2006, 21:35
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!

mister_e
- 13th November 2006, 21:45
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.

bcd
- 14th November 2006, 07:23
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.

Atom058
- 14th November 2006, 11:35
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!

bcd
- 14th November 2006, 12:20
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/Circuit_Cellar/2004/164/164-Bachiochi.zip

Bill.

Acetronics2
- 14th November 2006, 14:51
See Here:

http://ww1.microchip.com/downloads/en/AppNotes/00220a.pdf

That's the smart way ...

Alain

Atom058
- 15th November 2006, 00:40
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!

Atom058
- 14th December 2006, 20:20
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