3-phase power consumption measurement

Me too, that's why I switched to ESPhome :slight_smile: Because it lets me have a bunch of config files that I can mix and match for different types of ESP device with different sensors, controls and screens. A simple master config is then all I need for each device type/sensor combination.

Also, I've never had a device crash with ESPhome and I used to get loads with ESP Easy and a few with Tasmota. And ESPHome lets me include custom C++ for where something isn't quite covered by the many excellent pre-defined components.

Julian,
it seems indeed that EspHome supports the pzem-004T out of the box. But if I see all the red 'warning' boxes in that page, I am already aware I won't have never time to get this running.

Did some further reading about this topic, but I am afraid this is (yet another) project that I will need to quit due to lack of time. The pile starts growing...

Nowadays I hear everybody (at work, in the familly, and so on...) talking about measuring energy and monitoring their devices. But when you look for an affordable/extensible solution to measure power/current/voltage for N wires (across 3 phases) and have the measurements in Node-RED, then you need to tell your boss that you want 2 months extra holidays to get it up and running. So weird...

For me the fun always starts as soon as I have the measurements inside Node-RED, and I can start developing nodes to process those values. But every time, it is a hell to get those measurements into Node-RED :woozy_face:

Anyway thanks a lot again guys for sharing all your great ideas! It was a real eye opener for me in this unknown area. Now at least I know what the possibilities are.

As I wrote above. It took me an hour to install the hardware of the SmartPi. Software connection was done in some minutes including a nice dashboard in node.red.

Thats how it looks in node-red on the SmartPI

theSmartPi Input node


So if you want to have the power for each phase you need three of this nodes.

And the corresponding flow in my main Pi.

There is no need to store the data by yourself, as they are already in an influxdb on the SmartPI. For charts I use grafana directly connected to the influxdb.

1 Like

Hi @Falfango,
Thanks for sharing all the screenshots!!
It looks indeed like a quite nice solution. And if it can be setup so quickly that makes it even better.

