RMS measure of AC values (voltages/currents)
gio_rome
Posts: 48
Hello,
I have the need of measuring AC voltages, of course their RMS value. I have an MCP3208 ADC (so 50kHz) chip on the circuit. How do I sample it? Its library has got an average function, but that would be performed in only a part of the current's sine, giving a wrong result, since the current of course is common 50Hz current.
If I adc.in(#channel) I just read the present value...
Ideas? I know this must be old stuff...
I have the need of measuring AC voltages, of course their RMS value. I have an MCP3208 ADC (so 50kHz) chip on the circuit. How do I sample it? Its library has got an average function, but that would be performed in only a part of the current's sine, giving a wrong result, since the current of course is common 50Hz current.
If I adc.in(#channel) I just read the present value...
Ideas? I know this must be old stuff...
Comments
You just need to multiply your known measurment by the inverse of 1.414 to get the correct value or 0.707
The real trick is to calibrate your reading to the binary unsigned integer, and then to mutiply it by 1000 and to divide by 707 in order to avoid floating point decimal. I think that is correct, but I am sure someone will jump in if I got something wrong.
Are the signals single frequency sine waves? If so, the calculation Loopy mentioned will be sufficient. If the signal is more complex than that, "true RMS" calculations (which involved a bit more involved math) will be required.
That is not how True RMS is done.
The waveform is usually sliced into n pieces.
Then:
(Sum(Vx2)/n)0.5=VRMS
50KHz ought to allow enough samples for each measurement. Say 100 samples every 20mS, for 50Hz.
After the 100 samples do the math on the data array.
Or use an analog multiplier:
I like the AD633 analog multiplier and others that can do the squaring and running average of the signal input. Then periodically take a reading and square root it for your output
The square root function can be done with another AD633 or in software.
Good RMS measurements should have the ability to accommodate a high "Crest Factor" or have high peak voltages compared to the average voltage. A crest factor of 10 is usually sufficient for accurate results.
Of course if the waveform shape perfect, say square, sine, triangle, then just take the average and the appropriate multiplication factor.
But real wave shapes are rarely so clean.
Duane J
That kind of technique is, IIRC, used for RF signals of unknown waveshape - though today ADCs are getting
pretty nippy.
I expect the wave form to be decent, since it's coming from a plug in the house (eventually amplified/reduced). So it is a 50hz sine wave form. I understand that in the US power supply should be be in 60Hz fashion, but I live in Europe.
That said, I think I'll get say 100 samples every 20mS, and RMS'em. Or maybe it will be sufficent to get the biggest and multiply it by 1000/707.
Again, I don't want to/I can't operate on the circuit (it's rather a black box) and will perform software analysis.
What do you think?
tnx
Having an isolating transform involved as well would be wise. Of course, this all begins to get bulky.
And if you want to work interactively with your Propeller, use one of the versions of Forth on the Propeller to get real time results. Of course, there are Spin, PASM, and C to consider as well, but they offer a different approach to exploring.
http://www.te.com/en/brands/corcom.html