Support for PZEM 004T Energy monitor

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
djelau
Normal user
Posts: 30
Joined: 08 Nov 2019, 15:33
Location: France

Re: Support for PZEM 004T Energy monitor

#201 Post by djelau » 06 Jul 2020, 18:10

xxrock wrote: 05 Jul 2020, 11:58 Can you please give advise what I do wrong?
I think you cumulate all the errors that I solve previously:
- Avoid Node MCU because voltage level are 3V3 whereas PZEM expects 5V. It could work but it's not sure
- Avoid HW serial
- RX and TX are inverted to work with HW serial
- Deactivate serial communication in Tools->Advanced-> Serial Port

So follow very carefully this link, and normally everything should be OK. If not, use a wemos D1.

xxrock
Normal user
Posts: 7
Joined: 01 Jul 2020, 17:50

Re: Support for PZEM 004T Energy monitor

#202 Post by xxrock » 09 Jul 2020, 14:41

djelau wrote: 06 Jul 2020, 18:10 I think you cumulate all the errors that I solve previously:
- Avoid Node MCU because voltage level are 3V3 whereas PZEM expects 5V. It could work but it's not sure
- Avoid HW serial
- RX and TX are inverted to work with HW serial
- Deactivate serial communication in Tools->Advanced-> Serial Port

So follow very carefully this link, and normally everything should be OK. If not, use a wemos D1.
Thanks. I connect PZEM RX to GPIO13, TX to GPI12, G to G and 5V to VU (this is 5V from microUSB). I don't know why, but GPIO01 and GPI03 don't work :roll:
Now two diodes in PZEM blinks regulary I can see Voltage and Frequency. But Current and power is zero...
How can I check that coils works normally?
Снимок.PNG
Снимок.PNG (16.21 KiB) Viewed 1762 times

djelau
Normal user
Posts: 30
Joined: 08 Nov 2019, 15:33
Location: France

Re: Support for PZEM 004T Energy monitor

#203 Post by djelau » 09 Jul 2020, 15:25

xxrock wrote: 09 Jul 2020, 14:41 I don't know why, but GPIO01 and GPI03 don't work :roll:
It should work but in your initial set up, you should select SW serial rather than HW serial and set GPIO <- TX as GPIO-1 and GPIO->RX as GPIO-3
xxrock wrote: 09 Jul 2020, 14:41 How can I check that coils works normally?
What kind of load do you connect ?
For your info, coil impedance is roughly 60 ohms.

TD-er
Core team member
Posts: 3174
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Support for PZEM 004T Energy monitor

#204 Post by TD-er » 09 Jul 2020, 16:12

If using the pins for the normal serial port, then make sure to uncheck (thus disable) serial port support in Tools => Advanced.
Otherwise ESPEasy may send out debug data or logs to that port, which may affect the connected sensor.

xxrock
Normal user
Posts: 7
Joined: 01 Jul 2020, 17:50

Re: Support for PZEM 004T Energy monitor

#205 Post by xxrock » 09 Jul 2020, 17:36

Now I connect GPIO1 & GPIO3 it works, but still show only voltage :(
Yes, I choose Software serial port in communication settings and disable setrial port in advanced settings.
My coil's impendancw is 55.4Ohm. I connect coil to extension cord which connected to monitors and notebook. Ноw can I check PZEM send any current and power data?

Image

User avatar
grovkillen
Core team member
Posts: 3613
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Support for PZEM 004T Energy monitor

#206 Post by grovkillen » 09 Jul 2020, 18:47

Could you show how you have mounted it, over one wire? Or else the net sum will always be zero.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

TD-er
Core team member
Posts: 3174
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Support for PZEM 004T Energy monitor

#207 Post by TD-er » 09 Jul 2020, 20:08

What Jimmy said (Grovkillen), you should only have 1 wire of the AC string going through this coil, not both wires.

djelau
Normal user
Posts: 30
Joined: 08 Nov 2019, 15:33
Location: France

Re: Support for PZEM 004T Energy monitor

#208 Post by djelau » 09 Jul 2020, 20:52

xxrock wrote: 09 Jul 2020, 17:36 Ноw can I check PZEM send any current and power data?
If displayed current is 0A then data are sent correctly. Otherwise, you will have NAN. (and power would be NAN if no communication)
With current =0A, power=0, it's normal.

So a photo of your overall wiring setup will be helpful.

xxrock
Normal user
Posts: 7
Joined: 01 Jul 2020, 17:50

Re: Support for PZEM 004T Energy monitor

#209 Post by xxrock » 10 Jul 2020, 06:36

TD-er wrote: 09 Jul 2020, 20:08 What Jimmy said (Grovkillen), you should only have 1 wire of the AC string going through this coil, not both wires.
Hello,
It really was a mistake related to the wrong connection of the coil. I just did not study carefully the connection diagram. Now everything works as expected. Thank you all for the help, especially to djelau (for firmware and help). :)