But it measures only 3 wires, which means I need a couple of those devices. And then it becomes rather expensive. I am still in the discussion phase with my wife to buy a lot of extra hardware (ip cams, radiator trv's, magnetic valves, and so on..) so need to keep an eye on the price a bit. Otherwise the lady of the house will stop the money flow to my private gadget factory :wink:

1 Like

When re-reading all the useful feedback above, the device that @nygma2004 shared above, is looking very appealing to me. Especially since you can buy it in all sort of formats/prices on ali (4 channels, 8 channels, 16 channels, ...). Which would allow me to have a uniform setup across all my distribution boards at home, which is also very important for me personally (to keep it maintainable).

From his clear written readme page, I assume I could connect that device to my wt32-eth01 board using a RS485 to TTL converter. However I don't understand at the moment:

  • If EspEasy is able to read those values (from all those channels). I assume this device is not supported by EspEasy. But perhaps that is not needed, because it works the same for all modbus devices? No clue :flushed:
  • This device only measures current, no voltage. So not sure how I can measure (a bit accurate) power with it. Based on a hardcoded 230V AC value in my code? Don't understand either at the moment how Shelly 3EM accomplishes this: they also just have a coil around each wire, so I "assume" they also only measure current :exploding_head:

In case it is of interest, I use a PZEM 016 to connect to a Pi ZW via a USB/RS485 adaptor to measure my (single phase) power usage. It is remarkably accurate for the price. I think you connect three PZEMs to one RS485 interface so that might be a cost effective solution.

I use node-red-contrib-modbus in node red on the Pi to talk to the PZEM at a rate of 1.5 seconds per sample and send the results (via MQTT) to my central server which saves them in Influxdb. The accumulated values agree very closely with my smart meter. For example, this shot shows yesterdays usage. The staircase is the 30 minute readings from the meter (via Octopus) and the yellow line shows my measured value.

1 Like

Hi Bart,
You might like to take a look at these inexpensive WAP devices from TP-Link. I bought a couple in May this year to get WiFi to the end of my garage. They work really well. See Note-A below.

Note-A:
What I didn't realise (until I opened the boxes) was they come with a Passive PoE Injector - which might be useful in your situation (getting WiFi to a remote location that has no mains power).

Passive PoE Supported - More Flexible Deployment

The TL-WA801N is able to be powered using an Ethernet cable to simultaneously send data and electricity to wherever your AP may be located even up to 100 feet away. This feature multiplies your options allowing you to place the AP in a position that is most convenient to get the best signal possible, such as on the wall or on the ceiling of your office.
passive

Yes, as mentioned above Shelly 3em has L1, L2, L3 inputs besides the current clamp inputs to measure the line voltages on alll 3 phases. So you just need to figure out which breaker is on which phase, which is not trivial in my breaker box.

I don't think EspEasy has a generic modbus support. As I understand they do have a few specific device support implemented, but most probably not this current sensor.

Btw, I am just picking up my project, as it has been sitting on the shelf after I completed the arduino sketch.

Just thought I'd mention my approach to this (not 3 phase).

I have had a clamp meter for a number of years (single phase), it was part of a smart setup given away by an electricity company and transmitted the data to a display in the 433 MHz range. I didn't have the display, but read the values using rtl_433 and used that in my home automation system for monitoring.

This was generally OK, but not too accurate - I was a few kWh out a day.

I've recently revisited this, and have set up a pi zero W with a webcam pointing at my meter (non-smart but with numeric display rather than dials) running motioneye OS. Just so I can read the meter without opening up the little cupboard it sits in.

I then set up python opencv on my HA Pi, and wrote a small python script to track digit change and send the reading back to my mqtt server.

I haven't gone full ocr yet as I've found no real need. I simply identify a small gap between digits, crop a small window, greyscale it, threshold it, and then count the number of white pixels in the image - meter is white numbers on black. When there are no white pixels in the area, it's an inter-digit area, and hence a unit has been consumed, and the used units counter can be incremented.

This isn't useful for instantaneous power consumption, I still use the SDR dongle to show that, but I've found it to be much more accurate - it doesn't work for the transition from 9 to 0 for some reason on my meter - I've not worked out why yet (haven't managed to observe it happen) but I can allow for that by a mod 10 additional increase in the code - and in the few weeks I've been running this, it is mostly spot on, and occasionally out by 1 kWh a week. I am also playing with an OCR version to read the digits just for fun.

May not suit your use case but as I say, it may be another way to "skin a cat"

Bart - please note... the device you linked-to has solid ring current trasnformers, which means you'll have to remove mains feeder cables in order to fit them. Do you really want to do that??

Yes, mine has been growing for years - waiting for that major RETIRED moment in time - which is also probably a vain hope since my wife will doubtless have a long list for me! :frowning:

Having checked the page, there are only 3 sensible warnings. The last is to only change the sensor address on first run - easy enough. The middle warning is just to check which version of the sensor you have - should be printed on the circuit board. Also easy.

The first warning is one that should be noted no matter which firmware you use - that the sensor is powered from the AC side, not the DC side. Since the sensor will be wrapped around your primary mains feed which will always be on, this isn't an issue. If for some reason you used it somewhere where the AC power isn't always on, all you would need to do is reset the ESP after power on. Also easy.

So though 3 warning boxes seems off-putting, nothing that is anything but trivial.

If you think that when you retire you will have loads of free time, think again. It just doesn't work like that. Things that need to be done always fill more than the time available to do them.

4 Likes

Hi Colin,
Thanks for sharing your graph! Looks damn good. Now at least I have an idea about the accuracy. Could really use something like that to keep me going with this project :+1:

But to be honest, I'm completely lost again:

  • You convert RS485 to USB. Does this mean an USB hub of N ports can be used to connect N pzem devices to an esp32 board? I assume it is not that simple...
  • node-red-contrib-modbus can read from the pzem via the usb interface, or did I misinterpreted this?
  • Your graph shows kWh. Do you have such an accurate approximation by using a non-measured hardcoded voltage (e.g. 230V) in your calculations?

Well you know I am the cable guy :wink:
Have been worked hard last year to have highways for all my cables throughout my entire house and garden, so let the cables arrive now :stuck_out_tongue_winking_eye:
But again good that you mention it, for people reading this discussion afterwards.

OMG, I have completely overlooked that - beside A/B/C for the clamp cables to measure the current - that there is also a wire of every phase to VA/VB/VC to measure the voltage:

image

Now it makes sense again. Thanks for pointing this out!!
So not really a 100% non-intrusive solution...

This is not really a wired solution, but you should get the nobelprice for creativitiy in this discussion :joy:
Very cool! To get this working must have been a hell of a job.
Apologies for not going into much more detail, because then this thread will go completely off topic and become unreadable. But if you ever want to share your project on Discourse in a separate discussion, then I will read it with great interest :wink:

No indeed, I don't want to change anything about my mains feeder cables.

But you can see that they both offer threading and switching transformators:

Don't know if that is official transformator terminology, or just Ali language...
But when you click on the third picture, you will see the title changing to 'switching' transformator. So I assume I need the "40A switching" type (which is a bit more expensive).

Thanks Julian for reviewing the docs!!!

1 Like

Something like this, it connects to RS485 and plugs into a USB port, and appears as a serial port to the OS. So you can drive it directly with a modbus node. Industrial USB to RS485 RS232 Converter Upgrade Protection RS485 Converter | eBay

RS485 is multidrop, so you can connect three PZEMs in parallel to one rs485 interface. I am talking about connecting to a pi, though, I don't know about esp32.

The PZEM does all that for you. It has the transformer for measuring the current, but you also connect it to the power line (for three phase each one would have to be connected to its phase). You can't do power calculations just by measuring AC current and voltage because of the power factor. The voltage and current are not perfectly in phase and you effectively have to multiply the instantaneous current by the instantaneous voltage and add it up over the whole cycle. If you can't provide access to the power line for the voltage you can't do it, it just isn't possible.

2 Likes

Bart tasmota can support 3 x PZEM-004T on a single ESP device for 3 phase readings.

1 Like

Not true Bart - the IOTAWATT is an out of the box solution that you can have up and running in 15 minutes for monitoring your mains use and as time permits you can deploy the additional sensor onto your critical circuits.

It has inbuilt Graphing and a query language that takes 5 minutes to setup in NR

http://172.16.101.200/query?select=[Solar,Consumption,Grid]&begin=s-5s&end=s&group=all&format=json&header=no

That query thrown at it every 5 seconds returns me an object with my solar, grid and consumption numbers

Craig

1 Like

Doesn't that cost upwards of £150?

You might be interested in GitHub - jomjol/AI-on-the-edge-device: Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
Have two sitting on my desk just waiting for their 3D printed enclosures.

1 Like

Somewhere around there with 14 channels it can monitor yep

But if you want an out of the box solution that is well presented and self contained and can monitor all of the circuits then this is the solution. Gets great support on the forum from the developer

Craig

1 Like

OMG. Again completely overlooked the connection to the power line for this device. It is becoming a bad habbit of me... That explains my confusion all the way until here.

Finally it is all becoming a bit more clear, thanks to all inputs. So devices like the one from Ali with the 16 clamps only measure the (induction) current, but no voltage. So you cannot accurately measure power. It can be used only to get an indication of which circuit is consuming most. Which might be sufficient depending on the use case. And if you have a device that measures power, you need not only non-invasive clamps but also wiring (in my case 230 VAC) to the device. Which means a lot of cables in the distribution closet, and not really non-invasive anymore (imho).

Most probably I overlook AC wiring again, but to me it seems like the IOWatt solution of @craigcurtin only has clamp inputs to measure induction current:

So how on earth can this device measure power then? Please help me to solve my headache about this :wink:

And thanks to Craig, I now have again another dilemma. I prefer to have all my logic inside Node-RED. But I don't think there are much nodes available about energy management, so I would have to develop them on my own. For which I don't have time now. But I could solve this by bying a memory management device like IOWatt. But seems there are other players on the marktet, like e.g. emporia:

Although such a device might really be help me to get started in a quick amount of time, I don't think I can live with the fact that it runs completely outside of Node-RED :rofl: That is my DNA. Can't help it I am afraid...