How can I common ground the neutral of the AC line with the GND of the DC line?

Thread Starter

f26dn

Joined May 3, 2025
4
"I'm trying to build an oscilloscope using an ESP32 and opamp. I specifically want to visualize analog AC signals up to 30 volts. I've encountered a problem here that I can't seem to overcome. It's impossible to proceed without common grounding the AC line's neutral with the ESP32's GND line, but linking the neutral of the AC line to the ESP32's GND is a significant risk. I could use an optocoupler, but the downside of that is it converts negative alternation to positive alternation. How can I common ground the neutral of the AC line with the GND of the DC line?"
 

Ian0

Joined Aug 7, 2020
13,097
"I'm trying to build an oscilloscope using an ESP32 and opamp. I specifically want to visualize analog AC signals up to 30 volts. I've encountered a problem here that I can't seem to overcome. It's impossible to proceed without common grounding the AC line's neutral with the ESP32's GND line, but linking the neutral of the AC line to the ESP32's GND is a significant risk. I could use an optocoupler, but the downside of that is it converts negative alternation to positive alternation. How can I common ground the neutral of the AC line with the GND of the DC line?"
Is either side of the AC already connected to the DC ground? If not, there is no risk in connecting it
 

Thread Starter

f26dn

Joined May 3, 2025
4
Is either side of the AC already connected to the DC ground? If not, there is no risk in connecting it

Sure! Here's the English translation of your paragraph:



"For example, let's say there's an AC socket that swings between -30 and +30 volts. I know this is not possible in real life, but I'm just giving an example. The neutral line of the AC socket is grounded by a facility. There is a 3-volt difference between the neutral and the actual earth ground. A person inserts probes into this socket to visualize the signal, and an op-amp circuit takes the differential signal and converts it to a suitable voltage range. In this case, for the op-amp to detect the input voltage properly, the op-amp’s power supply ground and the MCU circuit ground need to be connected to the NEUTRAL line. How can I achieve this?"
 

Ian0

Joined Aug 7, 2020
13,097
If you have a 30V AC signal, it will come from a transformer, not from the electricity supply, so you will have two wires, neither of which will be earthed, nor connected to neutral.

If you are dealing with a 30V that is connected to mains neutral, then it must be treated as though it were connected to mains live, and isolated from your measurement circuit by a transformer.
 

Thread Starter

f26dn

Joined May 3, 2025
4
Eğer 30V AC sinyaliniz varsa, bu sinyal elektrik kaynağından değil bir trafodan gelecektir, dolayısıyla topraklanmamış veya nötre bağlanmamış iki teliniz olacaktır.

Eğer şebeke nötrüne bağlı 30V'luk bir voltajla uğraşıyorsanız, o zaman şebekeye canlı olarak bağlanmış ve bir transformatörle ölçüm devrenizden izole edilmiş gibi davranmalısınız.
[/ALINTI]

Thanks
 

Futurist

Joined Apr 8, 2025
721
"I'm trying to build an oscilloscope using an ESP32 and opamp. I specifically want to visualize analog AC signals up to 30 volts. I've encountered a problem here that I can't seem to overcome. It's impossible to proceed without common grounding the AC line's neutral with the ESP32's GND line, but linking the neutral of the AC line to the ESP32's GND is a significant risk. I could use an optocoupler, but the downside of that is it converts negative alternation to positive alternation. How can I common ground the neutral of the AC line with the GND of the DC line?"
Draw the circuit please.

No oscilloscope I know of, has it's input's ground connected to the AC neutral, they just don't, it is connected to the AC's ground/earth conductor, so this "problem" isn't really a problem at all.

Why is connecting your circuit's negative rail to the supply's ground, a "risk"?
 

MaxHeadRoom

Joined Jul 18, 2013
30,557
Draw the circuit please.

