I really wanted to title this piece ‘Of RMS and the Mean I sing’. But wise editorial heads have told me more than once that quirky titles don’t draw people in, and that such mock erudition will alienate one’s readership. Now, I know much more about filters than I do about the works of George Bernard Shaw, so I finally dropped the wise-guy title and went with something that highlights the practical value of these five RMS-related nuggets:

- RMS is a specific property of a defined segment of signal
- Filtering is not the same thing as averaging
- RMS is not always about power
- RMS is better than Mean in a sampled system
- You can’t filter successive RMS results to improve accuracy

**Nugget 1 – RMS is a specific property of a defined segment of signal**

The ‘basic’ definition of RMS is well known. You **S**quare some data, find the **M**ean value, then take the square **R**oot. Hmmm, why didn’t they call it **SMR** rather than **RMS? **That’s just the RPN fan in me talking, I guess. I must be a fan, to have spent quite so much on a brand-new ‘Special Edition’ HP‑15 calculator. But I digress.

Anyway, what data should we be working with? When someone presents you with a BNC socket and says “What’s the RMS value of the signal coming out of that socket?”, you should respond: “I assume you mean: the RMS value of the signal between two points in time during your asking of that question.”

It’s not just a facetious response; the problem is that for any unknown signal, the RMS ‘value’ can only be defined if you give a start and stop time for the relevant segment of signal. If it’s a continuous-time (“analog”) signal, we calculate the time integral of the square of the signal between the start and stop times and divide that by the time duration, before taking the square root. For a sampled signal you really do just take the mean value of the squares of all the sample points, then take that square root.

If the signal is truly periodic, something rather nice happens when we set the measurement time equal to an integer multiple of the waveform’s period. We get a number that’s independent of the phase at which we start and stop the measurement. In other words, the RMS value of a periodic waveform is a characteristic constant for that waveform. This is often quite a useful short-cut in calculations; in a time-interval equal to the waveform period, a DC voltage equal to the RMS value delivers the same energy into a constant load as does the signal itself. But I’m getting ahead of myself here…

**Nugget 2 – Filtering is not the same thing as averaging**

A perfect “RMS responding” measurement device should produce a completely static output when fed with a periodic waveform. It should be independent of repetition frequency and the rate at which the measurement device’s output is sampled. In order to deliver this stable RMS value, the device needs to ascertain the waveform’s period. If the period isn’t known, can’t be determined, doesn’t exist, or is changing with time, a strict RMS measurement is simply not possible. But that doesn’t stop most voltmeters or RMS-to-DC converter ICs from giving you an answer. You need to be rather circumspect about the answer in this case; it’s rather ill-defined.

The ill definition is because RMS-to-DC converter ICs – which you’ll find at the front end of most “true RMS” voltmeters – replace the strict time-averaging process with a single-pole lowpass filter. Superficially, such filtering achieves a similar job to an averaging process, suppressing the variation of the squared-up signal and giving you a stable answer. And indeed, when run continuously on a periodic waveform, repeating at a frequency much higher than the lowpass filter’s cutoff frequency, you get the same result as with the strict averaging approach.

In fact, averaging is a very specific instance of lowpass filtering – and it happens to be the **only** form of filtering that actually gives the ‘correct’ answer for the applied signal’s average value between ‘now’ and ‘now minus the averaging time.’ Other lowpass filters can do a good job of smoothing a signal but will do a poor job of averaging it. It is possible, if not straightforward, to make an analog filter whose impulse response approximates the box-car impulse response of an averager. But we’ll see later that it’s infeasible to incorporate such filters into a conventional analog RMS-to-DC converter design. Dang, I’m doing the getting-ahead-of-myself thing again…

An RMS-to-DC converter IC equipped with regular single-pole lowpass filtering and fed with an aperiodic signal produces an output that’s **never** exactly equal to the RMS value of any actual waveform segment. What we’ve implemented instead is **RFS**, the square root of a **filtered** version of the square of the signal. The presence of this filtering – and the pathologies it could introduce – is what makes RMS a great subject for Filter Wizard scrutiny. Whether the pathologies are important or not does depend on the application to which you’ll put such a converter. We’ll see that we can sometimes actually take advantage of this situation.

**Nugget 3 – RMS is not always about power**

RMS measurements are often associated with power. You frequently see the assertion (I already made it) that a waveform’s RMS value is the value that, if applied to your load as a DC level, results in the same power dissipated in that load as is dissipated when you apply the signal itself. As with many assertions, the assertion is only true when a bunch of conditions are met. Sometimes they are not.