p.s. If somebody else wants connect NodeMCU Lolin v3 to PZEM-004T v3 can use this pins:
IMG_20200710_104414.jpg
IMG_20200710_104414.jpg (1.15 MiB) Viewed 1678 times

djelau
Normal user
Posts: 30
Joined: 08 Nov 2019, 15:33
Location: France

Re: Support for PZEM 004T Energy monitor

#210 Post by djelau » 10 Jul 2020, 11:16

xxrock wrote: 10 Jul 2020, 06:36 I just did not study carefully the connection diagram. Now everything works as expected. Thank you all for the help, especially to djelau (for firmware and help). :)
Good job !

ice77
Normal user
Posts: 2
Joined: 05 Apr 2020, 05:47

Re: Support for PZEM 004T Energy monitor

#211 Post by ice77 » 05 Aug 2020, 05:19

good morning @all

@djelau:
first of all: THANK YOU SO MUCH FOR YOUR WORK. I tried your firmware with one PZEM004T and it works like a charme. I get the values via MQTT into my ioBroker and its really fine. What I am thinking about is - how many PZEM004T could I connect to one ESP8266 (D1 Mini - which is highly recommended how I've read).

Is there a hard limitation? I am thinking about to attach 6 PZEM 004T to one D1 mini Pro. Would this be possible?
When attached several PZEMs - do they have to be separated (timing) in polling intervall or would it be ok to set 10sec polling to all of them?
Actually I bought 3 PZEMs - if I could drive 6 of them with one D1 Mini I would order other 3 @Ali.

Did anyone of you measure how much power consumption is realized for each PZEM to measure?

Thank you in advice

have a nice day

ice77

djelau
Normal user
Posts: 30
Joined: 08 Nov 2019, 15:33
Location: France

Re: Support for PZEM 004T Energy monitor

#212 Post by djelau » 14 Aug 2020, 21:32

Hello ice77,

It's ok to set 10sec polling to all of them. Each instance of slave are executed sequentially (not simultaneaously).

I don't test with 6PZEM but it should work: Eventually you can supply PZEM by using the 5V from the AC/DC of wall plug rather than the one from wemos. Just connect gnd all together.
And communication protocol is fast enough to communicate with 6 PZEM.

ice77
Normal user
Posts: 2
Joined: 05 Apr 2020, 05:47

Re: Support for PZEM 004T Energy monitor

#213 Post by ice77 » 23 Aug 2020, 19:10

Hi djelau,

Thank you for your answer. I ordered other 5 PZEM-004T V3. I will test it, when the hardware arrives.

I actually use a simple D1 mini, but will swap to the D1 mini pro to get an external antenna attached. The PZEM delivers 5V and I am not sure, if the D1 mini (pro) is 5V tolerant for a very long time. Would it be advisable, to use an level shifter to 3,3V? for example this one https://www.aliexpress.com/item/3-3V-5V ... 4c4dz3hrJG

Would you recommend that or can I drive the D1 mini with 5V to the GPIO Pins without having fear to burn it?

Has anyone ever measured the power consumption of one PZEM-004T V3?
pzem004Tv3.jpeg
pzem004Tv3.jpeg (38.97 KiB) Viewed 1150 times
Here is a pic of the power measurement of an Intel NUC 8i5 with proxmox.

dear community - have phun and stay tuned :-)

djelau
Normal user
Posts: 30
Joined: 08 Nov 2019, 15:33
Location: France

Re: Support for PZEM 004T Energy monitor

#214 Post by djelau » 24 Aug 2020, 11:49

