Pzem-004t via EspEasy

Continuing the discussion from 3-phase power consumption measurement:

Hi @edstobi,
I would appreciate if you could share a bit more details about your settings, wiring diagram, ...
Because I have now added 1 pzem-004t module to my wt32-eth01 but I get no values. Although I have used the same settings as you:

Thanks a lot!!

After a lot of trial and error, I learned a lot about pzem-004t but I still get NaN values.
If you are still around here on Discourse, I hope you can give me some advice...

I don't use EspEasy, but may be able to help as I have a number of these wired to Tasmota.

Best to check the basic stuff first with only 1 device connected.

Do you see the TX RX LEDs light up at all ?
Can you share how you wired it up ?

I have a PZEM-004T connected to a Wemos D1 Mini (ESP8266) flashed with Tasmota that reports readings via MQTT to Node-RED. Here's a link to a thread about interfacing the device.

Couple of things to note are the need for level shifters and make sure Tx & Rx are connected correctly.
i.e. Tx connects to Rx, and Rx to Tx

I use a Pi Zero to talk to the PZEM. The Pi doesn't need level converters. I run node red on it and communicate using the contrib-modbus nodes.

Hi guys
Thanks for joining!
I am also discussing this in the EsPEasy forum.

I have currently only one pzem-004t attached for my test.
Thanks to the help on the EspEasy forum, I managed to have currently this state:

So I have set the data acquisition interval for this device on EspEasy to 10 seconds. So every 10 seconds the RX LED on my pzem-004t is flashing, and immediately afterwards my TX LED is flashing. So I assume the pzem-004T knows correctly that he is device with address 1 and that he responds with the measurement data.

But EspEasy says the values are Nan...

What I also not really understand: the receive LED (D3) on my pzem-004t is always on, and flashes intens when it receives a command. On the other hand the transmit LED (D2) is always off, and only flashes when it transmits the results. Not sure if that is normal behaviour of the D3 LED?

OK that's quite a long thread to read :wink:

1: The circuit drawing IS correct, and I have it working here on my desk to prove it :grinning:

"Not sure what they are trying to make you do there, as those diodes (what voltage let they pass through?) effectively block any signal to flow to the ESP. "

This is not true as the signal in question is flowing TO the PZEM via the diode, since the PZEM pulls the line LOW.

2: Are you still using GPIO 15 as this seems to have a pull up resistor which will have an effect on signal levels, so pick another one!

3: You will need to set the addresses on the PZEMs, I think they are all set to 1 by default.
NOTE, you can only have 1 PZEM connected at a time when setting an address, and there is no feedback, so best to make sure everything is working before trying to set the addresses.

4: The PZEM must be connected to MAINS or it will not work at all, as this powers the internal circuitry, the voltage from the EPS is only to drive the leds.

5: As a quick test you could try wiring the PZEM without any resistors diodes etc, but connect to 3.3V on ESP.

6: Based on your drawing there is 5V on the PZEM RX pin, then the other side of the diode 3.3V, since this is lower, some current can flow through the diode towards the ESP and light the LED all the time.

7: Use Tasmota :rofl: :rofl: :rofl: :rofl:

8: Trust your NODE-RED Friends :wink:

Ah I had added it just for completeness. But thanks for the effort!!

Oh, could you please double check if your setup is the same as my diagram above?
I had drawn that diagram quickly during my short lunch break today, to get some feedback.
But in my hurry it seems I have drawn it incorrectly :smiling_face:
My setup looks currently like this:


So I would REALLY appreciate if you could double check my drawing with your setup.

I have done it like that, because in our other discussion on Discourse it was adviced to do it that way. Although now I see that in that drawing the pull-up resistor was connected to 5V while mine is connected to 3V3. Perhaps that is my issue?

Ok I am messing up things completely :roll_eyes:

A little bit further in that same Discourse discussion it was agreed that the diodes were in the wrong direction. But afterwards on the EspEasy I was adviced that I needed to turn them again. So now they are positioned like in my last drawing.

Summarized: I don't know whether my resistor needs to be attached to 3.3V or 5V. And I don't know if my diode is in the correct direction. And I also whether I could have damaged my gpio pins due to all my tampering...

Absolutely :yum:

This is the drawing that represents how I have it wired up on my desk right now.

If check my other points and it still doesn't work, I would suggest testing with another none network ESP with Tasmota.

To test I have had a single PZEM working, wired up using 3.3V instead of 5V without diodes / resistors or converters etc needed.

1 Like

Ok thanks a lot!!!
Will test it tomorrow evening. My time is up for today...

No 3.3V is correct for the pull up, 5V might damage the ESP .

Ok quick test between daily job an dinner. Couldn't wait longer :yum:

I reversed the diode, and now I finally have at least some measurement:

How stupid was that...
You are my hero for today :star_struck:
I will never doubt again about the advice I get from my Node-RED friends :lying_face:

Now I need to figure out why there is no current measured.
But first a walk in the dark and dinner...

Do you have a live wire running through the centre of the coil, with some measurable amount of current flowing ?

Aaaah, a cable consistint out of both neutral and phase. Which probably eliminate each others reading I assume. I will create a setup tonight so I can measure only the phase...

Correct - Only 1 wire through the coil

Of course now I only measure the difference of the neutral current and the phase current, which will be about 0.

My brain is still melted from the daily job. Will need my walk in the dark before continuing...

Thanks for the LIVE support :pray:

1 Like

A little bit of unexpected family stuff, so the me-time started about 5 hours later as expected...

But these 15 minutes were enough for a little test setup. The clamp is now only around the phase wire of a light bulb, and here we go:


Now finally I can start measuring my electric circuits :champagne: :clinking_glasses:
Thanks again for all the help!!!