# AC current measurement w/ Differential ADC

Discussion in 'The Projects Forum' started by singularity2, Jun 7, 2011.

1. ### singularity2 Thread Starter New Member

Jun 7, 2011
3
0
I'm trying to read AC current w/ a differential ADC connected to my embedded processor (via I2C), and I'm having trouble.

Here is an image of my setup: http://imageshack.us/photo/my-images/59/currenttransformer.png/

I'm connecting a 3000 turn current transformer around one leg of my AC power.

I placed a 220 Ohm burden resistor across the leads of the current transformer.

When I measure that voltage w/ my multimeter (Fluke 177), I get a RMS reading of around 150 mV, which seems to coincide w/ my 2.0 amp Killawatt reading of the source AC circuit.

I then connect the burden resistor across my CH1- and CH1+ pins of my MCP3424 differential ADC. I sample the ADC repeatedly, compute the RMS, and I get values consistently around 90 mV RMS.

Is this hooked up correctly?

Here is what I've tried so far:

- determining if my ADC is fast enough (it's just 240 SPS). I've done a bit a math, and read a lot of forums online, and it sounds like it should be fast enough. It might not be perfect for this application, but I haven't determined that it's speed is to blame.

- grounded one ADC input (hardware friend recommended. It didn't help.)

- added a per sample fudge factor. If the ADC was averaging its sample, instead of sampling an individual value, then the reading would be low (by .1 according to my math). But, the compensation needed was much greater than this, and wasn't constant across different currents.

- analyzed the source samples: I made a histogram of the raw ADC samples, and they have a 'hump' around zero, which I doesn't sound right for a histogram of a sine wave.

Is there something fundamentally wrong with my setup?

Thanks,

Randy

2. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,953
1,826
Oops, you are trying to measure an AC voltage with a DC analog to digital converter. Typically these have a "holding cap" and exactly what value that is charging to I have not a guess.

The analog inputs to that thing want to be within the rails, VDD to VSS plus minus .3V. Your burden resistor is floating so I also can't guess what voltage is going in.

Last edited: Jun 7, 2011
3. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,953
1,826
And as far as the sampling rate goes, assuming you are in the US with a 60 Hz line frequency you are trying to measure something that changes polarity 120 times a second with 240 measurements a second. Yeah, theoretically you hit the Nyquist sampling rate by a factor of 2 but life ain't that simple.

My "feeling" is you need to condition the sense transformers output some by converting it to a proportional DC then measure that. Lots of op amp precision bridge rectifiers followed by a low pass filter should do the trick.

Jul 7, 2009
1,585
142
Also check this \$10 (delivered) part out; it might make things simpler for you.

5. ### singularity2 Thread Starter New Member

Jun 7, 2011
3
0
Thanks for the input.

It seems to be working very well now in some situations. I reduced my loads to a couple of know quantities: an incandescent lamp and a microwave. In the resulting three combinations my data looked much closer.

Then to get the data right on, I assumed the ADC's sampling function and/or holding cap is "averaging" the value over the 1/4 cycle (I'm in the US w/ 60Hz), so I computed the ratio of the average of 1/4 sine wave to an instantaneous sample, by taking the integral of a sine wave over 1/4 cycle and dividing by pi/2... My math came out to .9. Using that factor to scale each number from the average back to a single value (for the RMS calculation), now my results appear to be correct within the accuracy I can mesaure to (< 1%). Hopefully my logic was correct here.

So my current theory is that my problems are related to the loads: either the power factor, the non-linear behavior, or the variability.

I then tested a single compact fluorescent bulb, and got correct looking results. CFLs have low power factors, and I've read they are also very non-linear.

I then tested just my laptop, and got incorrect looking results (its hard to analyze though due to variability in the samples). Both of these latter two tests had similar low power factors (and similar histograms of their ADC samples), but the laptop's current draw was all over the place, according to my digital multimeter. So, maybe my algorithm or ADC can't handle the variable current, or maybe the ADC can't handle non-linear loads due it's low speed. (I've read though that laptops and CFLs have similar power factors and non-linearity though)

In any case, it's encouraging to see accurate results sometimes. Next I'll test some more loads with low power factors (maybe an electric drill or blender). And I'll improve the speed of my algorithm by moving to C code. My goal is to find the source of the inaccuracies - power factor, non-linearity or current variablity.

6. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,953
1,826
Some? Closer?

I don't agree. A sinewave applied to a capacitor from a low impedance source would average to zero. Another way to look at it is a simple low pass filter, it has no DC component.

Additionally, the currents you are trying to measure may not be sinewaves at all. Take a conventional full wave bridge: the current it takes occur in narrow spikes starting a bit before the peak of the sine.

A lamp makes a nice resistive load. So does a heater. Microwaves, chargers, and the like are very complex loads.

7. ### singularity2 Thread Starter New Member

Jun 7, 2011
3
0
"some" situations being: incandescent bulb, microwave, and fluorescent bulb. They are giving me accurate results.

"closer" being within 1% of what my measurement tools, which consist of a digital multimeter, a Killawatt and an Instek scope, are telling me the results should be.

The more complex loads are probably where everything falls apart, since as you said - they aren't sine waves. So, the low ADC sampling rate is probably really showing it's limitations there. Or maybe I've somehow gotten lucky with the situations that are working, and nothing really works. A few more tests this weekend should give me more insights there.

I really need a faster ADC, but unfortunately the boards I have are what they are. And even with a faster ADC, I still won't be able to calculate power factor, so the usefulness will be limited.

Thanks.