## Conversion

# Five things you should know about RMS

**The Filter Wizard puts RMS under the spotlight and points out that there's a lot more to choosing and using RMS measurements (and the associated filtering) than you might think.**

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 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 powerRMS is better than Mean in a sampled system
- You can't filter successive RMS results to improve accuracy

**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 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 (analogue) 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 equal to the waveform period, a DC voltage equal to the RMS value delivers the same energy into a constant load as the signal itself does. But I'm getting ahead of myself here...

**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 period of the waveform. If it 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.

This 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 cutoff frequency of the lowpass filter, you get the same result as the strict averaging approach gives.

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 average value of the applied signal 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's possible, if not straightforward, to make an analogue filter whose impulse response approximates the box-car impulse response of an averager. But well see later that its infeasible to incorporate such filters into a conventional analogue RMS-to-DC converter design. Dang, Im 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 thats **never** exactly equal to the RMS value of any actual segment of the waveform. What weve 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 youll put such a converter. Well see that we can sometimes actually take advantage of this.

**3 RMS is not always about power**

RMS measurements are often associated with power. You frequently see the assertion (I already made it) that the RMS value of a waveform 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, its only true when a bunch of conditions are met. Sometimes they are not.

Heres an example. Suppose you have two 1 ohm resistors youre going to use as heaters in some experiment. When you apply 1 Volt across such a resistor, 1 Amp flows, and 1 Watt 1 Joule per second is dissipated. Lets apply that 1 Volt to each resistor in turn for 1 second at a time. In the space of 2 seconds, each resistor dissipates 1 Joule, and we shouldnt be surprised that the total power dissipated is just 1 Watt.

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

Lets calculate the RMS current in each of the cases. For the simple waveforms here, thats trivial. In the first case, the mean of the square of the current is obviously 1 Amp^2, so the RMS value is the obvious 1 Amp. In the second case, the mean of the squared current is (4*1+0*1)/2 = 2 Amp^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 value of the load 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) **doesnt 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 isnt 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.

**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 **absolute** value of the signal.

Rectifying an AC signal in the analogue 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 (well talk about those presently) tend to have premium pricing, and engineers of a miserly persuasion are often tempted to make home-brew average-responding circuits for less critical applications, especially when the signals applied are close to sinusoidal.

If youre 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) its tempting to stick to the absolute-value method, because this is a simple operation to apply to a signed digital representation of a signal. Its 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 youre in the digital domain, Id highly recommend that you use an RMS technique rather than an absolute value approach. Theres 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 round 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 its 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 harmonics of that signal, due to the abrupt discontinuity at the zero-crossing. Some of those 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 cant 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 absolute value of the carrier waveform. The mess of in-band tones that results makes 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 Ive tried it.

**5 You cant 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 components on the circuit board.

This approach has a flaw. Its mentioned in the datasheets almost in passing, as if it isnt a problem, but it is certainly something you should take into account. The problem is this: if there is any significant ripple on the output of the RMS converter chip, then **the DC value there is already wrong**. Applying a further lowpass filter doesnt change the (in)accuracy of the answer, it just removes some of the pesky ripple. But whats 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, its a **symptom** of another deeper problem for which a filter may **not** be the primary 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 analogue 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. Thats 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 doesnt need to manage very small analogue 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 can be increased way beyond any value that might limit your results. This 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 this 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.

Its not an either/or choice between analogue and digital approaches either. If youve been given a brief to design an RMS-measuring system that has good accuracy for signals from a milliHertz to a megaHertz, without using Cola-can-sized capacitors, you should consider a hybrid approach. Start with a good analogue-domain RMS-to-DC converter. Analog Devices and Linear Technology both have interesting parts, with distinctly different internal approaches to the implicit conversion paradigm. 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 dont worry; heres the Thing To Know about this situation: the **RMS value** of the output of this RMS converter is still correct! Dont 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. A PSoC3 would be a wonderful choice for this next stage, with its excellent delta-sigma ADC and fast arithmetic capabilities.

So what you have is a hybrid, two-stage converter. The first stage operates in the analogue domain; high frequencies get turned to DC while very low frequencies just come out looking like the absolute value of the input signal (thats obvious, right?). The second stage operates digitally, but doesnt have to sample very fast, since its only handling a mixture of DC and some low frequency ripple. Make sure that your ADCs frequency response doesnt significantly attenuate the ripple at any frequency where its important. Then, the second stage calculates the RMS value of the output of the first RMS converter, explicitly and with super-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 theres 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. Dont be Mean be Square! / Kendall

To view the Filter Wizard's archive of spells click here**Please login to post your comment - click here**

- No news

- IP hot spot forms in Egypt
- China buys Swedish MEMS foundry, builds fab
- EE Times Silicon 60: 2015's Startups to Watch
- Egypt's semiconductor cluster stronger than reported
- Knowles wins microphone slots in iPhone 6S
- Volkswagen has given engineering a black eye
- Let's make MEMS suppliers rich, says Huawei
- Not enough money in MEMS, own the data, says InvenSense CEO
- MEMS platforms are way to go, says Bosch's Finkbeiner
- Dialog to acquire Atmel for $4.6 billion
- ADI provides force touch controller in iPhone
- Peter Clarke's opinion compendium updated
- CEO interviews updated
- MEMS move to 300mm-diameter wafers
- TSMC discusses next MEMS, monolithic mics

- The Advantages of Capacitive vs Optical Encoders
- High Voltage CMOS Amplifier Enables High Impedance Sensing with a Single IC
- Engineering Change Order and Implementation
- Low Power Bi-directional Level Shifter
- Haptic advancements put us in touch with complex systems
- Programmable Dual Edge Triggered Clock Divider for Staggered Clock Generation
- New Linear Regulators Solve Old Problems