Whole house power monitoring (single phase) for under 30$

Please share HA config. I am trying to read PZEM-016 straight via Modbus RTU, but I am getting some strange numbers … Thanks a lot. Peter

My whole config is on github, this is the modbus sensors section:

https://github.com/SiliconAvatar/HAConfig/blob/f385f0bcf751daf1dfb5abae0920ca0309f25f36/Sensors/Modbus.yaml

1 Like

Hi, I’m looking to do the same! How do you connect the SDM72D to ESP32?

I’m not seeing that SDM72D comes with a TX or RX port anywhere.

It has a pulse output. You just count the pulses with ESPHome.

1 Like

Guys, how do you reset the energy acumulator. I want to have a monthly energy consumption and I want to reset the energy acumulator every month.
I am using PZEM-016 and a serial Port RS485 to WiFi device (Elfin-EW11).
I have this config:

modbus:
  name: pzem016
  type: tcp
  host: 192.168.0.105
  port: 8899

sensor:
- platform: modbus
  scan_interval: 5
  registers:
  - name: pzem016_voltage
    hub: pzem016
    unit_of_measurement: V
    slave: 1
    register: 0
    register_type: input
    scale: 0.1
    offset: 0
    precision: 1
  - name: pzem016_current
    hub: pzem016
    unit_of_measurement: A
    slave: 1
    register: 1
    count: 2
    reverse_order: true
    register_type: input
    scale: 0.001
    offset: 0
    precision: 1
  - name: pzem016_power
    hub: pzem016
    unit_of_measurement: W
    slave: 1
    register: 3
    count: 2
    reverse_order: true
    register_type: input
    scale: 0.1
    offset: 0
    precision: 1
  - name: pzem016_wh
    hub: pzem016
    unit_of_measurement: Wh
    slave: 1
    register: 5
    count: 2
    reverse_order: true
    register_type: input
    scale: 1
    offset: 0
    precision: 1
  - name: pzem016_frequency
    hub: pzem016
    unit_of_measurement: Hz
    slave: 1
    register: 7
    register_type: input
    scale: 0.1
    offset: 0
    precision: 1
  - name: pzem016_powerFactor
    hub: pzem016
    unit_of_measurement: Pf
    slave: 1
    register: 8
    register_type: input
    scale: 0.01
    offset: 0
    precision: 1

I found some data here:
http://lechacal.com/wiki/index.php/Use_PZEM-016_with_MODWRT#Reset_Energy
The cli command for a RS485 device would have been:

modbus_raw_send 9600-8-N-1 01 42

I tried to adapt that for the service modbus.write_register, and I thought that I should have a yaml data like this:

hub: pzem016
unit: 1
address: 5
value: 42

But is not working.
Any ideas?

I’m just switching my very reliable pzem004t v2 with a node MCU powered by espurna over. Problem was that the maximum reliable update frequency for the sensor is 6 seconds. The problem relies somewhat in a limit of polls for this sensor in revision v1 and v2.

So now I grabbed the neweset pzem004t v3 ($7) and wired it up to a esphomatized esp m3 ($1.5) together with these basic ams1117 5v to 3.3v board ($0.20).

For $8.70 I now have a mqtt free real time (this time for real, updates of the values coming in more than once in a second) view of my whole energy consumption. The sensor also exposes more values now like power factor and frequency.

The component is not yet in the stable release so best is to grab this one here for now: https://github.com/esphome/feature-requests/issues/49#issuecomment-538636809

It should also be possible (in theory) to hook more than one pzem004t’s to one esp to measure for example a three phase system.

Hi All,

I’m just wondering if anyone tried using a single PZEM-004T for monitoring a 3-phase system?

My theory is to clamp it on the neutral wire - which in my case collects load from all 3 phases, and there is no 3-phase load…

I would guess the 42 is in HEX and your yaml value is then DEC?

I’ve only had a PZEM-016 for a couple of days but noticed over the course of a day the utility meter reads a couple of extra kw/h used than the PZEM-016. Is this because my power factor is generally 0.8?

Eh! You are kidding right ?
Given the differing vectors, the 3 phases ‘should’ sum to zero in the neutral line. (the common neutral line for the property).
It rarely does (= exactly 0) as you have phase imbalances but it still means that a neutral current value is just about useless for anything other than seeing how imbalanced the load is.

The meter measures ‘power’ kW if you have a leading or lagging power factor (due to reactive loads) then that would be kVA. The power company can remonstrate you for excessive reactive current and perhaps force you to install power factor correction. But they don’t bill you for KVA they bill you for power kW.
If you have two watches set to the same time, leave it a week and one will be ahead of the other, which one is right? Probably neither. This is called a calibration error. Every instrument you buy has a stated error and repeatability. You can’t do anything about this other than to get one meter to lie and have it offset to the other. This won’t work either as meters will vary their errors over their ranges.

1 Like

I guess you’re right - I mean I was not kidding, but honestly I often get confused by the differences in nature between AC & DC circuits…

Pick an angle (representing a mark on the phase rotation of any single phase)
Eg 50° (assume we use degrees rather than gradians or the more usual engineering radians as most people are familiar with 90 degrees = right angle)
Each phase is 120° apart
So add sin(50) + sin(50+120) + sin((50+120+120) and it comes to 0
Rinse and repeat for any angle.
This is why generally 3 phase pylons have 6 major cables at the sides (3 each side, either in 2 * 3 phase supplies or 1 * 3 phase in parallel, depending on local distribution requirements) and the tiny wire that runs back along the top is the neutral.

1 Like

Hi Ion,

I have som PZEM-016 and some Elfin-EW11, with and without external antenna, but I am not able to make they work together.

The most basic setup, a PZEM-016 with 230v AC and CT connected on one side, and two (RS485 A & B) or three (+GND) on the other. I use the cable with the push button with a rubber cap (RJ45-----4pins (A + - B)).

I have tried multiple combinations of parameters in the EW11 configuration web page and I always have no data coming in from the PZEM-016. 0 bytes received / sent…

PZEM-016 connected with the provided USB adapter and the Peacefair software works very well, but when I connect it to any of my EW11 devices, nothing happens.

I have “updated” the EW11 to the latest version (it was in the latest versions, but just in case…).
I have reset it to factory values… Nothing new.

I want to send data to my MQTT broker and this work well, it says “connected” and example messages are received and sent ok. So, I only have problems with RS485, the “serial side” of the device…

Please, how did you make it work? I have just built my new house and I am working on the automation, monitoring,… and I would like to have a power monitoring system.

In my old house I have a PZEM-016 connected to a RS485 to TTL device, connected to a D1 mini, 230vAC to 3.3vDC power suply,… and I bought these EW11 in order to avoid all of these cables, PCBs and programming.

Thanks in advance…