Searching \ for 'R.M.S. on pic' in subject line. () Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'R.M.S. on pic'.

Truncated match.
'R.M.S. on pic'
1998\03\21@043202 by  Hi All!

I want to get the r.m.s value of a
sinewave with the pic16c71 a/d.
Can someone tell me how i can do this
Pseudo code will be fine.

Thanks.

Zack
)|(
(o o)
-----ooO--(_)--Ooo----

zc intekom.co.za
or
spazzman iname.com

There is no justice.
There is just us.  A.    If you are SURE that the signal is  a pure sine wave
then

Vrms = Vpeak x 0.7071

B.    If the waveform is not a single pure sine wave (eg it
is of unknown waveform or it is a mixture of pure sine waves
of different frequencies) then the above ratio does not
work. You're gonna be sorry. The following is simple enough
with a spreadsheet but a little taxing for a PIC (use of a
high level language makes it easy again).

In this case the following is required.

1.    Determine the highest frequency component present.
(This may be from a knowledge of the signal source or
because you have filtered the signal with a known cutoff
frequency low pass filter).
2.    Take samples at a rate at AT LEAST twice as fast as
the highest frequency present. eg - if a 1 KHz component is
present then sample at more than 2 KHz - probably 3 to 4 if
practical (The faster the better within reason)
3.    Take samples for at least the period of the lowest
frequency present. (This may not be possible in practice due
to some very low frequency components - the results will be
somewhat incorrect - by how much depends on the magnitude of
4.    Square the value of each of the samples and sum the
results.
5.    Divide the results by the number of samples.
6.    Take the square root of the answer in 5.
This is the RMS value.

Max potential frequency component is 1 KHz.
Min important component is 250 Hz.
Sample therefore at 3KHz or more (2+ x 1KHz)
Sample for at least one cycle of 250 Hz.
Therefore minimum samples = 2 x 3000/250 = 24
A series of 24 values of a unity amplitude sine wave plus a
500 Hz unity amplitude sine wave with 60 degrees phase
The resultant RMS value is 1 despite the apparently strange
data. This is thenresult of adding 2 equal amplitude pure
sine waves. (Either alone has an RMS value of 0.7071.
Together the have twice the power (eg across a resistor). As
power is proportional to V^2 the RMS voltage will increase b
y sqrt(2) when they are combined.
Please excuse jittery table - must find out how to import
Excel without doing this.

Amplitude         Square
0.866025354     0.749999914
1.258819021     1.584625328
1.36602546         1.866025557
1.207106943     1.457107172
0.866025651    0.750000429
0.465926094        0.217087125
0.133974794       0.017949246
-0.034074129     0.001161046
-1.48545E-07     2.20656E-14
0.207106467     0.042893089
0.49999962     0.24999962
0.758818751     0.575805896
0.866025354     0.749999914
0.741181266     0.549349669
0.3660261         0.133975106
-0.20710579     0.042892808
-0.866024314     0.749998113
-1.465924903     2.14893582
-1.866024909     3.48204896
-1.965925948     3.864864833
-1.7320516         3.000002744
-1.207108135     1.45711005
-0.50000166     0.25000166
0.241179333     0.058167471

Sum of squares      24.
Mean squared term = Sum/24
Square root of mean sum = 1
Therefore RMS value = 1

C.    You can get ic's which provide the RMS value of a
waveform (part # escapes my memory but analog devices do
one). You may wish to use one of these and measure the
_______________________________
|
|
| - Quantum Mechanics
|   The Dreams that Stuff are made of.
|
| -  All models are wrong -
|   some models are useful.
| _______________________________|

{Original Message removed}  Hi All!

Thank you Russel it was exactly what i
was looking for!

Zack
)|(
(o o)
-----ooO--(_)--Ooo----

spazzman iname.com

There is no justice.
There is just us.

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...