# 220V AC Measurement With RMS To DC Converter

#### mcmsat13

##### Member level 5
Hello house! As a part of learning new things everyday in life, electronics is not left out. Everyday I see that electronics has many ways of getting one result with many different means.
For example my city grid if 220VAC nominal, Can I use these RMS to DC converter chips to really measure the input AC Voltage just as in AC Digital Voltmeter(1602 LCD) with Arduino?

Please I really need to confirm this

#### scopeprobe

##### Member level 3
The chips will measure AC voltage but you have to provide voltage levels suitable for the IC to measure by attenuating your source. Also as your talking High Voltage AC and Arduino you would certainly require ISOLATION in your mains circuit or you would be kissing your Arduino, Computer and anything else goodbye. Best way to experiment with AC would be to use a step down tranformer to give you low voltage AC and then experiment with the IC's from there, if you know the turns ratio you can calculated the input mains from the measured low voltage. Its not precision but for learning its perfect..

#### mcmsat13

##### Member level 5
The chips will measure AC voltage but you have to provide voltage levels suitable for the IC to measure by attenuating your source. Also as your talking High Voltage AC and Arduino you would certainly require ISOLATION in your mains circuit or you would be kissing your Arduino, Computer and anything else goodbye. Best way to experiment with AC would be to use a step down tranformer to give you low voltage AC and then experiment with the IC's from there, if you know the turns ratio you can calculated the input mains from the measured low voltage. Its not precision but for learning its perfect..
Talking of isolation, for ages people have been using resistive isolation with high value resistors and Op Amp for measuring high AC voltage with Arduino.
I know many safe ways to handle the high voltage AC voltage which is priority whenever one is dealing with such high voltage.
Here, what I need most here is whether I can use these RMS to DC Converter Chips to do the job?
If this can do this, I really love to use any of them.
Please I need help on how it will be interfaced to Arduino.

#### KlausST

##### Super Moderator
Staff member
Hi,

For sure they can measure AC voltage. Didn't you read the datasheet?
And the manufacturer provides additional informations like application notes and design notes, and also evaluation boards and videos.

Klaus

You don't necessarily need isolation. High ohmic with the use of suitable resistors is good enough ... and safe.
Like the voltage testers in form of a screwdriver .. they need some current to work and this current will go through the human body.

#### scopeprobe

##### Member level 3
Talking of isolation, for ages people have been using resistive isolation with high value resistors and Op Amp for measuring high AC voltage with Arduino.
I know many safe ways to handle the high voltage AC voltage which is priority whenever one is dealing with such high voltage.
Here, what I need most here is whether I can use these RMS to DC Converter Chips to do the job?
If this can do this, I really love to use any of them.
Please I need help on how it will be interfaced to Arduino.

I'll leave it for those people to let you know what they did as i haven't done it, i'm just saying a misplaced probe or scope lead will likely let the genie out of your Arduino or PC if you don't know what your doing. You can remove most of this risk by using a few /££ off the shelf transformer which seems a no brainer.

Assuming you put in the correct input the IC will give you the correct output which you can connect to the Analogue input. Checkout the Arduino forums as i'm sure there will be similar questions there.

#### mcmsat13

##### Member level 5
Please I will appreciate any help on this. I will welcome a private massage if need be. I don't know how I can do this. I have used ZMPT101 and Voltage dividers and op amp to experiment on AC, they are working the way they could but I was surprised when I found out these RMS to DC Converters.

#### scopeprobe

##### Member level 3
Please I will appreciate any help on this. I will welcome a private massage if need be. I don't know how I can do this. I have used ZMPT101 and Voltage dividers and op amp to experiment on AC, they are working the way they could but I was surprised when I found out these RMS to DC Converters.

Voltage dividers are fine when all equipment is referenced to the same ground but when you interconnecting equipment which bridges various supplies it can cause issues. I can't really offer help on the design as your spec is very loose but i'm assuming all your trying to do is measure RMS volts to learn. My advice would be to get a transformer to get the mains from 230V to something like 6V such as https://www.farnell.com/datasheets/92171.pdf this will provide attenuation of to 2.6% of mains voltage such that its a safe level for you to play with and also protect your other equipement if you clips scopes on etc.

With 6 V off the transformer the recommended values on the datasheet can be tweaked to give you your operating range with 6V inut but it will ensure its safer for you and your equipment. The rest is just powering the IC and feeding it into your A/D converter. You could also use a 1:1 isolation transformer and use the datasheet values, less safe but possible also.

