# RMS Measurement

On infrequent occasions, I am asked to design a circuit to measure the RMS value of a current or voltage for some kind of power measurement. Since the work I do is hardly unique, I thought some of you may like to hear about some of the options.

There are several techniques to measure the instantaneous values of AC voltage or current. For the voltage, you could measure it directly (taking great care if it is high voltage), through a voltage transformer, or with an isolation amplifier like the Avago ACPL-C870.

For current, you can measure it by passing it through a resistor and measuring the voltage drop across it, you can use a Hall-Effect transducer like the Allegro ACS714, or you could use a current transformer.

What is an RMS voltage or current? The RMS measurement is meant to indicate that the heating effect of the AC voltage (or current) is the same as the heating effect produced by the equivalent DC voltage (or current). There is a concept of RMS power, but it is purely a mathematical exercise and does not have a practical application. There is a passionate discourse on the topic here.

It is often easier to measure average values as opposed to RMS values, so what is the difference? If you have regular sinusoidal waveforms, the two are related by a constant factor, and you can use the average and scale to RMS, but as the waveform deviates away from a sine or square wave, the relationship changes and is non-linear to boot. The RMS is the effective value and so of the two, is the meaningful measurement.

You may have seen the term “Crest Factor” (CF) used when talking about AC waveforms. Sometimes a source is not sinusoidal — consider a stepped quasi AC waveform produced by an Uninterruptable Power Supply. Many times a load will affect the waveform produced from a source by introducing voltage transients or spikes. The CF is a measure of the peak to the RMS value. This peak places additional demands on the power supply and so the CF is used to scale the RMS value so that the power supply can be uprated to provide sufficient power.

Now, how can we accurately measure RMS values? There are dedicated integrated circuits, and some of them have been around for so long, they were made when manufacturers still made second-sourced devices. I have used the venerable AD736 from Analog Devices with great success. There are several other ICs from Analog Devices and from Maxim that use the same approach. The advantage of these parts is that they have the ability to measure signals with a moderate CF, and, of course, have no need for microprocessor or microcontroller (MCU) support.

One approach to RMS conversion: an RMS converter board based on the AD736.

Aside from the disadvantage of additional hardware (and the not insignificant cost of these devices), you typically have to condition your signal to match the IC's input limitations, rather than modify its input to meet your signal. In other words, it has a fixed input and you have to scale your detected signal to this input. Also, its response time can be hundreds of milliseconds since the ripple is smoothed by fairly large capacitors needed at 50 or 60Hz. And just one more little detail: It requires a bipolar voltage supply.

There are newer devices like Linear Technologies LTC1966 that appear to have improved the approach. I have not personally used this device, so I cannot comment on it.

Unless you are creating a completely analog design with a 4-20mA loop on the back end or a limit detector, you are going to need to convert the signal from a dedicated RMS converter via an ADC. This would offload the AC measurement from the MCU — it would simply be measuring a proportional DC voltage. However, if you do use an MCU to measure the instantaneous AC voltage directly, you can use it to do the RMS calculation as well. (Thinking out loud here, I wonder if the analog circuitry of the PSoC can be tailored to make the RMS measurement? I will put it on my to-do list.)

Another approach to RMS conversion: a converter board based on a PSoC MCU. Both products had about the same features. There is a slight (although not significant) difference in board area.

The disadvantage is that if you have a very narrow spike you may miss it entirely if your conversion sampling is not fast enough. Obviously, the calculations involving the square root can be computationally intensive and challenging for a small micro, but it does allow you to measure the RMS signal within one cycle. I have worked on several projects where the decision based on the current had to be made within 2-3 AC cycles, even if the speedy response sometimes made no sense at all.

In several of the projects where I have used the micro approach, I decided to measure the AC waveform from zero-crossing to the second zero crossing after that so that I had a full cycle. Then I would do the mathematics in the half cycle between this second zero-crossing and the next one with the opposite sense. My program followed this sequence:

1. Initiate a variable representing the sum of squares and wait for the zero cross
2. Synchronise the ADC conversion timer to start the conversion with as many reading as practical given the need to read each conversion and some minor processing
3. At each complete conversion, the ADC reading is taken and squared and added to a running total of the squares. A record of the number of readings is also incremented. Catering for a variable number of readings means that you can work with different input frequencies allowing an automatic adjustment from 50 to 60Hz
4. When the second zero crossing is detected, the conversions are suspended and the RMS value can be calculated. First, using the sum of squares that has been accumulated and the number of readings, it is possible to calculate the mean (sum_of_squares/number_of_readings), and then the square root is calculated using the bisection method (see reference in the next paragraph). This is the RMS value.

The best explanation on how to calculate the square root with limited resources was an article entitled “Rooting Around” by Michael Dvorsky in the February 2006 edition of Circuit Cellar. According to the article, the fastest implementation of this approach is when you have access to a hardware multiplier, which, fortunately, I did.

