How to use PZEM004T Energy Monitor with esphome

This is very good work.
I’ve been planning on doing something similar for the electrical cabinet for all the separate lines of the house in addition to my specific point of attention measurements like home theater, aquarium or studio.

As you might have seen from my example, I’m not using the modbus thing.
Were you ever be able to figure out what the problem was about having to use 5 devices instead of 6? Was it a some sort of cross interference of power or data lines?
Did you try a different power supply? Are you using a DIY power supply or is it a ready made power module? Maybe it is a switched mode power supply issue and a linear power supply with proper regulation might do the trick? Did you try to power all 6 of the modules with sparate power supplies for debugging purposes?

When using for power measurement of each saparate circuit from the main electrical cabinet, using modbus is a must. I mean one ESP-01 per 5 PZEM modules is still not bad but one should be able to use a single controller for many PZEM modules as intended using the modbus.

Not always true. If monitoring current on the whole house, do not use the neutral. 2 or 3 phases can share 1 neutral wire, and for example if all 3 live phases have an equal resistive load, the neutral at the utility box will not have any current. None.

You can use the neutral on a single phase appliance, as the current on the live will mirror the neutral then, but i would just get in the habit of using the live for current monitoring to avoid false readings for shared neutrals in some branch circuits and sub panels.

Sorry to ask a silly question, as I have near zero knowledge of electronics/circuits/etc.

Based on what I’ve read in this thread, is it safe to say that the PZEM-004Tv3 cannot be used unless you connect it directly to an A/C power source?

I was hoping to use it to measure only amperage (load). Because of my lack of knowledge, I did not intend to hook it up directly to the A/C source on my main panel.

As per my understanding, It requirs the AC side of the connections (Phase and Neutral) active to measure the readings.

Yes, that’s due to the fact how AC power metering works. :zap:

If you are only interested in current and don’t need power readings you can go with a CT coil/clamp :point_down:

2 years later this works great. I don’t have a display, but the measurements works.
Also my PZEM module had V1 written on the board, but on the instruction that come with appeared that includes frequency and power factor. The original V1 didn’t included those.
So for who like me is buying modules form Ali in 2024 and come V1 labeled, they are not. Configure them as V3 and they’ll work.

1 Like

I would like to share my pzem implementation as well. It is modified PZEM-004T version which is based on the modification done by the user HWCave from Github. TheHWcave/Peacefair-PZEM-004T-: reverse-engineered schematics and interface software (github.com).

The modification and resulting PZEM-004T are following:

  1. It can measure from 0V-266V. I’ll be using a fourth power supply in our home to power the boards that is the inverter-based backup system because we have occasional load shedding in my location.
  2. It is given some protection on input via four resistors in series instead of two tiny smd resistors which are borderline for 230V continuous voltage measurement and may have shorter lifespan.
  3. It has short circuit protection for each phase and neutral via fast blown fuses.
  4. It has isolation between PZEM boards and ESP32 power supplies via a separate 12V power supply especially for PZEM IC which is fully isolated with normal power supply without SMPS BS. ESP32 side is powered by Hi-link 3W supply.

With that modification now I can measure from 0V to 266V, and I can power them with a separate power source. I have tested these modules, and they run fine with 3.3V supply via ESP32.

Let’s see how they work in long run.

1 Like