Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

AC Current Measurement Strategy

Status
Not open for further replies.

mmitton

Newbie
Newbie level 3
Joined
May 24, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
South Africa
Activity points
1,353
Hi All,

We are busy with a project that takes measurements from a Current Transformer (CT) to track current usage in attached appliances. The CT is connected through an amplifier circuit to a micro-controller ADC pin. The AC wave (positive cycle only) is sampled at 100us intervals (there are a few channels to sample) and a snapshot of the positive half of a wave is recorded. From this snapshot we hope to calculate the current usage of the attached load.

We understand that in order to get an accurate power reading of the attached load we need to get an RMS current value from the CT, an RMS voltage value of the supply and the power factor (measure the phase angle difference between the supply voltage and load current).

Step 1 is to convert the ADC reading from the CT to a current value that is consistent with a Digital Multimeter (DMM) or within a small margin of error.

We believe that it should be possible to take snapshots (ADC values) of various types of loads with similar current ratings and the calculation employed should yield values that correspond to DMM readings. ie. If the DMM measures 2 different types of 15W loads and sees a current of 69mA and 58mA respectively (ratio of 1.19), then our calculation using ADC values should yield a similar ratio between the 2 loads.

Here are the values recorded for each load, 15W Incandescent and 15W LED lighting. (see graph)

Screenshot 2023-04-02 at 13.50.56.png


The various measurement strategies yield the following results and ratios: (see table)

Screenshot 2023-04-02 at 14.13.12.png


Where we calculate these values using the following formulas:

ADC sum = sum of all values
ADC Ave = average of all values
ADC RMS = peak * 0.707
ADC True RMS = Square root of the average of the sum of the squares

As you can see the sum/ave have a similar ratio but in the opposite direction and the RMS / True RMS calculations are way off.

Is the strategy to get the AC current employed here correct or valid?
What is the DMM using (Doesn't say it's a True RMS meter)?
Is the phase angle difference the issue here and do we need it for an accurate current measurement?
What are we missing?

Thank you for any insights.
Mark
 

Hi
I did a lot of AC measurement applications. The only accurate way is to measure voltage and current.
There are metering ICs doing all the sampling and math stuff for you. But it's not very complicated using microcontroller and writing your own software.
Using average method, using peak method, using current only are just "assumptions" but nothing accurate.

Like with every design you need to decide your goals first. "we hope", "we believe" ... is not my way of design. Physics and maths is rather clear and straight forward.

Thus there are many crappy measurement tools around. Like DVMs ... where there show "RMS" values but they are fake RMS value, nothing you can trust. So if you compare your values with a DVM value, then first verify that the DVM shows correct values.

It's on you what you need. Correct power measurement often is only 2 lines of code more than a fake measurement.

Hardware is simple, too. For perfedt AC lines voltage measurement I usually use two capacitors and three resistors..

Klaus
 

The question title is misleading, it asks about current measurement but you apparently want to determine consumed real power.

You see that LED power supply current is distorted, there's displacement plus distortion power factor in effect. Respectively a current measurement alone, no matter if true RMS or not can derive the power consumption. You need to perform true power measurement, average(I*U).
 

The question title is misleading, it asks about current measurement but you apparently want to determine consumed real power.

You see that LED power supply current is distorted, there's displacement plus distortion power factor in effect. Respectively a current measurement alone, no matter if true RMS or not can derive the power consumption. You need to perform true power measurement, average(I*U).
Thank you for your reply,

The question title is clear, we wish to measure current.

I made reference to what we are trying to accomplish overall, measure power, but step 1 is getting a current reading we can trust.

Step 1 is to convert the ADC reading from the CT to a current value that is consistent with a Digital Multimeter (DMM) or within a small margin of error.
 

do the RMS calculation:
square each measured value
add them up,
find the mean (divide by number of samples -1)
take the square root

much better than depending on the peak, which only works for sin wave,
and neither of your graphs are sinusoidal (even accounting for only + half cycle)

put the units into your results table
 
Hi,

Why "samples -1"?

Klaus
its a statistical thing
if you have 1000 samples, there is no difference between dividing by 1000 or 999
if you have 10 samples, dividing by 9 is different than dividing by 10 - it makes the result a little bigger by accounting for the relatively small number of samples
 

Missing?
1. Power Factor is missing for LED which looks like p.f.= real/apparent power.
This value is not avail. from your data unless you reported phase of voltage.
2. RMS = peak * 0.707 only holds true for sine current on incandescent.
 
If you want to measure the real power, there is an easier and more accurate way then calculating the RMS values and determining the power factor.
You just sample the current and voltage measurements simultaneously (with polarity) for multiple samples over the waveform period (the sample rate determined by the highest frequency of the harmonics in the waveforms).
You then multiply each voltage sample with the simultaneous current sample (including polarity of each) to get the real power for that sample, and then do a running average of the multiplied values to get the average real (RMS) power.

This works because at any instant in time the real power is the current times the volage at that instant.
This automatically accounts for a phase-shift between voltage and current (the power factor).
 

For power measurement, an MCU can usually read one ADC port only. In this case, the ADC reading alternates between reading the instantaneous current and the instantaneous voltage. So, every current sample is multiplied by the mean voltage of its two adjacent samples and every voltage sample is multiplied by the mean current of its two adjacent samples. The sum of these products in one cycle will be divided by their number (in case one cycle is read, the first/last sample of the cycle, which could be of current/voltage, is multiplied by its next/previous sample of voltage/current).
 

its a statistical thing
if you have 1000 samples, there is no difference between dividing by 1000 or 999
if you have 10 samples, dividing by 9 is different than dividing by 10 - it makes the result a little bigger by accounting for the relatively small number of samples
...makes absolutley no sense to me.

