Powering custom emonTx board with dual output transformer


I have designed a custom emonTx board tested and working, on my design I used a small PCB 230V to 9V transformer as my Voltage sensor and a AC to DC power module to power the board, as I have read that it’s not the best to use the same VT to power the board.

I was wondering, and decided to post here, how about if I use a dual output transformer, while I use one output as the VT and rectify the other output to power the board via Voltage Regulator.

the transformer output are (0v-9v) (0v-9v)



A dual winding transformer doesn’t help much - the issue is that the variable loading of the DC supply portion affects the magnitude and shape of the voltage waveform. Since both windings are sharing the same driving flux from the primary, the nuisance interaction still happens. Be cautious with your selection of the PCB mounted transformer - they are usually short of iron to save space (and cost). This can be seen as gross distortion of the output waveform, more triangular than the sine wave you are looking for. A modest dummy load can improve the waveform somewhat.

In a little more detail, the reservoir capacitor in the d.c. supply section gets charged during a very narrow time slot in each half-wave as the voltage approaches the peak, so it draws a large current at this instant. It’s that which ‘dents’ the voltage wave that you’re using to measure as a representation of the true mains wave shape. On top of all that, as @emjay says, there’s not a lot of iron in those transformers and the wave shape will be distorted because of that too.

Somewhere on the old forums, I posted a Spice simulation of the distortion due to the current pulses. I have an isolating transformer that was specially designed as a phase reference for a thyristor drive. Its rating is about a tenth of what you’d expect from the physical size. One day, I’ll measure its properties and compare it with the Ideal ac adapter (which is by no means perfect but it’s better than many).

So the best way to go is use two different power source (transformer) and preferably not a PCB mount transformer

or is there anyway one could use one power source? I really need to keep it compact

@emjay could you explain further what you mean by that


The emonTx V3 does use a single ac adapter as both power source and reference. However, the amount of power (current) available is strictly limited, and various tricks have been used to minimise the impact on the monitored waveform. You can get the circuit diagram via Resources.

Here’s how it works:

The emonTx V3.4 uses a different regulator and the 12 V zener diode is no longer necessary, but it illustrates the problem and the means to mitigate it.

Oh, that sucks. So if I wanted to make a small single-socket meter I’d be forced to use a divider connected to mains instead. Or what Robert mentioned, but I guess that kind of transformer is something tailored to that specific purpose and not easiliy available to purchase.

If you do that, EVERYTHING MUST BE TREATED AS “LIVE”, so it has to have no connection to the outside world that is not properly isolated, and be inside an earthed metal or double insulated enclosure. It is very hard to do that properly and safely, which is why we always use an isolating transformer.

(If you doubt me, consider what happens if the neutral falls off outside your house.)

No, you’re right and it would make it extremely hard to do it properly as you say. I’m just not stressing it out in each of my posts that working with mains is dangerous but I’m aware. If it’d be the only way I’d prolly not do it, I simply don’t have the proper skill for that kind design. Even if it looks simple, it’s still the mains 230VAC to work with and that makes it difficult.

There are these so called “measuring” transformers for the exact purpose of isolation and accurate waveform measurements. Can anyone suggest a specific model?

Instrument grade voltage transformers are bulky (typically they use lots of high-grade silicon steel or nickel alloy laminates) and way too expensive. If you look at the tear-downs of similar “remote plug” devices, you will see that they sidestep the issue by using a resistive divider and often a transformer-less power supply, then totally enclose the workings.

You can construct all this yourself, but it is worth reading this to understand the potential problems http://jeelabs.org/2012/01/27/cant-be-done/index.html#comments
During development of that circuit, most of the debugging was done with an isolating mains transformer with an earthed center-tapped 110V secondary and other safety precautions. The final circuit was analysed for short/open failure of every critical component, but it still was decided NOT to produce as a kit.

Thanks for the encouragement :slight_smile: I thought of isolation transformers as well. But that path looks tedious and I might skip building it myself after all.

Trying not to steal OP’s thread here, but yeah, well, I’m in the meantime researching other options, including off-the-shelf solutions. It looks as the Ubiquiti mPower series fits my current needs. According to reviews it’s a very accurate RMS meter with good hacking potential, cloud option, self-hosted controllel-manager software or plain SSH access (runs on Linux on its SOC). Even the 3-socket one is cheaper and provides more features than the Belkin WeMo Insight, another contender.

… and most probably have 110 V secondaries too, plus the lowest primary voltage would likely be 660 V, so you’re not likely to get a 230:9 V one off the shelf, and you’d need to find a firm to custom design and make one for you.

What will be the max current that can be drawn from it, I have on the board an Atmega328 and ESP8285
the ESP will transmit 4 time per minute

What is the average difference between realPower and apparentPower, maybe I let go of voltage sensing and make do with apparentPower only

How big a dent, i.e. what degree of inaccuracy, in the voltage wave can you tolerate? I suggest you download a copy of LTSpice and run the simulation, using the transformer and other components and loads you have, and see what you get.

How can I or anyone answer that? It depends entirely on the combination of loads that you have at any given moment. If all your loads are purely resistive, there’s no difference. If all your loads are either purely capacitive or purely inductive, then apparent power has some value and real power is zero.

I’ve found an interesting chip. It’s an Isolated Voltage Sensor from Avago, a firm I’ve never heard of. But if works as advertised, it can be used as an alternative to small transformers. It’s a small SOIC (or alike) chip, obviously smaller footprint than a transformer. It’s not very cheap though for what it does (~$6 apiece at Mouser).

If you let go of voltage sensing you won’t even be able to measure apparent power. You’ll be making a guess at apparent power based on your nominal (or once measured) grid voltage, but depending on where you live, that can vary a lot throughout the day. Here’s how mine looks across a week.

Not so simple as you might think. The fly in the ointment is “VDD1” and “GND1”- meaning it needs an isolated 5 V power supply for the live side entirely separate from the output side, and you still need all the isolation and guarding of the input terminals and voltage divider and creepage distances etc on the pcb.

And reading a bit further, it’s more suited and tailored for PV DC system voltage monitoring and such. So… yes, it’s not that simple, sadly.

What do you think about a hybrid solution? Like everyone else, I can’t get an accurate enough voltage reference from a 9vAC brick and don’t want to go to a direct connect circuit for the obvious reasons. So I’m considering using the brick to get a pretty good reading on overall RMS voltage, and using that to scale a computed sine wave.

Mathematically, it would work out to just factor in a table driven SIN(phase angle) and then multiply the result by the measured RMS voltage. I think the grid sine wave is pretty good, and notwithstanding the distorted waveform, I can get measure the RMS voltage to match my 1% Fluke true-rms meter. The floating point arithmetic isn’t a problem with the 80mhz ESP8266.

The reference transformer has an awful overun at the trailing tip of each wave, not to mention the phase shift. At 60K+ sps the sample rate (at 60Hz) is 500+ per cycle voltage and current pairs, the distortions are contributing significant problems. With a clean manufactured sine wave, the current-only sample rate would be 1000+ per cycle.

This wouldn’t work downstream like after a speed control or dimmer, but my sense is that it would work better than the transformer sampling at the main panel. Anybody tried this or have an opinion?

I just don’t get it. You’re measuring the rms value of the mains voltage wave, then synthesising a pure sine wave having the same rms value, then mixing that with the current wave to measure real power. What if the current distorts the genuine voltage wave and thus changes the average power by virtue of the power in the harmonics? You won’t read that component of power that’s in the harmonics, all you will read is the fundamental component.

Anybody with a POSITIVE attitude want to comment?