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 waveform RMS calculation

Status
Not open for further replies.

UroBoros

Advanced Member level 2
Advanced Member level 2
Joined
May 5, 2004
Messages
642
Helped
19
Reputation
38
Reaction score
8
Trophy points
1,298
Location
Cochin - India
Activity points
6,463
I need to find the RMS value of a wave form of a 50Hz ~230V AC.

I am using Dspic to do it.
How many samples/ Cycle is needed for optimum results. The dsPIC I am using has only a total of 512 RAM bytes

Thanks
 

Ok, I can take samples from 10 cycles and take average.
But my doubt is how many samples from a 20mS period full waveform?

Thanks
 

Hi,
Since you are using a signal with a frequency of 50Hz, to satisfy the Nyquist criteria you have to sample the signal atleast twice of the maximum frequency of the signal. i.e. 50*2=100 samples/sec

Is it OK

Regards,
N.Muralidhara
 
See this

In essence, the theorem shows that a bandlimited analog signal that has been sampled can be perfectly reconstructed from an infinite sequence of samples if the sampling rate exceeds 2B samples per second, where B is the highest frequency in the original signal. If a signal contains a component at exactly B hertz, then samples spaced at exactly 1/(2B) seconds do not completely determine the signal, Shannon's statement notwithstanding. This sufficient condition can be weakened, as discussed at Sampling of non-baseband signals below.

More recent statements of the theorem are sometimes careful to exclude the equality condition; that is, the condition is if x(t) contains no frequencies higher than or equal to B; this condition is equivalent to Shannon's except when the function includes a steady sinusoidal component at exactly frequency B.

Consider a sign wave of 50Hz. If we take samples at 10ms apart -means only two samples in a cycle. Will that be ok at any time?

Microchip in AN1279 takes 128 samples and calculate RMS!

Thanks
 

The more samples per cycle the better the accuracy. I would do at least 10 per cycle. You did not mention if you are measuring a voltage source or current. Current can have wild waveforms so greater sampling is required. For example, many rectified and filtered power supplies have AC mains current spikes that only last for a short portion of the AC period. If you want to find the AC rms current in this case you need a lot more then two samples per cycle.
 
There is not a good idea to use an integer fraction of the wave period.
The reason is that in case of a syncronized noise ( i.e : present at same phase of all cycles ) it may be invisible to measurement if occuring between samples.

The best choice is define a sample rate submultiple of prime numbers like that :

CICLE WAVE = exact 20ms ( 50Hz )
SAMPLE RATE = exact 19ms
TOTAL CICLE RATE = Least_Common_Multiple ( 20ms ; 19ms ) = 20 x 19 = 380ms

Note that effective accuracy at long time is virtually equivalent to 1ms -> 1KHz ( 20ms - 19ms )

+++
 
Last edited:
the exact choice can be arbitrary. a pure 50hz signal has no bandwidth, thus the minimum sampling _rate_ is 0. Put another way, using only a handful of points, the 50Hz signal can be reconstructed and there is no need to sample further.

using a PLL, you can also make an argument for sampling at 50SPS. if you know the phase of the 50Hz signal, you can choose to sample at the peaks of the waveform only. again, this relies on the 50Hz signal being 50Hz with no unmodeled components.

As a result, the question should be restated in a manner that gives some reason to sample the waveform -- eg, distortion and noise, etc... This would be included in the "wild waveform" comment above.

The RMS calculation is made easier if done using an integer number of samples per cycle, or if the calculation is done over a long period of time. This is because the RMS calculation over a partial sine wave will not be equal to the calculation over the entire wave. This will show up as a changing estimate of RMS. The error decreases as the number of cycles used increases. As shown in the example above, the sample rate is ideally chosen to contain an integer number of cycles.

for RAM purposes, there is no need to store the samples. you only need to store the sum of squares. That is, if you only want an estimate every N samples.
 
Exactly

The techique purposed above was only to ackquisition step.
Really to calculate RMS resultant value the least mean square procedure is recomended.

++++
 
Thanks for all the info. I have tried by taking 16 samples at 1248 microsecond intervals. M y idea now is to take 32 samples at 624 microsecond intervals. Not tested yet.
My problem now is how to cope with the slight frequency change that may occur in AC mains. What I do now is wait for the zero crossing and then taking 16 samples at exactly 1248(?) microseconds intervals. So if the AC is exactly @ 50hz it will sample the entire wave. But if the wave varies in frequency the sampling will not contain full data of the cycle in proper fashion. I am taking 16 or 32 samples for the convenience of calculations. So number of samples changing at runtime seems tough for me. What is the usual approach to tackle this situation?
Or how much will the error if the frequency varies somewhere between 47 and 53 hz? in the prsent sampling policy?

Thanks
 

...how much will the error if the frequency varies somewhere between 47 and 53 hz?...

It´s not your task worry about that.
Remember that RMS calculatios are performed based on integration of all entired squared values.

There is not mandatory define the sampling rate syncronized to measured waveform.
Like permute said, at a large period much grater than AC main, deviation error at calculed value close to be almost null.

+++
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top