No oscilloscope I know of, has it's input's ground connected to the AC neutral, they just don't, it is connected to the AC's ground/earth conductor, so this "problem" isn't really a problem at all.
Why is connecting your circuit's negative rail to the supply's ground, a "risk"?
The neutral of most AC service supplies IS connected to earth GND , mainly at the service panel, so basicaly the same potential.
 

MisterBill2

Joined Jan 23, 2018
27,159
WHY do you want to connect any portion of a hobby-class oscilloscope to any portion of a mains circuit???? And please explain what you actually mean with: " I specifically want to visualize analog AC signals up to 30 volts. "!! THAT makes no sense at all!! IF the TS wants to see an AC voltage wave form, why??
In addition. " "I'm trying to build an oscilloscope using an ESP32 and opamp. "will not be much. of a useful device at all. What you get, if it ever can function, will have inadequate resolution and not a good time base. And it will not be very accurate, either. A simple transformer can provide both isolation and a good voltage step down, both will make the experiment safer and possibly a bit more accurate.
 

Futurist

Joined Apr 8, 2025
721
The neutral of most AC service supplies IS connected to earth GND , mainly at the service panel, so basicaly the same potential.
That's absolutely true, but the equipment itself references the ground wire not the neutral, we can assume they are the same potential (they should be) but the equipment doesn't (to cater for rare cases where live/neutral are wired wrong way round at the outlet).

Also the OP's second post contains this worrying sentence:

There is a 3-volt difference between the neutral and the actual earth ground.
The OP should keep away from wall outlets until he learns more, I don't even know the voltage sources he's intending to measure, perhaps transformers in which case they are - by definition - inherently isolated so his scenario is moot.
 
Last edited:

Futurist

Joined Apr 8, 2025
721
I suggested using a transformer to provide both isolation and voltage reduction. I stand by that suggestion still. Avoid all of the problems.
Do you think an oscilloscope should be powered by an isolation transformer? a simple 1:1 ratio transformer, that would eliminate potential damage to the scope from oversights?

In fact why aren't the built with an isolation transformer, seems like good idea...
 

schmitt trigger

Joined Jul 12, 2010
2,027
If you are planning to measure a powerline waveform directly, you must use a high voltage differential probe, and the scope itself must be solidly grounded/ earthed.
Isolation transformers may also be used, but they are bulky and heavy.
 

Futurist

Joined Apr 8, 2025
721
If you are planning to measure a powerline waveform directly, you must use a high voltage differential probe, and the scope itself must be solidly grounded/ earthed.
Isolation transformers may also be used, but they are bulky and heavy.
Why aren't modern scope's made "floating" rather than grounded, what good reason is there for the probe connector's outer case to be connected to the power line ground?
 

tautech

Joined Oct 8, 2019
496
Why aren't modern scope's made "floating" rather than grounded,
Cost.
The analog front end requires a floating power supply and the probe signal and BNC shell (reference lead) signals to be isolated before passing into the scopes main circuitry. Sounds easy but amplitude and frequency accuracy requirements at MHz make this more difficult.
Floating scopes use different probes also with higher insulation properties with a well insulated reference lead clip.
what good reason is there for the probe connector's outer case to be connected to the power line ground?
Safety.
 

MisterBill2

Joined Jan 23, 2018
27,159
Every oscilloscope that I have used has a power transformer in the power supply. THAT enables adequate isolation, no separate isolation transformer needed. Some scopes with the three pin plug do have the case tied to that "ground" pin.
Many of those scopes have had that ground lifted or totally removed, because that "safety grounding" introduces all kinds of electrical noise into every measurement.
 

schmitt trigger

Joined Jul 12, 2010
2,027
Not exactly true. While older CRT based scopes did have an input transformer, all the modern ones use a SMPS.
You may correctly argue that a SMPS does have a transformer, a high frequency one, but you forget the safety agency mandated input common-mode filter, which do require legitimate grounding for the return currents.

Speaking of safety; rather than you and me having an endless argument, I will instead refer to people who do know, Tektronix, what they think about floating a scope.

https://www.tek.com/en/documents/te...lloscope-measurements-and-operator-protection
 
Top