Hello all,
I am trying to configuring 4 switches on a switchboard with domoticz and ESPeasy. I am able to configure it successfully. Now, I want to measure the power consumption of each device on the switchboard. I tried using ACS712 but the readings where nonlinear(using a simple Arduino code as I was unable to find any ESPeasy plugin for ACS712). If I use the I2C sensor I guess ESP32 supports only two I2C devices. Is there any particular sensor with which I can measure the power used by individual devices using a single ESP32? And do ESPeasy have a plugin for the same?
Energy monitoring Topic is solved
Moderators: leecollings, htilburgs, robgeerts
-
- Posts: 357
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Energy monitoring
Hello,
IMHO, the easiest way to measure AC consumption is not trying to analyze it from real-time sensor (to be rigorous, you should do it at least 10 times 50 or 60 Hz, so mainly every ms), but using a device doing all computation for you, and requesting data when you need it.
On my own, I use PZEM-004T (around 5€) to get voltage, current, power, reactive power and frequency.
It's a 5V device, using serial connection. As it's addressable, you can connect some (lot) of them on the same wires.
EspEasy plugin P171 do the job to connect them.
IMHO, the easiest way to measure AC consumption is not trying to analyze it from real-time sensor (to be rigorous, you should do it at least 10 times 50 or 60 Hz, so mainly every ms), but using a device doing all computation for you, and requesting data when you need it.
On my own, I use PZEM-004T (around 5€) to get voltage, current, power, reactive power and frequency.
It's a 5V device, using serial connection. As it's addressable, you can connect some (lot) of them on the same wires.
EspEasy plugin P171 do the job to connect them.
-
- Posts: 7
- Joined: Monday 10 August 2020 13:29
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Energy monitoring
Thanks for the reply. But I have seen this sensor and it has a coil which has to be connected to a wire. So can we connect this coil to any load wire-like fan, Tubes, bulbs, etc? Also how many pzem-004T can be connected to one ESP? Can I connect 4 of them to a single ESP as I want to measure power across all the 4 switches? Any connection diagram from your side will be well appreciated. ThanksFlyingDomotic wrote: ↑Monday 21 September 2020 10:52 Hello,
IMHO, the easiest way to measure AC consumption is not trying to analyze it from real-time sensor (to be rigorous, you should do it at least 10 times 50 or 60 Hz, so mainly every ms), but using a device doing all computation for you, and requesting data when you need it.
On my own, I use PZEM-004T (around 5€) to get voltage, current, power, reactive power and frequency.
It's a 5V device, using serial connection. As it's addressable, you can connect some (lot) of them on the same wires.
EspEasy plugin P171 do the job to connect them.

-
- Posts: 7
- Joined: Monday 10 August 2020 13:29
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Energy monitoring
srushti wrote: ↑Monday 21 September 2020 11:51Thanks for the reply. But I have seen this sensor and it has a coil which has to be connected to a wire. So can we connect this coil to any load wire-like fan, Tubes, bulbs, etc? Also how many pzem-004T can be connected to one ESP? Can I connect 4 of them to a single ESP as I want to measure power across all the 4 switches? Any connection diagram from your side will be well appreciated. Also I saw the ESPeasy plugin but where can I get the PZEM_004T.h library? ThanksFlyingDomotic wrote: ↑Monday 21 September 2020 10:52 Hello,
IMHO, the easiest way to measure AC consumption is not trying to analyze it from real-time sensor (to be rigorous, you should do it at least 10 times 50 or 60 Hz, so mainly every ms), but using a device doing all computation for you, and requesting data when you need it.
On my own, I use PZEM-004T (around 5€) to get voltage, current, power, reactive power and frequency.
It's a 5V device, using serial connection. As it's addressable, you can connect some (lot) of them on the same wires.
EspEasy plugin P171 do the job to connect them.![]()
-
- Posts: 357
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Energy monitoring
I have a D1 mini connected to 4 PZEM-004T working perfectly (not with EspEasy but a private code)
Connection is very simple : connect PZEM with 4 cables : GND, +5V, TX, RX. Connect power to GND/+5V, ESP RX to PZEM TX and ESP TX to PZEM RX. You need first to connect only one PZEM at time, on order to load a unique address in its EEPROM. When all PZEM have different address, you may connect them altogether. Your code should send first address of PZEM to be read to select the right one.
On the "other" side, you should connect neutral and lead, plus the 2 wires from the coil. Only ne wire of the powered device (the one you want to measure consumption) should to through (inside) the coil. You can connect whatever you want (motor, bulb, neon...), as long as current is less than 100A, which should reasonably be the case.
Library is at https://github.com/olehs/PZEM004T
Connection is very simple : connect PZEM with 4 cables : GND, +5V, TX, RX. Connect power to GND/+5V, ESP RX to PZEM TX and ESP TX to PZEM RX. You need first to connect only one PZEM at time, on order to load a unique address in its EEPROM. When all PZEM have different address, you may connect them altogether. Your code should send first address of PZEM to be read to select the right one.
On the "other" side, you should connect neutral and lead, plus the 2 wires from the coil. Only ne wire of the powered device (the one you want to measure consumption) should to through (inside) the coil. You can connect whatever you want (motor, bulb, neon...), as long as current is less than 100A, which should reasonably be the case.
Library is at https://github.com/olehs/PZEM004T
-
- Posts: 7
- Joined: Monday 10 August 2020 13:29
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Energy monitoring
Thank you so much..FlyingDomotic wrote: ↑Monday 21 September 2020 17:13 I have a D1 mini connected to 4 PZEM-004T working perfectly (not with EspEasy but a private code)
Connection is very simple : connect PZEM with 4 cables : GND, +5V, TX, RX. Connect power to GND/+5V, ESP RX to PZEM TX and ESP TX to PZEM RX. You need first to connect only one PZEM at time, on order to load a unique address in its EEPROM. When all PZEM have different address, you may connect them altogether. Your code should send first address of PZEM to be read to select the right one.
On the "other" side, you should connect neutral and lead, plus the 2 wires from the coil. Only ne wire of the powered device (the one you want to measure consumption) should to through (inside) the coil. You can connect whatever you want (motor, bulb, neon...), as long as current is less than 100A, which should reasonably be the case.
PZEM-004T.jpg
Library is at https://github.com/olehs/PZEM004T

Who is online
Users browsing this forum: Amazon [Bot] and 1 guest