0
\$\begingroup\$

I would like to know how to translate a voltage difference between two independent reference potentials, as accurately as possible.

backstory: We are building a active power measurement station for the European grid (240 VAC) for a school project, basically that thing you plug in between your outlet and your load.

We are using the MCP3911, a delta-sigma dual ADC, featuring a resolution of 24 bits, for measuring the current on the line and the voltage between line and neutral. That ADC has a maximum CHx to ground voltage of +/-2 V, so we need to scale the grid voltage down and for the current measurement we use a 10 mΩ shunt and measure the voltage between its two pins.

But there is a problem. Since we use a power supply containing a transformer with a primary and secondary side to power our electronics, it is inevitable that we will have to deal with two possibly totally different ground potentials. Assuming we know which of the wires is neutral and which is phase, which we can't know.

Now we have our ADC sitting on the secondary side of the power supply, tied to a ground level, that could greatly differ from the level of the neutral line on the primary side.

Is there a way of translating a voltage difference between those two sides, something like an opto-isolator, but highly accurate, and for high voltage levels?

Can we just use two opto-isolators for the positive and negative waves, or is there a better way?

edit: Would a coil on the primary side, inducing a voltage into a wire that sits on the secondary side be a viable solution? We could use the MCP3911s internal PGA to amplify the induced voltage, but we would have to account for the phase shift, when calculating active-power.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Doesn't the transformer already do that?? The "max 2V to ground" is not 2V to earth ground, it's 2V to wherever you connected the ADC's ground pin \$\endgroup\$ Feb 18, 2023 at 0:28
  • \$\begingroup\$ Yes this is our issue. The +/-2V are relative to the ADCs ground. We want to measure the grid voltage which is galvanicaly isolated from the our electronics circuit. That means the ground potential on the electronics side (secondary) and the "ground" (neutral line) on the primary side of our PSU could greatly differ. Thus and for other reasons we cant just connect those "grounds" together. We need a way to translate the scaled down AC voltage to the ground on the secondary side. \$\endgroup\$
    – drzecki
    Feb 18, 2023 at 11:42
  • \$\begingroup\$ Doesn't the [PS] transformer already do that Sort of, but it's a non-ideal transformer with a non-linear load. \$\endgroup\$
    – greybeard
    Feb 18, 2023 at 14:18

2 Answers 2

0
\$\begingroup\$

In commercial smartmeter, the microcontroller and ADC are not isolated from mains, so voltage sensing is done with a simple voltage divider.

In your case I would absolutely not recommend this option because it requires the whole circuit to be at mains potential, which is quite dangerous if you work on it. It also makes it impossible to probe with a standard scope probe (which is earthed) and you can't connect a standard programmer/debugger to your micro.

Would a coil on the primary side, inducing a voltage into a wire that sits on the secondary side be a viable solution?

You're reinventing the transformer, and it's a good solution.

Any standard mains to 6-9VAC transformer will work absolutely fine to sense mains voltage. Note I mean just a transformer, not a power supply with rectifiers etc. A transformer is isolated, so you can reference the output voltage to the ground of your circuit. Just put a resistor divider on the output, and perhaps some voltage shifting, to satisfy your ADC's input voltage requirements.

You should not use the transformer from the circuit's power supply as its output voltage will be distorted by the current drawn from the circuit itself. An unloaded transformer will give you a pretty good replica of mains voltage. Transformer ratio isn't super accurate out of the box, but you can measure it and calibrate for it.

For current, if you use a current sensing resistor, your circuit can't be isolated from mains. However you can get current transformers, usually in the form of two halves that you can clamp on the wire carrying the current you want to measure. It's a current transformer, so it outputs a current: you need to put a resistor on the output to convert to voltage for your ADC. It's very simple to use, for example if you get a 1:500 transformer and there's 1A through the primary, you get 1/500 of that or 2mA on the secondary, just pick a resistor to convert to the voltage you want.

The smartmeter I put on my solar installation works with this style of clamp. It's convenient because you don't need to cut the high current wire to install it, just clamp the current transformer on the wire.

You could also use a closed loop Hall effect sensor. It's more expensive, and its main advantage is that it also works on DC, not just AC. But... you don't need DC.

\$\endgroup\$
7
  • \$\begingroup\$ The "current" transformer is just a transformer, the primary is the mains current carrying wire going through the hole in the middle of a toroid core, which counts as 1 turn. The secondary is N turns on the same core. You need a proper core so it's better to buy it ready-made. It also works as a voltage transformer, Vout=N*Vin, but input voltage is unknown since it's just the voltage drop across the wire that passes through. So it is much more useful to use the transformer equations for current (Iout=Iin/N) and add a resistor on the secondary. It's cheap, safe, and it works. \$\endgroup\$
    – bobflux
    Feb 18, 2023 at 11:57
  • \$\begingroup\$ Thank you. Sorry for the inconvenience, I wanted to ask if the current transformer is similar to a current measurement clamp. Wouldn't it be be prone to the hysteresis error resulting from saturation of magnetic force on the flux density v. magnetic force diagram. Anyways, we will probably go with the transformer for voltage measurement and the current transformer + shunt resistor for current measurement. Thank you for helping us. \$\endgroup\$
    – drzecki
    Feb 18, 2023 at 12:04
  • \$\begingroup\$ Yes it can saturate if the current is too high... or rather, if the core isn't properly selected for the current. So it's simpler to just buy a readymade one, you'll get the correct core material (linear, not much hysteresis etc) without headache. I'd recommend buying a Eastron SDM120 CT smartmeter which is not expensive, and a spare current transformer to use for your experiments. \$\endgroup\$
    – bobflux
    Feb 18, 2023 at 12:11
  • \$\begingroup\$ With the meter you can check your own measurements, and it also has a modbus interface which is nice for data logging. It's not very accurate below 10W though. There are plenty of cheap meters and current clamp transformers sold separately from the meters too. \$\endgroup\$
    – bobflux
    Feb 18, 2023 at 12:11
  • \$\begingroup\$ We will test our circuit with a protective transformer, and 24VAC and if everything works we will place everything inside a 3d printed case and plug it into the grid. Another question: As I understand from your answer, just using a simple voltage divider and placing the whole circuit at mains potential will work without damaging the components as long they are not connected to any external electronics. It's just unsafe. In that case,wouldn't we need to know which which one the neutral wire is, in order to connect it to the ground of our circuit, so both sides are on the same potential? \$\endgroup\$
    – drzecki
    Feb 18, 2023 at 12:15
1
\$\begingroup\$

One solution is not to care which line is phase and which is neutral. Pick one of the two incoming wires, and call it ground for the purposes of your design.

Don't make any connection between your circuit and the protective Earth wire. Don't allow anyone to touch any part of the circuit while it is plugged in.

If the data logger needs some communication port to the outside World, put an opto isolator on that.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Depending on which kind of mains plug is in question, the device must be built so it does not matter which wire is neutral or live, as in many countries, you have unpolarized plugs. \$\endgroup\$
    – Justme
    Feb 17, 2023 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.