## Measuring 220 AC with an ADC

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
abahler
Posts: 7
Joined: Wed Jun 20, 2007 11:49 am
Contact:

### Measuring 220 AC with an ADC

I am trying to find a good way to measure 220 AC with an ADC with a 5 volt range.
Thanks,

haklesup
Posts: 3048
Joined: Thu Aug 01, 2002 1:01 am
Location: San Jose CA
Contact:
With what accuracy, and range?

The basic recipe is a bridge recitfier, filter cap and a voltage divider such that 220V is 2.2V(*) and current through that divider is small.

(*)You may want to use a different target voltage to skew the range to a more useful center point or use an op amp with gain more or less than 1 to compress or expand the range of measurement.

Since the rectified DC will be different than the AC input value, you will need to do a little math with the digital data to correct for the AC-RMS to DC conversion if you are displaying a value as a result.

L. Daniel Rosa
Posts: 400
Joined: Tue Dec 25, 2001 1:01 am
Location: Bellingham, WA
Contact:
Okay, since you're asking I'll tell you some of what I've thought about doing with a similar situation.

I'm also thinking about sampling AC with an ADC that has a 5 volt range, but it's part of a microcontroller. Anyway my plan is to take a sample every 500uS, square it and add it to a running average accumulator. Perhaps a few times per second I would take the root of the accumulator value and display it, thus giving me a RMS value. Multiple samples would also improve the resolution of the readings because I'm certain to take readings at different points of the waveform.

The component side would bias the input to the midpoint of the ADC's range so positive and negative portions would be equally readable without a fancy rectifier scheme.

MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:
Hi there,

To add to the previous ideas...

The simplest circuit for measuring 220vac with an ADC with input
range 0 to 5 volts i think is this:

A single diode like 1N4007 in series with a 390k 0.25 watt resistor
in series with a 10k, 0.25 watt resistor, with a 100uf, 10v electrolytic
capacitor across the 10k resistor, plus terminal to the junction of
the 390k and 10k resistors.
The other end of the 10k resistor goes to ground, and the ac voltage
is fed to the diodes anode (cathode goes to the 390k resistor).
The ADC input gets connected to the junction of the 10k and 390k,
which is also the positive terminal of the cap.

This simple circuit achieves a 100 to 1 ratio, meaning that the output
to the ADC is 2.20 volts dc for 220vac rms input, and should be quite
linear meaning 200vac will give a 2.00v output, and 240vac will give
2.40v output.
The circuit also provides the correct input impedance needed for many
micro controllers ADC units, but if you happen to be working with one
that requires 2.5k instead of 10k you will have to divide all the resistors
by 4 and increase the power rating of the 390k/4 resistor (to be safe
use a 97.5k, 1 watt resistor if your ADC requires 2.5k input impedance).
The circuit also uses a 100uf low voltage electrolytic cap to avoid
having to buy a large value high voltage rated cap that would have
been required if the cap was connected to the input rather than the
output as it is now.
LEDs vs Bulbs, LEDs are winning.

abahler
Posts: 7
Joined: Wed Jun 20, 2007 11:49 am
Contact:
MrAl wrote:Hi there,

To add to the previous ideas...

The simplest circuit for measuring 220vac with an ADC with input
range 0 to 5 volts i think is this:

A single diode like 1N4007 in series with a 390k 0.25 watt resistor
in series with a 10k, 0.25 watt resistor, with a 100uf, 10v electrolytic
capacitor across the 10k resistor, plus terminal to the junction of
the 390k and 10k resistors.
The other end of the 10k resistor goes to ground, and the ac voltage
is fed to the diodes anode (cathode goes to the 390k resistor).
The ADC input gets connected to the junction of the 10k and 390k,
which is also the positive terminal of the cap.

This simple circuit achieves a 100 to 1 ratio, meaning that the output
to the ADC is 2.20 volts dc for 220vac rms input, and should be quite
linear meaning 200vac will give a 2.00v output, and 240vac will give
2.40v output.
The circuit also provides the correct input impedance needed for many
micro controllers ADC units, but if you happen to be working with one
that requires 2.5k instead of 10k you will have to divide all the resistors
by 4 and increase the power rating of the 390k/4 resistor (to be safe
use a 97.5k, 1 watt resistor if your ADC requires 2.5k input impedance).
The circuit also uses a 100uf low voltage electrolytic cap to avoid
having to buy a large value high voltage rated cap that would have
been required if the cap was connected to the input rather than the
output as it is now.

Is this after running the 220 line through a rectifier or not?

Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:
The 1N4007 is the rectifier.

TOK
Gorgon the Caretaker - Character in a childrens TV-show from 1968.

ecerfoglio
Posts: 108
Joined: Thu Nov 25, 2004 1:01 am
Location: Buenos Aires Argentina
Contact:
SAFETY WARNING

If your ADC has its reference voltage (aka ground) tied to one side of the 220 V supply, you can use a voltage divider as was sugested.

In that case, your entire circuit should be enclosed so it is not accesible to anyone. You shoult treat it as a hot chassis