There always is a differnce: for 10 samples the difference is 10%, for 100 samples the difference is 1%, for 1000 samples the difference is 0.1%..

I mean we don´t do a statistical estimation, we do a physically and mathematically correct measurement and calculation.

Usuing the correct number is mathematically correct. Independent of absolute sample count. It works for 1, 2, 10, 100 , 1000....
Can you provide a link to a site where I can read about the "-1" thing? I want to learn what´s behind this idea.


Klaus

added:
then do a running average of the multiplied values to get the average real (RMS) power.
Keep in mind: (to avoid ripple) the "averaging window size" should be in integer multiple of the period time.
--- Updated ---

added:

@wwfeldman:
From statistics course (decades ago) I know the method to omit the most extreme value when estimating the average on spot checks.
So of 100 values (omit the most extreme one) you just add 99 values up ... then divide them by 99.

Is this what you mean?

Klaus
 
Last edited:

The question title is clear, we wish to measure current.

I made reference to what we are trying to accomplish overall, measure power, but step 1 is getting a current reading we can trust.

Step 1 is to convert the ADC reading from the CT to a current value that is consistent with a Digital Multimeter (DMM) or within a small margin of error.
Yes, your statement is clear, but unfortunately the method doesn't work to evaluate real power, which is apparently your final target.
There's only one option to get real power of loads with arbitrary current waveform, it's sketched in post #3 and elaborated by crutschow in post #10.
 

...makes absolutley no sense to me.

There always is a differnce: for 10 samples the difference is 10%, for 100 samples the difference is 1%, for 1000 samples the difference is 0.1%..

I mean we don´t do a statistical estimation, we do a physically and mathematically correct measurement and calculation.

Usuing the correct number is mathematically correct. Independent of absolute sample count. It works for 1, 2, 10, 100 , 1000....
Can you provide a link to a site where I can read about the "-1" thing? I want to learn what´s behind this idea.


Klaus

added:

Keep in mind: (to avoid ripple) the "averaging window size" should be in integer multiple of the period time.
--- Updated ---

added:

@wwfeldman:
From statistics course (decades ago) I know the method to omit the most extreme value when estimating the average on spot checks.
So of 100 values (omit the most extreme one) you just add 99 values up ... then divide them by 99.

Is this what you mean?

Klaus
no
my mistake
i confused the calculation of standard deviation, (where subtracting 1 from the number of data points works as i described)
with calculating RMS
my apologies
 

Keep in mind: (to avoid ripple) the "averaging window size" should be in integer multiple of the period time.
With a running average there is no specific "averaging window size".
It acts like an RC low-pass filter and you just make the running average with a long enough "time-constant" to give the ripple value you need.
 

With a running average there is no specific "averaging window size".
I can't agree.
It does not act like an RC ... and for sure window size has big impact on output ripple.
I've used running average many times in my designs.

Klaus
 

With a running average there is no specific "averaging window size".
It acts like an RC low-pass filter and you just make the running average with a long enough "time-constant" to give the ripple value you need
With a running average there most certainly is an "averaging window size". That's how a running average works: you average the samples within a certain window size (i.e., number of samples) and then move the position of the window for each subsequent average.
 

I guess, all depends on the application and the widow's size.

For example, in my volt/current meters that monitor the charge/discharge of an acid battery, I chose 4096 samples per window (x20ms ~=.8 sec). In this case, even if an entire ripple is missing (worst case), the reading error will be 1/4096.
But when I decided to drive 24V power relays on AC mains voltage (100V to 290V, 50Hz) via triac, the window has to be of one cycle only while the sampling period is 52us (using the ADC of ATmega8 and 8 MHz clock). The number of samples in one cycle will be, therefore, around 385 samples (20,000 us / 52 us). Again, the error of this number is one sample and the error of the average value will be 1/385 (< 0.3%) which affects just a little the triac phase delay and the average voltage on the relay's coil.

I am afraid that only when a scientific matter is discussed by using real numbers, good conclusions could be reached about it.
 

. That's how a running average works: you average the samples within a certain window size (i.e., number of samples) and then move the position of the window for each subsequent average.
Not the way I do it, but perhaps this is not called a "running average", although it acts the same as an RC low-pass filter running averager.
You take a sample and add a small percentage (typically some factor of 2 to simplify the math) of the difference (with sign) between that and the previous average value to give a new average value (emulating an RC low-pass filter).
There is no window size, and the averaging "time-constant" is determined by the sample frequency and what percentage of the difference that you add.
 
Hi,

There are several digital filters.
Two categories are FIR (finite impulse response) and IIR (infinite impulse response).

Basically FIR filters use a limited number ( n ) of input values (samples) and calculate the output. They don't feed back the output. Thus on a step response the output changes only for n calculations .. then the output stays constant. The response is finite.

In opposite FIR filter include the output into calculation. Thus a step response causes a change in the output and due to it's feedback it causes infinte time, continously changing the output (usually this "infinity" is stopped by the digital resolution. Thus in real life it never is infinite)

A running average is a special case of FIR filter with all coefficients being equal and "1/n".
What crutschow describes is a simplified IIR filter. Theoretically the impulse response is infinite.

Both filters have their own advantages. I use both.

On a known fixed signal frequency (may have overtones. Example: mains frequency) I often use the running average.
--> fast response, very low ripple, no ringing

On unknown signal frequency (human voice, noise suppression) I often use exactly what crutschow describes.
--> simple to implement. Known "RC like" behaviour.

Klaus
 
  • Like
Reactions: KerimF

    crutschow

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top