#### Attachments

• RMS.png
50.3 KB · Views: 26
Last edited:

#### KlausST

##### Super Moderator
Staff member
Hi,

I've used RMS-to-DC converters before. But if you are able to write a little interrupt driven software to run the ADC and do some calculations, then you get better performance while beeing much cheaper.
I've done 7 channels true RMS with one AVR and simple R and C input circuit.
And all this as a side job for the AVR. A high quality and high reliability industial measurement tool.

Currently I see no reason to use an RMS-to-DC converter anymore .... when a microcontroller is involved.
An RMS to DC converter easily costs more than 5 times of a simple AVR, PIC...

Klaus

#### mcmsat13

##### Member level 5
Hi,

I've used RMS-to-DC converters before. But if you are able to write a little interrupt driven software to run the ADC and do some calculations, then you get better performance while beeing much cheaper.
I've done 7 channels true RMS with one AVR and simple R and C input circuit.
And all this as a side job for the AVR. A high quality and high reliability industial measurement tool.

Currently I see no reason to use an RMS-to-DC converter anymore .... when a microcontroller is involved.
An RMS to DC converter easily costs more than 5 times of a simple AVR, PIC...

Klaus
Ok, I want to know for example how fast reading 9 channels with these ICs will be. That's measuring 3 sources of 3-phase AC voltage. All the lines of the 3 sources will be monitored by one ADC pic of my MCU, PIC or AVR . The MCU needs to take a decision based on the voltage levels of the all 9 ADCs. Using something like ZMPT101B, the high sample time is the problem. The high sample time causes some delays in the loop which is not appropriate in the application.
For example if an LED is attached to a digital pin instructed to go off when all the 3 lines of Source1 goes below/above a defined threshold the LED will delay some milliseconds before it goes off! In the application, the delay is not acceptable because Source2 needs to be snapped in without interrupting the supply to the load. The little I understand about the RMS to DC converter is the most things done in the software is already done in itself. It's not about their cost I consider now but effectiveness. Thanks.
--- Updated ---

Voltage dividers are fine when all equipment is referenced to the same ground but when you interconnecting equipment which bridges various supplies it can cause issues. I can't really offer help on the design as your spec is very loose but i'm assuming all your trying to do is measure RMS volts to learn. My advice would be to get a transformer to get the mains from 230V to something like 6V such as https://www.farnell.com/datasheets/92171.pdf this will provide attenuation of to 2.6% of mains voltage such that its a safe level for you to play with and also protect your other equipement if you clips scopes on etc.

With 6 V off the transformer the recommended values on the datasheet can be tweaked to give you your operating range with 6V inut but it will ensure its safer for you and your equipment. The rest is just powering the IC and feeding it into your A/D converter. You could also use a 1:1 isolation transformer and use the datasheet values, less safe but possible also.
Ok I have encapsulated 220V to 6V transformers.
Please can you help me with a snippet of a formula I will use in software to realize the value of Vin? For example LTC1968 has 1V and AD736 is 200mV

Last edited:

#### KlausST

##### Super Moderator
Staff member
Hi,
Ok, I want to know for example how fast reading 9 channels with these ICs will be.
* How fast:
Nyquist rule says: more than twice of the signal frequency of interest.
In my case it was sinusoidal mains frequency. Thus I did not care about overtones and mains frequency range is 49.95Hz ... 50.05 Hz .
Thus continous sampling with 150Hz is sufficient to get an almost perfect value. Error far below 1%.
Mind: the more distorted the signal is, the higher the error. The higher the frequencies differ (signal_frequency; sampling_freqyency/3) the higher the output ripple.
While 150Hz is the lower limit, you are free to use a higher sampling frequency.

An AVR may use a sampling rate of something below 10kHz (if I'm not mistaken). Thus you can use about 1kHz / channel. This is the upper limit for continous sampling without using downsampling techniques (which I will discuss on request only).

Another parameter to consider is: how often do you need the RMS value to be updated?
If you want to show the values on a display you maybe need an update 2-3 times per second.
If you just want to monitor mains voltage, then an update every 15 minutes is sufficient.
But if you want to build a regulation loop, then maybe you want an update every 20ms (mains period).
A low end example: use 150Hz sampling frequency and multiplex the 9 inputs ... you still get an update every 9x20ms = 180ms.
Reminder: still this is only true for undistorted sine with known frequency.

Now you say 9 channels. Wow a lot of cost for the RMS converters, because I doubt you can use a single RMS converter with a MUX in front of it.
The RMS converters use a capacitor for ripple suppression, thus the input to output delay is big...easily a tau of more than 1s. So you need to wait maybe 3..5 tau to get a useful output value.
MUX in front or not ... the delay exists ... and bad thing for a regulation loop: it is not constant, because after the capacitor there is the square root.
This makes changes in low voltage more slow than changes in high voltage. So if you use the RMS converters in a regulation loop you need to make it slow to maintain stability.

So not only cost, but also delay time, low ripple ... made me choose the MCU solution.

It sounds difficult, I know.
So one may think: let's go the simpler (but expensive) solution with the RMS converter. A valid choice. But still I recommend to define the applications requirements very detailled ... and design your system properly.....not to get surprised afterwards.

I mentioned AVR before... If I had to do the same now, I'd choose an STM32F1xx because of:
* higher sampling rate (even synchronous/parallel sampling)
* the better sampling rate control (no need for entering an ISR every time you trigger a conversion)
* the DMA feature (again no ISR for every sample)
* the wider databus (16 / 32 bit instead of 8 bit)
* the overall higher processing power

Note: AVR and STM32 are just the families I'm experienced with. For sure there are other - maybe even more - suitable MCUs. (Like DSPs)

Klaus

mcmsat13

### mcmsat13

Points: 2

#### scopeprobe

##### Member level 3
Ok, I want to know for example how fast reading 9 channels with these ICs will be. That's measuring 3 sources of 3-phase AC voltage. All the lines of the 3 sources will be monitored by one ADC pic of my MCU, PIC or AVR . The MCU needs to take a decision based on the voltage levels of the all 9 ADCs. Using something like ZMPT101B, the high sample time is the problem. The high sample time causes some delays in the loop which is not appropriate in the application.
For example if an LED is attached to a digital pin instructed to go off when all the 3 lines of Source1 goes below/above a defined threshold the LED will delay some milliseconds before it goes off! In the application, the delay is not acceptable because Source2 needs to be snapped in without interrupting the supply to the load. The little I understand about the RMS to DC converter is the most things done in the software is already done in itself. It's not about their cost I consider now but effectiveness. Thanks.
--- Updated ---

Ok I have encapsulated 220V to 6V transformers.
Please can you help me with a snippet of a formula I will use in software to realize the value of Vin? For example LTC1968 has 1V and AD736 is 200mV
--- Updated ---

That would be a voltage divider https://www.digikey.co.uk/en/resources/conversion-calculators/conversion-calculator-voltage-divider

#### Attachments

• divider.png
204.6 KB · Views: 21

#### mtwieg

Ok, I want to know for example how fast reading 9 channels with these ICs will be. That's measuring 3 sources of 3-phase AC voltage. All the lines of the 3 sources will be monitored by one ADC pic of my MCU, PIC or AVR . The MCU needs to take a decision based on the voltage levels of the all 9 ADCs. Using something like ZMPT101B, the high sample time is the problem. The high sample time causes some delays in the loop which is not appropriate in the application.
For example if an LED is attached to a digital pin instructed to go off when all the 3 lines of Source1 goes below/above a defined threshold the LED will delay some milliseconds before it goes off! In the application, the delay is not acceptable because Source2 needs to be snapped in without interrupting the supply to the load. The little I understand about the RMS to DC converter is the most things done in the software is already done in itself. It's not about their cost I consider now but effectiveness. Thanks.
RMS measurement of AC signals inherently involves lowpass filtering and delays. It takes many cycles for an RMS measurement to settle. For 50/60Hz input, expect at least 100ms for a decent measurement, regardless of whether you use a MCU or a RMS-to-DC chip.

However, if your sources are three phase, then why even bother with RMS measurement? The magic of three phase power is that the power it delivers is perfectly constant (assuming the source and load are balanced, of course), with no ripple to filter out. Just sample all three phases with an ADC, and calculate the sum of squares of the three voltages, and you get a perfect DC result, no filtering required (noise aside).

#### mcmsat13

##### Member level 5
RMS measurement of AC signals inherently involves lowpass filtering and delays. It takes many cycles for an RMS measurement to settle. For 50/60Hz input, expect at least 100ms for a decent measurement, regardless of whether you use a MCU or a RMS-to-DC chip.

However, if your sources are three phase, then why even bother with RMS measurement? The magic of three phase power is that the power it delivers is perfectly constant (assuming the source and load are balanced, of course), with no ripple to filter out. Just sample all three phases with an ADC, and calculate the sum of squares of the three voltages, and you get a perfect DC result, no filtering required (noise aside).
As I understand, If from what you are saying, 3 ADCs are needed for the three sources?

#### KlausST

##### Super Moderator
Staff member
Hi,
It takes many cycles for an RMS measurement to settle.
This is true for analog RMS converters, but not necessarily for digtal ones.
run an (runnig) average over the squared values over one fullwave then take the squareroot.
So you immediately have the RMS value of the past full wave.

Do a simulation on Excel for example:
sinewave with 50Hz
150Hz sampling rate
take 3 consecutive ADC values and do the RMS math.
--> it gives perfect results.

As said above: If frequency or waveform differs you have to adjust on that.

Klaus

#### mcmsat13

##### Member level 5
RMS measurement of AC signals inherently involves lowpass filtering and delays. It takes many cycles for an RMS measurement to settle. For 50/60Hz input, expect at least 100ms for a decent measurement, regardless of whether you use a MCU or a RMS-to-DC chip.

However, if your sources are three phase, then why even bother with RMS measurement? The magic of three phase power is that the power it delivers is perfectly constant (assuming the source and load are balanced, of course), with no ripple to filter out. Just sample all three phases with an ADC, and calculate the sum of squares of the three voltages, and you get a perfect DC result, no filtering required (noise aside).
Like this 3-phase voltage transducer

#### Attachments

• PT Transducer.PNG
156.5 KB · Views: 20

#### mtwieg

Hi,

This is true for analog RMS converters, but not necessarily for digtal ones.
run an (runnig) average over the squared values over one fullwave then take the squareroot.
So you immediately have the RMS value of the past full wave.

Do a simulation on Excel for example:
sinewave with 50Hz
150Hz sampling rate
take 3 consecutive ADC values and do the RMS math.
--> it gives perfect results.

As said above: If frequency or waveform differs you have to adjust on that.

Klaus
True, if you know the AC frequency, then windowing your measurement over exactly one AC period will give a measurement with zero ripple. The settling time will also be one AC period, but that ought to be plenty fast for most applications.
--- Updated ---

Like this 3-phase voltage transducer
I don't know how that device works, but it specifies a response time of 300ms.

#### FvM

##### Super Moderator
Staff member
I don't know how that device works, but it specifies a response time of 300ms.
The spec says "Average Sensing RMS Calibrated", that's not true RMS but average rectified value.

#### KlausST

##### Super Moderator
Staff member
Hi,

and it says: "Response time : 300ms".
But they don´t define what "response time" means.
Does it mean it "starts to move into the right direction" or does it mean "tau" of a first order filter, or a "settling time to less than 1% error"?
A LEM current transducer with RMS output says: 300ms to 90%

Here an Excel diagram:

It shows the analog style RMS measurement: input 50Hz pure sine, X-axis is in milliseconds.
* the output is at 90% after 300ms (Like the LEM)
* the remaining output ripple is still more than 1%
--> but look at the output when the input signal is switched OFF: 300ms later it still shows 44%!

Klaus

update:
I added the green line as output of an optimal digital RMS calculation. (36 samples/period)
(100% after 20ms, 0% ripple)

Last edited:

#### mcmsat13

##### Member level 5
Hello all! Please to be honest, I want to hire someone for this project using STM32F103C8T6. I don't know if this is the right way to say this here, if it is not I am already asking for forgiveness now. I'm yet to post full descriptions of the project. I see now that this piece of project is bigger than a hobbyist...a new comer at that. PM is welcomed.
Thanks all.

#### KlausST

##### Super Moderator
Staff member
Hi,

Maybe I confused you with "too much details". In this case I want to apologise.

Maybe we rather should focus on the requirement that on the soution.
(This is necessary independent whether you design it on your own or you hire somebody)
If you want to hire somebody, you should do ths in the "Job" section (refer to this thread)

***
But let´s put the hardware and software aside for a moment. Not thinking about RMS and so on.

What do you want the "device" to do.
You said there are 3 x 3 phases. Where do they come from?