Shop OBEX P1 Docs P2 Docs Learn Events
RMS measure of AC values (voltages/currents) — Parallax Forums

RMS measure of AC values (voltages/currents)

gio_romegio_rome Posts: 48
edited 2014-01-23 01:58 in Propeller 1
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...

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-01-22 08:39
    Well, the actual peak to peak AC voltages are 1.414 times higher than the RMS value. 1.414 represents the square root of 2.

    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.
  • davejamesdavejames Posts: 4,047
    edited 2014-01-22 08:46
    gio_rome,

    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.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2014-01-22 09:14
    Hi Loopy;

    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
  • User NameUser Name Posts: 1,451
    edited 2014-01-22 15:44
    IIRC, the HP 3403 that used to sit on my workbench measured true RMS voltage by passing the buffered signal through a tiny precision resistor and then measuring the resistor's temperature with an equally tiny thermocouple. :)
  • Mark_TMark_T Posts: 1,981
    edited 2014-01-22 16:58
    User Name wrote: »
    IIRC, the HP 3403 that used to sit on my workbench measured true RMS voltage by passing the buffered signal through a tiny precision resistor and then measuring the resistor's temperature with an equally tiny thermocouple. :)

    That kind of technique is, IIRC, used for RF signals of unknown waveshape - though today ADCs are getting
    pretty nippy.
  • gio_romegio_rome Posts: 48
    edited 2014-01-23 00:21
    Duane, Loopy,

    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
  • Heater.Heater. Posts: 21,230
    edited 2014-01-23 01:04
    Depending on the accuracy you require I might not rely on the mains power being a nice sine wave. I have seen all kinds of spikes and junk on mains power.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-01-23 01:58
    I was thinking a main's spike filter such as the old Corcom devices, a full bridge rectifier, and a band of filtering capactitors would sort out spike and noise problems. Maybe just the Corcom and full bridge rectifier alone. One can eliminate half the AC signal and not have to deal with other means to measure true peak to peak.

    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


Sign In or Register to comment.