Would you recommend that or can I drive the D1 mini with 5V to the GPIO Pins without having fear to burn it?
For professional application (I'm electronic engineer), I would say that it is forbidden. The D1 datasheet says max input voltage 3V3. And we always apply some margin to improve reliability. So I would recommend 3V max on the input.

For my personnal use, I try to have a simple design, easy to replace in case of failure. In my case, environmental conditions are very favorable (external temperature ~20°, low temperature variation, no vibration, no acceleration, no extrem humidity, no pressure, low EMC field). Thus I use 5V since more than 1 year and my wemos is stil alive.

Your proposal of level shifter will work.
I don't measure the consumption of PZEM.

xxrock
Normal user
Posts: 7
Joined: 01 Jul 2020, 17:50

Re: Support for PZEM 004T Energy monitor

#215 Post by xxrock » 27 Aug 2020, 17:56

djelau,
I use your version of ESPEasy with PZEM004T support. It works great. I need additionally connect AM2320 sensor (temperature+humidity). It support by original version of ESPEasy, but not yours. Is it possible add support of this device to your version of firmware?

User avatar
Andrew Mamohin
Normal user
Posts: 23
Joined: 12 Jun 2020, 08:30
Location: Belarus, Gomel
Contact:

Re: Support for PZEM 004T Energy monitor

#216 Post by Andrew Mamohin » 04 Sep 2020, 17:40

xxrock wrote: 27 Aug 2020, 17:56 djelau,
Is it possible add support of this device to your version of firmware?
I subscribe to this request. I want a new version too. Please!
Andy.

djelau
Normal user
Posts: 30
Joined: 08 Nov 2019, 15:33
Location: France

Re: Support for PZEM 004T Energy monitor

#217 Post by djelau » 05 Sep 2020, 11:53

Hi,

I compile this version with AM2320:
ESP_Easy_mega_20200905_normal_ESP8266_4M1M.zip
(567.35 KiB) Downloaded 43 times
I don't test it, I only connect to the Wemos and check devices are available (PZEM and AM2320)

TD-er
Core team member
Posts: 3174
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Support for PZEM 004T Energy monitor

#218 Post by TD-er » 05 Sep 2020, 14:33

Is it based on different source code compared to what is in the main repository?
If so, can you make a pull request?

djelau
Normal user
Posts: 30
Joined: 08 Nov 2019, 15:33
Location: France

Re: Support for PZEM 004T Energy monitor

#219 Post by djelau » 05 Sep 2020, 22:20

TD-er wrote: 05 Sep 2020, 14:33 Is it based on different source code compared to what is in the main repository
I add the PZEM code and the associated libraries.
And I modify define_plugin_sets.h in order to add my plugin and activate the AM2320 plugin.
Otherwise, initial source code hasn't been modified.

What do you call different source code ?

TD-er
Core team member
Posts: 3174
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Support for PZEM 004T Energy monitor

#220 Post by TD-er » 06 Sep 2020, 11:46

I get it then is one of the playground plugins?
If so, which is it, then we can add it to the main repository.

olegvstt
Normal user
Posts: 8
Joined: 10 Sep 2020, 11:38

Re: Support for PZEM 004T Energy monitor

#221 Post by olegvstt » 10 Sep 2020, 12:44

Help please, I can not connect PZEM-017 to the ESP Easy. Is it possible to make a bin file like ESP_Easy_mega-20191003_PZEM_core_ESP8266_4M1M.bin only for PZEM-017.

olegvstt
Normal user
Posts: 8
Joined: 10 Sep 2020, 11:38

Re: Support for PZEM 004T Energy monitor

#222 Post by olegvstt » 10 Sep 2020, 12:57

I have pzem-017 v1.0 at https://github.com/maxzerker/PZEM-017-v1 there is a library, but I don't know how to add to ESP Easy.

olegvstt
Normal user
Posts: 8
Joined: 10 Sep 2020, 11:38

Re: Support for PZEM 004T Energy monitor

#223 Post by olegvstt » 12 Sep 2020, 08:50

Please tell me how you can integrate the library https://github.com/maxzerker/PZEM-017-v1 into ESP Easy.

djelau
Normal user
Posts: 30
Joined: 08 Nov 2019, 15:33
Location: France

Re: Support for PZEM 004T Energy monitor

#224 Post by djelau » 14 Sep 2020, 17:21

olegvstt wrote: 12 Sep 2020, 08:50 lease tell me how you can integrate the library
Hi,

I would say:
- Download the source code from official repository here
- Download PZEM004Tv30.cpp and _P251_PZEM004Tv3.ino in my fork here
- In PZEM004Tv30.cpp and _P251_PZEM004Tv3.ino, change library PZEM004Tv30.h by pzem-017 library
- Integrate these 3 files in the official source code + update plugin list
- Compile with a tool such as vscode + plateformio

olegvstt
Normal user
Posts: 8
Joined: 10 Sep 2020, 11:38

Re: Support for PZEM 004T Energy monitor

#225 Post by olegvstt » 15 Sep 2020, 12:40

Thanks, I'll try to do it. I'm wondering if there is a ready-made bin file for PZEM 017. Maybe someone has already done it, otherwise I'm a beginner in programming.

olegvstt
Normal user
Posts: 8
Joined: 10 Sep 2020, 11:38

Re: Support for PZEM 004T Energy monitor

#226 Post by olegvstt » 15 Sep 2020, 16:25

I tried it, it didn't work. Can anyone have a bin file PZEM-017 for ESPEasy, send Please.

olegvstt
Normal user
Posts: 8
Joined: 10 Sep 2020, 11:38

Re: Support for PZEM 004T Energy monitor

#227 Post by olegvstt » 16 Sep 2020, 09:42

- Integrate these 3 files in the official source code + update plugin list
Please describe how to integrate these 3 files into VS Code.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 11 guests