Here’s an example. Suppose you have two one-ohm resistors you’re going to use as heaters in some experiment. When you apply one Volt across such a resistor, one Amp flows, and one Watt – one Joule per second – is dissipated. Let’s apply that one Volt to each resistor in turn for one second at a time. In the space of two seconds, each resistor dissipates one Joule, and we shouldn’t be surprised that the total power dissipated is just one Watt.

Now let’s connect the two resistors in parallel, and apply one Volt for one second, then switch the voltage off for one second. In the first second, each resistor throws out one Joule; in the second second, no energy is dissipated. Total energy is two Joules in two seconds, still one Watt. This is so obvious that I’m almost apologetic for spending two paragraphs on it.

Let’s calculate the RMS current in each of the cases. For the simple waveforms here, that’s trivial. In the first case, the mean of the square of the current is obviously 1A^{2}, so the RMS value is the obvious 1 Amp. In the second case, the mean of the squared current is (4 x 1 + 0 x 1)/2 = 2A^{2}, so the RMS current is 1.4142 Amp. Eh? How can the RMS current be different, when we clearly dissipated the same energy over the experiment period in each case? I thought same RMS meant same power?

The answer is that **we did not keep the load value constant**. The learning point from this is that the relationship between the RMS value of a current or voltage and the power dissipated in a system only applies when the constant of proportionality between voltage and current (OK, a pedantic way of saying ‘resistance’) **doesn’t change over the measurement period**. In many real-world situations – the connected load on the electricity supply in your house, or the real part of the impedance seen by your cellphone antenna – this constancy isn’t true. To measure power in such cases, you need to know both the current and voltage simultaneously and integrate their product to get energy. Under these circumstances, RMS measurements of just one parameter will be misleading.

**Nugget 4 – RMS is better than Mean in a sampled system**

About the most common way of producing a DC level that corresponds to the amplitude of an AC signal is to rectify the signal and then filter off the high frequency junk to leave the DC component, proportional to the amplitude. AC voltmeters that work this way have been around since the dawn of the electronic age, and are usually called “average‑responding,” though of course they respond to the average of the signal’s **absolute** value.

Rectifying an AC signal in the analog domain is a standard electronic technique, and the performance impact of circuit imperfections (such as amplifier bandwidth) is well understood. Dedicated RMC-to-DC converter ICs (we’ll talk about those presently) tend to have premium pricing, and engineers of a miserly persuasion (that’s pretty much all of us) are often tempted to make home-brew average-responding circuits for less critical applications, especially when the signals applied are close to sinusoidal.

If you’re doing the calculations in the digital domain after having sampled your signal (this presumes that your input signal is in a frequency range that permits conversion to digital) it’s tempting to stick to the absolute-value method, because this is a simple operation to apply to a signed digital representation of a signal. It’s also attractive because no extension of internal precision is required. The absolute value of a signed 16-bit sample is a 16-bit number, while the square of that sample requires 32 bits for its representation.

However, once you’re in the digital domain, I’d highly recommend that you use an RMS technique rather than an absolute value approach. There’s a simple reason for this. Both absolute-value and squaring are non-linear operations. When applied to sampled signals, such operations will result in the generation of additional frequencies that will alias if at greater than half the sample rate. Of the two methods, squaring is a benign and predictable operation; only the second harmonic is generated and it’s easy to keep track of this. Sampling at four times the highest signal frequency is guaranteed to prevent any unexpected tonal component caused by a second harmonic from landing back in your data set, even before you apply your junk-reducing filter. This is particularly relevant if the amplitude measurement, after filtering, represents an interesting signal such as audio.

In contrast, taking the absolute value of a signal creates an unbounded sequence of signal harmonics, due to the abrupt discontinuity at the zero-crossing. Some of those harmonics will invariably end up back in the wanted frequency range after aliasing, however low the input frequency. Under some circumstances, these aliases can be so low in frequency that they will actually appear as a ripple on the measurement that can’t be eliminated by the usual smoothing filter. This is immediately apparent if you try to make a digital AM demodulator to recover audio from a sampled version of an amplitude-modulated carrier by filtering the carrier waveform’s absolute value. The mess of in-band tones that results can make it unusable. Squaring the input signal, filtering off the resultant second harmonic of the carrier and taking the square root of the result gives clean audio reproduction – I’ve done it in a real product.

