AC voltage measurement with 16F77


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: AC voltage measurement with 16F77

    The numbers are simply derived.

    First, if you are going to do a cycle by cycle RMS (virtually no one needs this, by the way), then you need to decide how much accuracy, at what crest factor you want.
    If you assume a crest factor not too far from 1, then to get an accuracy of 2%, then you would need to make certain that you always get a sample within 2% of the peak.
    The peak is far more important than the zero crossing when calculating RMS. The zero crossing is of low amplitude, and as such, contributes little to the final result.

    The sine of 78 and 102 degrees are both about .98 - within 2% of the peak value. 90-78 = 12 degrees. So you have to sample at least every 12 degrees of the waveform to make certain that you will sample at a time that is within 2% of a peak. That means 180/12 = 15 samples (my memory was a little off).

    If you don't need answers quickly, then you can simply take a large number of samples, square them, average them and take the square root. As long as you sample at a random interval (at least compared to the mains frequency), and take enough samples that you are guaranteed to get several very near the peaks, then your results will be accurate as long as the voltage wavform isn't changing very rapidly. Think about it. You can either take 100 samples on one cycle, or 100 samples at random on 100 cycles. Both will yield the same result. The only downside in doing it the second way is that you have to wait 100 cycles for the answer.

    Nyquist is operative only when you are trying to re-create a waveform, not when you are trying to measure it. We certainly don't care about aliasing when doing something so mundane as RMS.

    If the OP was building an MP3 player, my answer would be different.
    Charles Linquist

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: AC voltage measurement with 16F77

    Now that I have had some coffee, I would like to add a few comments and corrections to my earlier post.

    First, I realize that RMS isn't peak, and that the translation isn't 100%, since the RMS values are proportional to the sample values squared. An error of 1% at the peak translates to a larger error, since the error term is squared. Of course there are also errors on the rising and falling parts of the waveform as well, and they can be large (since the rate of change is higher than on the peaks), nonetheless, they contribute less to the overall value, since they are of lower amplitude.

    Also, I mentioned that the sine of the sine of both 78 and 102 degrees are within 2% of the peak (> .98). It is actually 79 and 101. But to get a sample in that range, you only have to sample every 101-79 = 22 degrees. That amounts to a little over 8 samples per half-cycle.

    Revisiting this issue has piqued my curiosity enough that I'm going to dig into it a bit more.
    Charles Linquist

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts