# Measuring Voltage between Neutral and Ground, Earth

#### Ravi Patel 1

Joined Apr 22, 2017
14
Hello All,

I am trying to design a controller which can measures voltage difference between Neutral and Ground. Very low information I found on Google and on AAC regarding this topic.
Here is my situation. I have Three wires, Live(L), Neutral(N) and Ground(G), as supply for controller. Circuit will get Power from Live and Neutral. It has ATmega328P Chip operating at 5VDC, 8MHz. I need to measure RMS value of potentiate difference between N and G. I have constrain for ATmega328P Chip but free to use any other supporting ICs like ADC etc.

N will surely have AC behavior with respect to G in unbalanced conditions. I can measure AC Signal's RMS value using ATmega328P's Single ended ADC OR External Differential ADC after necessary conditioning. I need more help in Signal Conditioning and Protection. My expected Input Voltage Difference between N and G is +-10VAC MAX.

Please give me some hints, Ideas or reference designs (If possible) before I decide which path to go for prototyping.

#### Attachments

• 16.6 KB Views: 3

#### Hymie

Joined Mar 30, 2018
1,091
Electrical noise on the neutral/earth lines can extend into the MHz range – so besides deciding on the maximum voltage you expect to encounter, you need to consider the bandwidth of your voltage measurement.

I suggest you take a look at typical voltages with a good quality scope, before designing your measurement circuit.

#### LesJones

Joined Jan 8, 2017
3,813
Is this homework ? The fact that you have the restriction with no explanation why that an ATmega328P must be used makes me think it is homework.

Les.

#### Ravi Patel 1

Joined Apr 22, 2017
14
Is this homework ? The fact that you have the restriction with no explanation why that an ATmega328P must be used makes me think it is homework.

Les.
No its not Homework. Actually I have designed few projects with ATmega328P and I know it very well to Code complex algorithms. So its just for ease, nothing else. If I must have to upgrade to achieve objective then ATMEL SAMD and SAMC Series Arm M0+ are next.

#### Ravi Patel 1

Joined Apr 22, 2017
14
Electrical noise on the neutral/earth lines can extend into the MHz range – so besides deciding on the maximum voltage you expect to encounter, you need to consider the bandwidth of your voltage measurement.

I suggest you take a look at typical voltages with a good quality scope, before designing your measurement circuit.
I am new to analog circuit design and still not have a scope. I am in process of buying one and soon will see those signals into it. Thanks for Reply.

#### Alec_t

Joined Sep 17, 2013
13,153
I need more help in Signal Conditioning and Protection.
You should assume that some idiot will swap Live and Neutral, so you would need to protect agains full mains voltage being on the Neutral line.

#### Ravi Patel 1

Joined Apr 22, 2017
14
Ok, Its good to have Protection for Live on Neutral. Controller will be used in a Machine where a Live Drop OR Live Swap Protection is added. But its good to take such case into consideration.

#### Ravi Patel 1

Joined Apr 22, 2017
14
Electrical noise on the neutral/earth lines can extend into the MHz range – so besides deciding on the maximum voltage you expect to encounter, you need to consider the bandwidth of your voltage measurement.

I suggest you take a look at typical voltages with a good quality scope, before designing your measurement circuit.
Can I filter High Freq Noise, as I don't need them to measure, and let pass LOW Freq, typically let Freqs around Line Supply Freq, 50Hz, to go to measurement? Will my objective be still valid after doing so or NOT?

#### Alec_t

Joined Sep 17, 2013
13,153
Will my objective be still valid after doing so or NOT?
We don't know what your precise objective is. You said you want to measure the RMS value of Vng: so that would include all frequencies.

#### Hymie

Joined Mar 30, 2018
1,091
You could make a simple low pass filter, then look at the voltage trace with a scope both pre and post the filter to see the difference.
Bear in mind that any high frequency noise may not be present at all times, generated by other energised equipment in close proximity.

#### -live wire-

Joined Dec 22, 2017
956
Here is my recommendation. Get a PS that's completely isolated from mains. Power your μC with it. Now use a LC bandpass filter between N and G. Amplify that with a low noise low offset op amp. You will want a dual power supply to get AC on the output. Then maybe try using a MOSFET bridge rectifier.

Use a fast ADC chip and feed that into your μC. Look for one that is low noise and has many pins, so it can get a high resolution and good bandwidth.

#### Ravi Patel 1

Joined Apr 22, 2017
14
Here is my recommendation. Get a PS that's completely isolated from mains. Power your μC with it. Now use a LC bandpass filter between N and G. Amplify that with a low noise low offset op amp. You will want a dual power supply to get AC on the output. Then maybe try using a MOSFET bridge rectifier.

Use a fast ADC chip and feed that into your μC. Look for one that is low noise and has many pins, so it can get a high resolution and good bandwidth.
I was thinking of similar approach to this problem but there are some differences. Please give your thoughts about it.

With the use of a 1:1 and 0.25VA Potential Transformer as connected in diagram, I can isolate signal and Measure. After protection of MOV, signal can be converted from bipolar to uni-polar. Clamp it to MAX 10V. Filter out high freqs with LOW PASS filter as I only need to monitor on Line Freq, which is 50Hz. Reduce this to 5V Scale by voltage divider. Fed to ADC for measurement. There will be some room to calibrate ADC for added losses on signal conditioning. A good sampling rate will unable me to have acceptable readings.

#### Hymie

Joined Mar 30, 2018
1,091
You are connecting neutral to ground via the 1:1 transformer - for most installations this will cause the ground fault interrupter (earth leakage device) to operate. You need to consider some other method of isolating your measurement circuit from the mains (neutral).

#### -live wire-

Joined Dec 22, 2017
956
I was thinking of similar approach to this problem but there are some differences. Please give your thoughts about it.
View attachment 158453
With the use of a 1:1 and 0.25VA Potential Transformer as connected in diagram, I can isolate signal and Measure. After protection of MOV, signal can be converted from bipolar to uni-polar. Clamp it to MAX 10V. Filter out high freqs with LOW PASS filter as I only need to monitor on Line Freq, which is 50Hz. Reduce this to 5V Scale by voltage divider. Fed to ADC for measurement. There will be some room to calibrate ADC for added losses on signal conditioning. A good sampling rate will unable me to have acceptable readings.

Why not use a bandpass filter instead of a low pass filter? It will probably reduce 1/f noise, and other low frequency stuff. Maybe put it first so the noise doesn't get amplified later. Also, the voltage should normally be in the 10s-100s of mV range. It may be greater, but that will be the usual range. Also, it may be able to supply very little current without leading to issues. So even an unloaded transformer could possibly draw too much. And it could be a source of EM noise. I'd just make sure my PS for everything is 100% isolated from mains.

Then I'd use a rail to rail low noise low offset CMOS op amp with a dual rail supply to amplify the signal. I'd set up as an inverting amplifier with a variable gain with transistors that can bypass resistors. So whether it's 20V or 20mV, it will get amplified to be within the same range. And if the gain is too high, it will just swing fully to V+ or V-. Then it can be given a DC offset so that it's only positive. If the op amp supply is +-5V, then add 5V to the signal to get 0-10V. There may be some clipping at a And because of your variable gain, you will Then you can use a fast and precise ADC and feed that to the μC.

#### -live wire-

Joined Dec 22, 2017
956
Also, I did some tests with my true RMS meter, and most of my outlets appear to have .2-.3V between neutral and ground. This was with essentially zero load on them. The meter displayed close to zero volts when not connected, so it is working fine. But there did appear to be some of noise, as when I went to look at the frequency, it displayed some frequencies between 5Hz and 80Hz (rough estimate) before getting to 60Hz. Then again, it could just be poor contact with the probes or issues with the meter itself.

#### BobaMosfet

Joined Jul 1, 2009
2,028
OP:

Topics dealing with MAINS are unfortunately off-limits here.

However, and without providing actual 'information' so as to skirt this TOS issue, I think you need to consider a more general aspect of electronics when dealing with large currents and large voltages-

Never deal with more than you absolutely must- In other words, use every means- resistors, capacitors, opto-isolators, etc, to reduce the amount of energies that you are dealing with by a _scaled_ amount. Scaled, meaning you know that (for example), you're reducing the actual values by a factor of 100, so only dealing with 1/100th of the original dangerous energies. Then use proper isolation techniques to protect your circuit, and yourself if one of these scaling limiter components (resistor, cap, etc) fails.

#### benarji

Joined Apr 18, 2017
1
Hello All,

I am trying to design a controller which can measures voltage difference between Neutral and Ground. Very low information I found on Google and on AAC regarding this topic.
Here is my situation. I have Three wires, Live(L), Neutral(N) and Ground(G), as supply for controller. Circuit will get Power from Live and Neutral. It has ATmega328P Chip operating at 5VDC, 8MHz. I need to measure RMS value of potentiate difference between N and G. I have constrain for ATmega328P Chip but free to use any other supporting ICs like ADC etc.

N will surely have AC behavior with respect to G in unbalanced conditions. I can measure AC Signal's RMS value using ATmega328P's Single ended ADC OR External Differential ADC after necessary conditioning. I need more help in Signal Conditioning and Protection. My expected Input Voltage Difference between N and G is +-10VAC MAX.

Please give me some hints, Ideas or reference designs (If possible) before I decide which path to go for prototyping.