**Nugget 5 – You can’t filter successive RMS results to improve** **accuracy**

When you read the datasheets for RMS-to-DC converter ICs, they discuss the use of post-filters to reduce the level of the output ripple that you get when the input frequency is low enough to ‘peep through’ the filtering process used internally. Adding an extra pole or two at the output means that you can reject these unwanted frequencies with circuitry based on much lower capacitor values – the high-value tantalum capacitors required to achieve good low frequency response are often the bulkiest, largest, shortest-life components on the circuit board.

This approach has a flaw. It’s mentioned in the datasheets almost in passing, as if it isn’t a problem, but it is certainly something you should take into account. The problem is this: if there is any significant ripple on the RMS converter chip’s output, then **the DC value there is already wrong**. Applying a further lowpass filter doesn’t change the (in)accuracy of the answer, it just removes some of the pesky ripple. But what’s the point of getting a more stable version of the wrong answer? When lecturing on the use of filters, I use this as an example of a case where the AC signal present is **not** a problem to fix with a filter, it’s a **symptom** of another, deeper problem for which a filter may **not** be the correct solution.

The proper solution to the problem is to use better filtering **within the RMS converter core itself** – but this is essentially not possible with the standard architecture used in standard RMS-to-DC converter ICs. That architecture is a brilliant invention called implicit RMS conversion, and it solves the dynamic range problem that would otherwise make analog computation of RMS over a wide dynamic range infeasible. This problem is that if you only have a small input signal (relative to the largest one that you want to work with), then squaring its magnitude makes it even smaller. Handling a dynamic range of 90 dB at the input would require a span of 180 dB for the squared signal. That’s not possible from any practical electronic circuit. Implicit RMS conversion neatly avoids actually having to square the signal (done, predictably enough, in the explicit method) and so it doesn’t need to manage very small analog levels.

However, the implicit method is a feedback system, and the filtering process that cleans off the high frequency residual is within this feedback loop. Formal feedback rules apply, for any small signal excitation around the stable operating point, and so the filter needs to have a transfer function that you can wrap a feedback loop around. That essentially limits you to a first order filter in any practical circuit.

If you use a digital implementation, sampling with an ADC and squaring the result, your dynamic range is limited only by the precision of the arithmetic you care to use, and this precision can be increased way beyond any value that might limit your results. This broad range means that the explicit method – square the signal, perform your chosen averaging or filtering, then take the square root – is the preferred way to go in the digital domain. And using the explicit method means that you can apply whatever filter you want. Fast-settling, high rejection filter approaches fit right in here, and you can get rid of all your ripple in the squared domain before finally taking the square root of that now-stable answer.

It’s not an either/or choice between analog and digital approaches either. If you’ve been given a brief to design an RMS-measuring system that has good accuracy for signals from milliHertz to megaHertz, without using Cola-can-sized capacitors, you should consider a hybrid approach. Start with a good analog-domain RMS-to-DC converter. For physically reasonable averaging capacitor sizes, there will be a lower limiting frequency below which the output ripple will be an increasing factor, and inconvenient for you if you want a rock-stable answer. But don’t worry; here’s the Thing-To-Know about this situation: the **RMS value** of this RMS converter’s output is still correct! Don’t make the mistake of trying to filter off the ripple; just feed the entire signal into the input of **another RMS converter** – this time, a digital one. Any microcontroller with a decent ADC will work.

So, what you’ll have is a hybrid, two-stage converter. The first stage operates in the analog domain; high frequencies get “turned to DC” while very low frequencies just come out looking like the input signal’s absolute value (that’s obvious, right?). The second stage operates digitally, but doesn’t have to sample very fast, since it’s only handling a mixture of DC and some low frequency ripple. Make sure that your ADC’s frequency response doesn’t significantly attenuate the ripple at any frequency where it’s important. Then, the second stage calculates the RMS value of the output of the first RMS converter, explicitly and with fast-response digital filtering, and the result is the overall answer you wanted. Small, cheap and accurate – what more do you want, boss?

I hope this has shown you that there’s a lot more to choosing and using RMS measurements (and the associated filtering) than might meet the uncritical eye. Try some of these techniques out and tell me how you get on. Don’t be Mean – be Square! / Kendall

Pingback: From the trade magazines: On-off keying gets the job done, what you should know about RMS and communications electronic - KB6NU's Ham Radio Blog