Mains AC powered EmonTX

hi - has there been any discussion on powering the emontx directly from the mains?

a voltage divider (2.2M/10k perhaps) to measure the AC line voltage and then something like a hi-link cube to bring the voltage down to 3.3v dc for the logic circuitry. or a rectifer + SR086 even. fused of course.

No, nor will there be any discussion. What you are suggesting could be lethal under certain fault conditions.
You MUST galvanically isolate the emonTX from the mains.

why must there be galvanic isolation?

any mains powered device can be lethal. the typical child’s led nightlight is just an RC dropper housed in plastic.

user protection can be achieved by removing the barrel jack and USB connections and dip switches etc and housing the kit in normal double insulated plastic. the CTs would be wired likewise.

seems odd to squash a discussion like that. The intent is to understand whether there would be any measurement impact from using this type of methodology.

Have you considered what will happen should the neutral connection fall off outside your house? Everything, including a computer connected to your emonTx for programming or just displaying the data, will become live to 230 V.
You’ve obviously not spent enough time in electrical engineering to recognise all the dangers.

So the use case you are asking me to consider is where for some unknown reason the incoming “neutral” connection is disconnected from the main distribution board and there is no continuity across any device within the house. And then someone happens to open up a double walled plastic box in order to create a short circuit via the body to ground.

Well, no. I hadn’t specifically considered that scenario.

What is the difference then between that particular device-scenario and any other device in the building? The killawatt I have plugged in at present would be equally compromised. As would every switch mode power supply and literally every other device that I might choose randomly to dip my hand into whilst there was a power cut from a disconnected return path.

The device would be fused in line so that is some protection. At the distribution board there are residual current devices which would trigger in a few ms with there being no return current along the “neutral” and if there were any metal involved the elcb would detect the leakage and trip. None is perfect from a safety perspective but seems to represent the same risk as extant irrespective of the device connected to the mains.

Perhaps it might be a better idea to stop with the straight doomsaying and instead help with the enquiry whilst providing cogent rationale why you consider such a solution an insecure design against all other commercial domestic devices. The knee jerk “mains can be dangerous” is unhelpful. We know that but by all means include whatever warning your conscience thinks is necessary on each response. I’m interested instead in whether people have considered/tried this and if so whether the measurements are sensible.

So far I’ve lived my rather long life on the basis that it is better to help others reach their own conclusions whilst giving rational and argued guidance rather than forcing my view upon them without explanation and/or denigrating them without cause.

OEM has to be reasonably certain that the emonTx will be safe no matter where in the world it happens to be installed. By not having a direct galvanic connection to the mains electricity supply, there is reasonable assurance that will be the case.

The scenario you had not considered was setting up, calibrating and testing. And when you stop to think about it, the fault I envisage requires continuity through one or more appliances, which I consider quite likely. If there is no current path between line and neutral downstream of the fault, the neutral will be isolated and then there is indeed no danger. The possibility of that seems to be vanishingly remote.

Then of course there’s the non-trivial matter of CE certification which is required should you put the device you envisage on sale.

Did I say that I was planning to sell the design as an OEM? Apologies if so. My plan is to use it to track down why my electricity bills in my house are c 1000eur per month and to supply remote monitoring.

testing of the CTs can be achieved without being connected to the mains, via an onboard serial connection. Calibration can be achieved by examining the values whilst attaching the sensor to a resistive load such as an immersion heater. I don’t think that the mains voltage reading would need calibration as there is no inaccuracy caused by measuring after an isolating transformer. All that would be needed was an accurate reading of the resistances in the voltage divider. But of course real time checking is possible with a remote rfm* as a receiver whilst a multimeter is in a socket.

But I take the point that if the worst were to happen whilst someone were connected physically to the inside of the circuit there is a potential for danger. Although the RCD should still provide some protection. As would a glass fuse.

Back to the question, please. Has anyone got experience of this and if so do devices like the hi-link cause measurement aberrances through the high frequency switching? And if so are those aberrances material against the inherent lack of precision of the 328p ADC?

(Incidentally moving to an esp32s seems to be a good trade up on the ADC once espressif finally sorts out the lack of linearity).

Only minutes ago, I pointed another user towards this in relation to power supplies:
Noise in Arduino based builds. | Archived Forum “Noise in Arduino based builds”.
It’s specifically not the emonTx, but many points there are worth considering.

Not quite true - there’s the ADC reference voltage to consider too.

I don’t think that would realistically give adequate personal protection - not even a 10 mA one, which is the smallest I could find. (“Opening time: 4 hours minimum at 100% current, 5 s maximum at 200%” is the only available data!)