But if your ADC, microcontroler, display or whatever is connected the ADC's output is to be treated as a "low voltage" circuit, you must provide isolation between the 220 V supply and the ADC.

One of the easiest ways to provide isolation is with a small transformer.

It may be the same transformer that powers the circuit, or it may be a small one dedicated to the measurement.

On the secondary side of the transformer (low voltage) you may rectify and filter the signal (with a diode and capacitor) and measure peak value, as was suggested by haklesup and MrAl.

In a sinewave the peak value is 1.41 times the RMS value (square root of 2), but if the waveform in not a sinewave you should read "true RMS" values. If you use a fast ADC) you can sample the AC and calculate the RMS value in your microprocessor like L. Daniel Rosa said.

Just be shure that you ground one side of the transformer's secondary and you will have a safe circuit (if you use a bridge rectifier, you may ground one side of the bridge's output).

Remember that 220 V is a high voltage and play safe
E. Cerfoglio
Buenos Aires
Argentina

philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:
all the voltage warnings apply...

I would add a zero crossing detector, use that to kick off a timer for a 1/4 wave period and measure the voltage at that point. that will give you peak voltage. You might need to tweak the actually timer period to account for the various delays in the ISR code. Much simpler and more accurate than averaging.

Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:
How precise does the measurement need to be? The simplest safe way is with a 220:5V transformer. If you need all quadrants of the voltage, then you'll need a bipolar input to the ADC which generally means adding a 2.5V offset. If you don't, just use a bridge rectifier.

What's the required accuracy and precision? Do you need time synchronization to the AC signal? what kind of ADC is it? etc...

abahler
Posts: 7
Joined: Wed Jun 20, 2007 11:49 am
Contact:
Ok, Some things I've come up with.
The 220 line is closer to 240 and it is made up of two 120 lines.
Also I'm not an expert at programming so I was thinking of rectifying the AC line and then using some kind of math in the software to calculate the
AC value rather than trying to figure out that RMS stuff.
The accuracy only needs to be within about a volt.

abahler
Posts: 7
Joined: Wed Jun 20, 2007 11:49 am
Contact:
It's US 240 if you know what I mean. It's coming off of a stepdown transformer with a center tap and so from the two lines two the center tap (ground) is 120VAC. So I don't know how I should measure th voltage with the method I just described.

ecerfoglio
Posts: 108
Joined: Thu Nov 25, 2004 1:01 am
Location: Buenos Aires Argentina
Contact:
It's US 240 if you know what I mean. It's coming off of a stepdown transformer with a center tap and so from the two lines two the center tap (ground) is 120VAC. So I don't know how I should measure th voltage with the method I just described.
Just use a small transformer with a 220 (or 240) V primary and a low voltage secondary (say 6 V, 12 V or whatever is available). Select the smallest transformer you can find that has a 240 V primary.

Rectify the transformer's output. You can use a single diode, or a bridge (or two diodes if you have a center tapped secondary). Ground the rectifier's negative to the ADC'c common and, if possible, to the safety ground.

Filter it with a small electrolytic capacitor and adjust the voltage range with a pair of resistors (voltage divider). If necessary add a second capacitor to reduce the ripple at the ADC's input.
E. Cerfoglio
Buenos Aires
Argentina

Robert Reed
Posts: 2276
Joined: Wed Nov 24, 2004 1:01 am
Location: ASHTABULA,OHIO
Contact:
If you step down to a low voltage (6 - 12 VAC ) the following rectifier will have a significant effect on accurracy across the the range. A better method is to use an Op-Amp as the "ideal rectifier" in lieu of a standard rectifier configuration. A simpler way to do this ,since your 240 Volt is already isolated is to bridge rectify the 240 VAC directly, filter it and resistively divide it to the range you desire. In that scheme the rectifiers drop and non linearitys will have almost no effect on overall accuracy.

abahler
Posts: 7
Joined: Wed Jun 20, 2007 11:49 am
Contact:

### Measuring 220 AC with an ADC

So what is the isolation needed for?
And also I'm hearing two options, one is just run it through a rectifier and voltage divider and the other is use a step down transformer.
So I don't know what to do.
Does the transformer act like a voltage divider with a ratio?

haklesup
Posts: 3048
Joined: Thu Aug 01, 2002 1:01 am
Location: San Jose CA
Contact:
Isolation is provided by the transformer. Basically that means if the resistor on your voltage divider or your rectifier shorts out, you don't have 220V AC applied directly to your circuit. Not using a transformer is cheaper but less safe.

Yes, the tranfromer acts somewhat like a voltage divider by reducing the 220V to something smaller and safer to work with. It is not a divider though, the secondary voltage is a function of the turns ratio from input to output not divided between multiple secondaries.

If you had a transformer with a 100:1 ratio (220V in 2.2V out), you wouldn't need the resistor divider, just the rectifier. 10:1 is more common. In many cases a 120V to 12 V transformer can be used for 240V to 24V operation.

Thats not to say that two transformers couldn't be used like a divider, its just uncommon.

Use a transformer, considering you seem a little unsure of what to do, play it safe.

### Who is online

Users browsing this forum: No registered users and 33 guests