IOT monitoring AC Line, safely

I recently started making the sensors for some AC line monitoring I’m setting up. I’m instrumenting the AC power on/off and power use for AC units, water heaters, etc. In the process I had to come up with ways to connect up the sensors to the AC line and relay the information to an MQTT broker without leaving either a fire or electrocution hazard in my attic.
The picture/pdf linked below captures some of the thinking.
The National Electrical Code (NEC) contains a batch of allowed and disallowed connections for AC line wiring. Some facets of these rules led me to make no connections to the AC lines without it being either connected through a duplex outlet or through a transformer (that current transformer thing). For simple on/off sensing, A plug-in night light and a photocell work pretty well, as does a wall transformer. I found Class II (inherently limited) plug in transformers for $2.00 each at a surplus place. For detailed voltage/current/phase/power monitoring, I used a PZEM-004T monitor board in a BUD plug-in box; very handy!
There are reasons for the quirky looking use of a modified duplex outlet with two feeds from AC mains wires. If you’re interested in the reasoning, ask.
Disclaimer: This is my thinking. It may be incorrect or incomplete, based as it is on my possibly incomplete understanding of the various codes and standards. You accept all risks of using these concepts.
Ask questions for clarification.
AC Line Monitoring Safety.pdf (1.2 MB)


1 Like

Thanks for the pointer. It’s a refresher of much of the background I used in setting up my senors. Current transformers have been a friend of mine for some decades. I’ve used various interfaces to them, from full discrete to highly integrated.

The real focus of what I posted is the methods needed to connect probes of several kinds to the AC line without violating electrical codes and setting up fire and/or electrocution risks. That business about dancing around the hard-wired AC wires and using sockets and plugs to get at what you’re monitoring was the novelty.

Hmm. Did openenergymonitor have suggestions on how to wire up your monitors safely? I didn’t see them, but I may have missed it.

Edit:: I notice that openenergy monitor seems to be focused on UK (?) AC mains wiring, from a picture I found there. I should have mentioned that the “National” in my comments is USA, and the NEC is the USA national electrical code. From my experience in power supply design, there will be different specifications on how the AC mains are wired from country to country. In the UK, for instance, I don’t know if duplex outlets even exist. They are however the very most common outlets in the USA.
In countries where only single outlets exist, the trick of separating the two outlets in one junction box will not exist, so the approach would be to (safely, according to local electrical code requirements) wire up a switched outlet, carrying the switched voltage to be monitored. From there a power cord would carry the voltage to the measuring electronics.