Sometimes, the above approaches are not sufficient. A unique approach was suggested by Jim Williams where the current is converted to heat through a thermistor, and then the resultant resistance changed is measured. Refer to Linear Technology's Application Note 5, “Thermal Techniques in Measurement and Control Circuitry.” See the section entitled “50MHz Bandwidth Thermal RMS [to] DC Converter” starting on page 4.

My thanks to Curt Carpenter whose “Do You Do the Math?” (on the former Microcontroller Central site) provided the inspiration for this blog.

Have you ever needed to calculate RMS values?

## 12 comments on “RMS Measurement”

1. SunitaT
August 24, 2013

It is also possible to calculate the RMS power of a signal. By analogy with RMS voltage and RMS current, RMS power is the square root of the mean of the square of the power over some specified time period. This quantity, which would be expressed in units of watts (RMS), has no physical significance. However, the term “RMS power” is sometimes used in the audio industry as a synonym for “mean power” or “average power”.

2. eafpres
August 25, 2013

@Aubrey–interesting blog.  Considering the thermistor design, I wonder if it would be possible to design an RMS measuring circuit using a resistor and two thermoelectric devices.  If you needed to condition the signal then a voltage divider might be needed.  The reason to do it would be if it was more linear or more accurate.  I can put that on a long list of things to work out in my spare time.

3. antedeluvian2
August 26, 2013

eafpres

Considering the thermistor design, I wonder if it would be possible to design an RMS measuring circuit using a resistor and two thermoelectric devices.

The concept does raise a bunch of ideas on how to tackle the measurement. Years ago I came a across a National Semi app note (which was even older) by Bob Pease where he had some other idea on measuring RMS. At the time I dismissed it as impractical in a production product and I wasn't even sure if Mr Pease wasn't talking with a little tongue in his cheek. I tried to find it for this blog, but without luck. Perhaps someone else remembers the app note?

4. samicksha
August 27, 2013

I am sure we are considering the fact that it is used for temperature measurement, to compensate for temperature variations in a circuit.

5. Tim W
August 28, 2013

The app which I remember used a resistor thermally coupled to a transistor which was one half of a current mirror.  Another aspect of the thermal approach is to consider the history of RF power meters – they were THERMISTOR based.

My favorite wideband approach was Jim Williams' development of the LT1088 RMS -DC conversion.  Find it in app note AN22. ( http://cds.linear.com/docs/en/application-note/an22.pdf)

6. ncallen
August 28, 2013

Better yet…..sense voltage and current (instantaneous), multiply, filter.  Gives you real power, regardless of load variations and reactive loading.

7. antedeluvian2
August 28, 2013

Tim

My favorite wideband approach was Jim Williams' development of the LT1088 RMS -DC conversion.  Find it in app note AN22.

It is a very interesting document. Thanks for the pointer

8. Work to Ride comma Ride to Work
August 28, 2013

I was very happy with the results I received when I used the AD8436.  I implemented it with capacitive coupling and a single supply rail.  I was using it to measure 115 VAC at 400 Hz for monitoring the voltage of three-phase aircraft power.  Careful selection of the averaging capacitor and output filtering capacitor can make for a fast response.  Certainly more than fast enough for humans to monitor.  I did use a tiny board mount transformer to scale down the voltage but more for isolation safety concerns than anything else.  Otherwise a plain old voltage divider would have worked just fine.

I might be a little circumspect about using them for fault isolation if you needed something that would react in half-cycle.

I also used the same device to monitor current on a high voltage (>1kV) by using a small board mount wideband current transformer and an appropriate burden resistor.  That worked well too.  (I know, the power guys will snicker if you call 1kV high voltage.  🙂

9. antedeluvian2
August 28, 2013

WtR,RtW

I did use a tiny board mount transformer to scale down the voltage but more for isolation safety concerns than anything else.

You are right- isolation concerns are very important. The circuit in Figure 1 used an external current transformer B5303 from Bicron. Figure 2 used the Allegro ACS712 hall effect device. Of course the frequency reponse of these devices limit the universality of any design. For better or worse my designs almost always revolve around 50/60Hz.

10. Doug21201
August 28, 2013

Aha! The LT1088. There is a story behind that product involving more than a little JIm WIlliams mischief…chekc my blog…I'll write it up and post it there.

11. jkvasan
August 29, 2013

Aubrey,

We designed a display unit to measure 3- phase RMS values of input and output voltage values of an UPS. We used similar technique used in the blog. Our MCU was R8C 25 which has a hardware multiplier.

12. David Maciel Silva
August 31, 2013

My experience with good current measurement is to use a shunt amplifying the voltage as a function of the current that was flowing over it. I used a comparator circuit to detect the level of tension that needed … It worked, but the accuracy was not very good, since the signal varied. much.

I've used also cis ACS Allegro, a good perfomace but requires some external components, and a more precise calculations and use the microcontroller.

Microchip offers very interesting material on medidore energy: