Support for PZEM 004T Energy monitor

Moderators: grovkillen, Stuntteam, TD-er

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

Re: Support for PZEM 004T Energy monitor

#251 Post by TD-er » 22 Oct 2020, 16:28

What do you mean?

This sensor is using the (Hardware) serial port, so you must uncheck "Enable Serial port:" on the Tools->Advanced page.
This does make sure no logs are sent to the serial port and also any incomming data is not interpreted as commands and thus allows exclusive access to the serial port for the plugin.

ssd
Normal user
Posts: 53
Joined: 19 Aug 2020, 12:04

Re: Support for PZEM 004T Energy monitor

#252 Post by ssd » 26 Oct 2020, 05:32

TD-er wrote: 22 Oct 2020, 16:28 What do you mean?

This sensor is using the (Hardware) serial port, so you must uncheck "Enable Serial port:" on the Tools->Advanced page.
This does make sure no logs are sent to the serial port and also any incomming data is not interpreted as commands and thus allows exclusive access to the serial port for the plugin.
I have kept the settings as it is and still receiving accurate readings.

tparvais
Normal user
Posts: 99
Joined: 28 Oct 2015, 23:13

Re: Support for PZEM 004T Energy monitor

#253 Post by tparvais » 17 Dec 2020, 21:03

Hello
finally, how is it possible to compile easily PZEM plugin ?
i tried with P171 from playground, but it complains no *.h library as it is not provided.

and from this source , https://github.com/djelau/ESPEasyPlugin ... v30-master i don't see the trick as it is not a plugin format


Thomas

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

Re: Support for PZEM 004T Energy monitor

#254 Post by TD-er » 17 Dec 2020, 22:22

Isn't the code in the mega branch working as it should?
See P102: https://github.com/letscontrolit/ESPEas ... 004Tv3.ino

tparvais
Normal user
Posts: 99
Joined: 28 Oct 2015, 23:13

Re: Support for PZEM 004T Energy monitor

#255 Post by tparvais » 18 Dec 2020, 09:20

TD-er wrote: 17 Dec 2020, 22:22 Isn't the code in the mega branch working as it should?
See P102: https://github.com/letscontrolit/ESPEas ... 004Tv3.ino
thanks, I miss it as it was not declare in Custom_Sample.h

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

Re: Support for PZEM 004T Energy monitor

#256 Post by TD-er » 18 Dec 2020, 23:01

Yep that one needs an update as well indeed.

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

Re: Support for PZEM 004T Energy monitor

#257 Post by ice77 » 16 Jan 2021, 20:11

I have seen, that now following firmware exists:

ESP_Easy_mega_20210114_energy_ESP8266_4M1M.bin

Is the functionality the same as the version compiled from DJELAU?

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

Re: Support for PZEM 004T Energy monitor

#258 Post by TD-er » 16 Jan 2021, 20:51

I have not tested it myself.
The only thing I did, was update the existing code from the playground to match the current code base and thus it should be functional identical, or at least do what the original code did + probably some more as added in newer code changed in the ESPEasy core.

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

Re: Support for PZEM 004T Energy monitor

#259 Post by ice77 » 16 Jan 2021, 22:22

Thank you for your reply
I will test it and let you know if the functionality is the same

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

Re: Support for PZEM 004T Energy monitor

#260 Post by Andrew Mamohin » 17 Jan 2021, 06:44

I installed this firmware a few days ago. Yes, the plugin works fine. But, I had to configure the PZEM device again.
Andy.

User avatar
Ath
Normal user
Posts: 1807
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Support for PZEM 004T Energy monitor

#261 Post by Ath » 17 Jan 2021, 09:51

Andrew Mamohin wrote: 17 Jan 2021, 06:44 I installed this firmware a few days ago. Yes, the plugin works fine. But, I had to configure the PZEM device again.
The plugin got a new plugin-id when it was moved from the plugin-playground to the main repository (to keep the numbers consecutive). As the settings are related to this plugin-id you'll have to re-configure.
/Ton

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

Re: Support for PZEM 004T Energy monitor

#262 Post by Andrew Mamohin » 17 Jan 2021, 10:57

Ath wrote: 17 Jan 2021, 09:51 The plugin got a new plugin-id
Yes I understand this.
Andy.

Zigismundus
Normal user
Posts: 1
Joined: 16 Mar 2021, 19:44

Re: Support for PZEM 004T Energy monitor

#263 Post by Zigismundus » 16 Mar 2021, 19:48

Did anyone had tried to connect PZEM004T to arduino Nano 33 IoT?
Apparently this arduino does not support SoftwareSerial library, and PZEM004T library is using SoftwareSerial,
any idea how to create compatibility to this arduino board?

This is from arduino official site:

Serial ports on the Arduino NANO 33 IoT

The USB connector of the board is directly connected to the USB host pins of the SAMD21. This routing enables you to use the Arduino NANO 33 IoT as a client USB peripheral (acting as a mouse or a keyboard connected to the computer) or as a USB host device so that devices like a mouse, keyboard, or an Android phone can be connected to the Arduino NANO 33 IoT. This port can also be used as a virtual serial port using the Serial object in the Arduino programming language. The RX0 and TX1 pins are a second serial port available as Serial1

So I've tried to simply write the code like this:

Code: Select all

#include <PZEM004Tv30.h>

PZEM004Tv30 pzem(Serial1);

void setup() {
  Serial.begin(115200);

  Serial.print("Reset Energy");
  pzem.resetEnergy();


  Serial.print("Set address to 0x42");
  pzem.setAddress(0x42);
}

void loop() {
  float volt = pzem.voltage();
  float cur = pzem.current();
  float powe = pzem.power();
  float ener = pzem.energy();
  float freq = pzem.frequency();
  float pf = pzem.pf();
  

  Serial.print(volt);
  Serial.print(" ");
  Serial.print(cur);
  Serial.print(" ");
  Serial.print(powe);
  Serial.print(" ");
  Serial.print(ener,3);
  Serial.print(" ");
  Serial.print(freq);
  Serial.print(" ");
  Serial.println(pf);

  delay(1000);
}
But getting these errors in the arduino IDE:

error: no matching function for call to 'PZEM004Tv30::PZEM004Tv30(Uart&)'

PZEM004Tv30 pzem(Serial1);

Documents\Arduino\libraries\PZEM-004T-v30/PZEM004Tv30.h:65:5: note: candidate: PZEM004Tv30::PZEM004Tv30(arduino::HardwareSerial*, uint8_t)

PZEM004Tv30(HardwareSerial* port, uint8_t addr=PZEM_DEFAULT_ADDR);

^~~~~~~~~~~

Documents\Arduino\libraries\PZEM-004T-v30/PZEM004Tv30.h:59:7: note: candidate: constexpr PZEM004Tv30::PZEM004Tv30(const PZEM004Tv30&)

class PZEM004Tv30

^~~~~~~~~~~

exit status 1
no matching function for call to 'PZEM004Tv30::PZEM004Tv30(Uart&)'

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

Re: Support for PZEM 004T Energy monitor

#264 Post by ice77 » 19 Apr 2021, 18:50

TD-er wrote: 16 Jan 2021, 20:51 I have not tested it myself.
The only thing I did, was update the existing code from the playground to match the current code base and thus it should be functional identical, or at least do what the original code did + probably some more as added in newer code changed in the ESPEasy core.
I was searching for the Espeasy binary which offers the plugin for multiple PZEM004 V3... but in the new ESP Easy Mega I don't find any binary that offers support for the pzem 004 V3.
Which do I have to use for this scenario?

hope to hear you soon

ice77

User avatar
Ath
Normal user
Posts: 1807
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Support for PZEM 004T Energy monitor

#265 Post by Ath » 19 Apr 2021, 19:37

Have you tried a .bin with 'energy' in the name?
/Ton

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

Re: Support for PZEM 004T Energy monitor

#266 Post by ice77 » 19 Apr 2021, 19:55

ok I did find it just a few minutes ago

in the actual ESP Mega release there is no *energy file (ESPEasy_ESP82xx_mega-20201125.zip).

In the "old" release I did find the *energy file (ESPEasy_ESP82xx_mega-20210114.zip)

why it wasnt recompiled in the new release???

thanks in advance

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

Re: Support for PZEM 004T Energy monitor

#267 Post by TD-er » 19 Apr 2021, 20:01

The build script detects when a compiled bin file exceeds its maximum size.
So if it wasn't included in the ZIP, it very likely exceeded the max. size you can flash.

User avatar
Ath
Normal user
Posts: 1807
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Support for PZEM 004T Energy monitor

#268 Post by Ath » 19 Apr 2021, 20:20

ice77 wrote: 19 Apr 2021, 19:55 in the actual ESP Mega release there is no *energy file (ESPEasy_ESP82xx_mega-20201125.zip).
I think at that time, November 2020, the Energy build wasn't defined yet.
/Ton

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

Re: Support for PZEM 004T Energy monitor

#269 Post by ice77 » 20 Apr 2021, 02:03

Ath wrote: 19 Apr 2021, 20:20
ice77 wrote: 19 Apr 2021, 19:55 in the actual ESP Mega release there is no *energy file (ESPEasy_ESP82xx_mega-20201125.zip).
I think at that time, November 2020, the Energy build wasn't defined yet.
Oh I did a mistake. I took the wrong filename of the ESP mega release in the upper post. Now I'm writing over the cellular phone but checked out the newest ESP mega release file and there isn't the energy release included.

Do I have to take only the one release from January or could there be the chance to get release updates with also included pzem004 V3 device?

Release of dejelau works also fine, but i waited for the pzem device being included into the regular release to get security updates on the ESP easy software.

jmexposi
Normal user
Posts: 3
Joined: 08 Jul 2021, 22:33

Re: Support for PZEM 004T Energy monitor

#270 Post by jmexposi » 08 Jul 2021, 23:17

Hi,

Is the plugin Energy (AC) - PZEM-004Tv30-Multiple compatible/usable with multiplexer functionality?

I add a BME280 Temperature sensor into multiplexer channel 1 and works fine, but when I add a PZEM device the config of software serial options are different. I can't select the channel... only appears a address option list (>0x48 ¿?) and channels list (A/B ¿?) .

Config:
hardware.jpg
hardware.jpg (89.18 KiB) Viewed 16848 times
devices.jpg
devices.jpg (105.03 KiB) Viewed 16848 times
device_pzem.jpg
device_pzem.jpg (122.58 KiB) Viewed 16848 times

tnks

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

Re: Support for PZEM 004T Energy monitor

#271 Post by TD-er » 09 Jul 2021, 08:58

The red text suggests, each must be used on a separate serial bus.
N.B. I have not tested this plugin myself, but based on the text marked in red, I would think those cannot be shared on the same serial bus.

So either you use one of those I2C to serial bridges from NXP, or use SW serial for the next one.
I'm not a big fan of SW serial, but it does work for not too 'chatty' devices (N.B. do not use it for GPS..)

Or you can use an ESP32 as those have more GPIO-pins and upto 3 HW serial ports.

jmexposi
Normal user
Posts: 3
Joined: 08 Jul 2021, 22:33

Re: Support for PZEM 004T Energy monitor

#272 Post by jmexposi » 09 Jul 2021, 16:52

First, I take this opportunity to thank you for the work you are doing in this community.

Ok, Tnks!! I will try to test it using the other 2 HWSerial pins (in Software serial mode: I need to integrate 11 PZEM sensors + 2 BME280).
by another hand: I prefer, if it's possible, to use only the HWSerial2 (or SoftSerial 16,17) and a multiplexer.

when I active the multiplexing (hardware) functionality, the I2C Schema on PZEM device changes and I don't understand how to use/configure it or I don't know if this fuctionality isn't implemented yet for PZEM device...

you says for "I2C to serial bridges from NXP": sorry, i don`t understand. I googled and find some examples like I2C to SPI Scenarios but i don't see the idea for my current scenario.

I see the code and (If I'm not wrong) you perform some changes to integrate BME280 with the multiplexer functionality: I try to see it in more detail, but I can't just put the pieces together. exist any doc. reference (multiplexer + BME280 for easyEsp) to review?

This is my current Scenario:
(only for explain and understand the scenario & complexity. If I need help on other topics that are not for PZEM with multiplexer I will open another thread because I have multiple doubts about other devices... like TFT & SD... to integrate into EasyEsp ecosystem but I understand that It's not the correct place... )
IMG_20210709_134015_209.jpg
IMG_20210709_134015_209.jpg (4.17 MiB) Viewed 16813 times
I know and familiar with the PZEM libraries and I made some Arduino Sketches code for ESP32 to read 1 or various PZEMS and outputs into Blynk (or other) and TFT/SD device changing screen information via menus. and for 4-6PZEM works.

The problem (you have already imagined it) it's the number of PZEM devices into a unike I2c Bus (11): it's very, very unstable. (capacitive problems + noise + large nº devices ;( etc...)

I try some solutions like Pollups resistors, diferent electronic & wiring scenarios: something improves but does not finish working.

The idea is to split to multiple I2C buses: 3 PZEMS each bus + 2 BME280 using a multiplexer. I start to change my code to adapt this scenario but y see this wonderful platform and I decide to implement it. (and if it's possible, next steps: add my frontend customizations).

BR
JMER

User avatar
Ath
Normal user
Posts: 1807
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Support for PZEM 004T Energy monitor

#273 Post by Ath » 09 Jul 2021, 17:04

The actual issue is that this plugin is not a 'real' I2C plugin, but a serial-based plugin, and the I2CSerial is one of the options in that config. And in this Serial-type plugin, no support for I2C Multiplexer is available.

I'm not fully sure that it is possible to multiplex these serial adapters reliably (I don't use them, currently), but it would be an enhancement if the I2C Multiplexer support is extended to the serial plugin option. Further investigation would be needed, though.

Can you create an issue on the ESPEasy github issue tracker, so it won't be forgotten? (and it will be registered to your name ;))
/Ton

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

Re: Support for PZEM 004T Energy monitor

#274 Post by TD-er » 09 Jul 2021, 17:34

The NXP I2C to UART chip we do support is the SC16IS752
This one does add 2 UART ports to an ESPEasy module and is connected to ESPEasy via I2C.

jmexposi
Normal user
Posts: 3
Joined: 08 Jul 2021, 22:33

Re: Support for PZEM 004T Energy monitor

#275 Post by jmexposi » 10 Jul 2021, 03:22

Hi,

Ath > Done! https://github.com/letscontrolit/ESPEasy/issues/3701 Tnks!!!

TD-er > Ok! I see that: a UART bridge to split I2c into 2 TX/RX channels --> I will test it: I order 2 from aliexpress (I see that this device is working to control RS485 communication too: I use this for another of my projects!)

To check:
- Only 2 channels (TCA9548a = 8)
- I see that this device only admits 3.3v. Pzem 5v: I try to ajust using resistors...

For the moment I will continue doing tests and try to use the other 2 HWserial that the esp32 has (until I get the order from aliexpress). I will be reviewing the improvements that are made on EasyEsp project. Thanks!!!

BR
JMER

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

Re: Support for PZEM 004T Energy monitor

#276 Post by TD-er » 10 Jul 2021, 11:10

About the RS485.
I've noticed it in the datasheet too, but I don't know if I need to add some code and/or hardware to actually support any specific RS485 features of that chip.
Some RS485 devices are already supported in ESPEasy (e.g. AccuEnergy or Eastron) using any uart port. But then a MAX485 is needed to convert the levels.
So you can already use this I2C to UART chip with RS485, but not using any specific features of that chip.

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

Re: Support for PZEM 004T Energy monitor

#277 Post by ice77 » 27 Aug 2021, 03:43

dear community,

I have several pzem 004t V3.0 that work really really fine. There is no problem in stability - nothing, BUT...

...Now I have found that only the consumption is displayed, but not the direction of current flow. It is not possible to tell whether, for example, a photovoltaic system is feeding electricity into the grid or whether the displayed value represents the consumption in the house (I measure the current at L1, L2, L3 after the electricity meter).

Is there a possibility with the PZEM to recognize whether electricity is fed in or drawn from the electricity supplier?

I look forward to your ideas.

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

Re: Support for PZEM 004T Energy monitor

#278 Post by TD-er » 27 Aug 2021, 08:43

The only way how the direction can be measured with inductor based measurement is when you also measure the voltage at the same time.
And even then it is a bit tricky as you need to determine the phase shift between current and voltage to see which direction the current flows.
I think this is "omitted" on purpose as there is quite a big chance you get false readings, for example when connecting an inductive or capacitive load.
For example an electromotor, or (cheap) switching power supplies.

What I did to measure my solar panels, was using an Eastron module separately for my solar panels.
To compute the total consumption, you still need the current direction of the house. I tapped into the P1 port of my "smart" meter.

To summarize, I totally understand why you need to know the current flow, but I don't think it is possible how you're doing it now.

What you must do to achieve what you want is, you should feed in your production and only measure with the clamps the consumption part.
But I am not sure if that's easy to achieve as you can't simply split the thick main wires (6 mm^2 or more I assume?) and those clamps also need space.

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

Re: Support for PZEM 004T Energy monitor

#279 Post by ice77 » 29 Aug 2021, 05:33

I already thought that it would be very difficult. The problem is that the balcony power plant does not feed in separately, but is simply attached to a phase. This means that there is no dedicated point at which only the electricity is fed in (electricity produced) and no point at which it is only consumed.

I can measure the electricity generated, but I cannot tell whether electricity is being fed into the grid or whether electricity is being drawn.

E.g. 300 watts are generated and fed into L1 and I measure 200 watts on L1 ... then it could be that I only use 100 watts on L1 and 200 watts are fed in ... but it could also be that I produce 300W and consume 500W on L1 (drawing 200 watts).

This is going to be a difficult topic ... I can already see it :-(

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

Re: Support for PZEM 004T Energy monitor

#280 Post by TD-er » 29 Aug 2021, 10:52

As long as you can't detect direction, then you also cannot deduct the actual netto consumption/production.
So you only can handle it if you measure the current, where the current only can go in 1 direction (well given it is AC the current does alternate, but you get the idea :) )

If your solar converter is only using 1 fase, you might want to re-route that one wire to be able to split it.
But remember this is probably one that cannot be turned off and it really is a stiff wire. Here in the Netherlands those wires often are 6 mm^2 solid copper, which you hardly can bend using your hands.
Also you need to have a proper power rail to mount the 3 wires into (one from the grid, one to your fuse for the solar and one to the other groups on that phase)

Don't do it yourself if you cannot remove the main fuse, or turn the power off.
I once did it myself, with the help of a neighbor who was allowed to replace meters and had the tools (and seals and experience) to help me with it.
Still it felt a bit uncomfortable, when the lid to the mains fuses was removed to pull those out. Even though he did it and not me.
You could still accidentally drop in something which would not be protected by a fuse, so I still was a bit nervous when replacing my own fuse box, even though the main fuses were removed.

It really is something to be careful, when operating with unfused mains voltage. Only protected by the main fuses, I still consider quite dangerous as those are "slow" fuses and will only pop when you draw really a lot of current or draw several tens of amps for a longer time.

bubastic
Normal user
Posts: 3
Joined: 12 Jan 2022, 18:47

Re: Support for PZEM 004T Energy monitor

#281 Post by bubastic » 12 Jan 2022, 18:55

Where can I find a working latest build with PZEM 004T Energy monitor support for ESP32 / ESP8266?

kini
Normal user
Posts: 1
Joined: 13 Jan 2022, 10:38

Re: Support for PZEM 004T Energy monitor

#282 Post by kini » 13 Jan 2022, 10:41

bubastic wrote: 12 Jan 2022, 18:55 Where can I find a working latest build with PZEM 004T Energy monitor support for ESP32 / ESP8266?
I have this installed: ESP_Easy_mega_20211003_energy_ESP8266_4M1M Oct 3 2021

bubastic
Normal user
Posts: 3
Joined: 12 Jan 2022, 18:47

Re: Support for PZEM 004T Energy monitor

#283 Post by bubastic » 13 Jan 2022, 11:39

kini wrote: 13 Jan 2022, 10:41 I have this installed:
Thank you and for ESP32 there is an build?

User avatar
Ath
Normal user
Posts: 1807
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Support for PZEM 004T Energy monitor

#284 Post by Ath » 13 Jan 2022, 11:41

bubastic wrote: 13 Jan 2022, 11:39 Thank you and for ESP32 there is an build?
Yes, it is in the .zip file for ESP32 you can download from the Github Release page
/Ton

bubastic
Normal user
Posts: 3
Joined: 12 Jan 2022, 18:47

Re: Support for PZEM 004T Energy monitor

#285 Post by bubastic » 13 Jan 2022, 23:12

kini wrote: 13 Jan 2022, 10:41
bubastic wrote: 12 Jan 2022, 18:55 Where can I find a working latest build with PZEM 004T Energy monitor support for ESP32 / ESP8266?
I have this installed: ESP_Easy_mega_20211003_energy_ESP8266_4M1M Oct 3 2021
I don't see PZEM 004T Energy monitor in the list
64664764.JPG
64664764.JPG (55.12 KiB) Viewed 12137 times

User avatar
Ath
Normal user
Posts: 1807
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Support for PZEM 004T Energy monitor

#286 Post by Ath » 14 Jan 2022, 07:37

The plugin name is somewhat non-standard, missing the 'Energy (AC) - ' prefix, this is in the current source: '# define PLUGIN_NAME_102 "PZEM-004Tv30-Multiple [TESTING]"'
/Ton

User0815
Normal user
Posts: 2
Joined: 22 Jan 2022, 17:03

Re: Support for PZEM 004T Energy monitor

#287 Post by User0815 » 22 Jan 2022, 17:23

Sorry for asking this stupid question - but after reading mostly all of the thread and testing something on my own it's still not clear to me:

How many indepented PZEM-OO4T will I be able to use on a ESP32 using EspEasy - WITHOUT - any I2C-UART exentsion boards?

I naivly thought it might be at least three since the ESP32 supports three HW-UARTs - but as also mentioned here perviously - It seems that only one HW-Serial could be used (the one which is defined for the first PZEM module).
There is also this hint:
This PZEM is the first. Its configuration of serial Pins will affect next PZEM.
If several PZEMs foreseen, don't use HW serial (or invert Tx and Rx to configure as SW serial).
Especially the part in brackets of the hint above is a mystery for me.
How could I "invert Tx and Rx" ?
And even when I "invert" this - how could I use two or three PZEM-004T at the same time?
Do they need to connect to the same UART pins - and do I need to progam/set first different adresses to the serveral PZEM-modules?

What is also strange: In Post #242 (link see below) there is the possibility to select "Software Serial" in the interface settings of the PZEM-module.
viewtopic.php?p=47459#p47459
But when using the latest EspEasy-Build (see end of this post) on ESP32 then I can only choose from "I2C Serial, HW Serial0,HW Serial1,HW Serial2" - but no way to choose "Software Serial".
PZEM_004T_InterfaceSelection.jpg
PZEM_004T_InterfaceSelection.jpg (26.27 KiB) Viewed 11854 times
I would appreciate any helpful suggestions/explanations.

Thanks.

P.S. I using currently a ESP32 Dev borad (Node32S) with ESP_Easy_mega_20211224_energy_ESP32_4M316k - and try to get three PZEM-004T working - for only one it's working fine while using HW serial. :D

rol-rider
Normal user
Posts: 43
Joined: 02 Oct 2016, 12:36

Re: Support for PZEM 004T Energy monitor

#288 Post by rol-rider » 27 Jan 2022, 01:16

Hello,
is there this sue plugin (PZEM004) for WT32 ETH01 board
I couldn't find a binary file for this board with this plugin.
thank you


sorry for my english....google translate !
sorry for my English ! i use google translat.

User avatar
Ath
Normal user
Posts: 1807
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Support for PZEM 004T Energy monitor

#289 Post by Ath » 27 Jan 2022, 07:47

That combination (ENERGY + ETH) currently isn't available, and the same goes for the DISPLAY build.

I'll see what can be done about that.
/Ton

rol-rider
Normal user
Posts: 43
Joined: 02 Oct 2016, 12:36

Re: Support for PZEM 004T Energy monitor

#290 Post by rol-rider » 27 Jan 2022, 10:55

Cette combinaison (ENERGY + ETH) n'est actuellement pas disponible, et il en va de même pour la version DISPLAY.

Je vais voir ce qu'on peut faire à ce sujet.
all my gratitude if this version existed !
Supercalifragilisticexpialidocious !
sorry for my English ! i use google translat.

User0815
Normal user
Posts: 2
Joined: 22 Jan 2022, 17:03

Re: Support for PZEM 004T Energy monitor

#291 Post by User0815 » 30 Jan 2022, 14:21

User0815 wrote: 22 Jan 2022, 17:23 How many independent PZEM-OO4T will I be able to use on a ESP32 using EspEasy - WITHOUT - any I2C-UART extension boards?
As no one else here seems to have answers I would like to share with those, who might also interested in an answer or try to using this hardware, what I have found out so far:

1) On the current latest ESP32 version there is no opportunity to use "Software Serial" for PZEM-004T - whereas in the ESP8266 version it is possible. No idea why "SoftwareSerial" is not available on ESP32 - maybe anybody here knows that? But in the end it doesn’t matters for me, as ESP32 seems to be having no advantage (as independent HW serial buses couldn’t be used for PZEM by ESPEasy) I switched back to an ESP8226.

2) On ESP8266 it is possible to use multiple PZEM-004T (with "Software Serial)" by first - programming a unique address to each device.
Note: one only device must be connected to the serial bus at that time.
Second: When each device has it's unique address, connecting all RX-PINs of all PZEM-004T together to the TX-PIN of ESP8266 and all TX-PINs from all PZEM-004T together to the RX-PIN of the ESP8226.
Note: the ESP8266 and ESP32 might not be 5 Volt tolerant - there are many "magic" circuits plans published when you search for it in the Web to avoid damage to ESP8266 and ESP32 - but there are also posts saying that they run this scenario even without additional measure for years without any damage of the ESP8266/ESP32.
Having said this: It's up to you how risk-taking you'll be. I have used/tried it on both ESP32/ESP8266 without any measure - and both boards are still working fine. The only thing I have introduce now is a 200 Ohm resistor between the TX-side of the PZEMs and the RX-side of the ESP8266 (like I have used for years now on CO2 projects with Senseair S8 without problems)
There are also circuits plans with diodes and pull up resistors (e.g. https://user-images.githubusercontent.c ... d35db8.jpg) but for me it's working even without that additional components. But it might be useful if it's not working for you to give it a try.

I would expect that such information would be available in the ESPEasy wiki or in the "help" link in the device definition in ESPEasy - but there is currently only a link to Plugin102 - with no content on it. :cry:

So, currently I running three PZEM-004T in parallel on an ESP8266 with SoftwareSerial and the above mentioned setup.

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

Re: Support for PZEM 004T Energy monitor

#292 Post by djelau » 07 Feb 2022, 12:07

2) On ESP8266 it is possible to use multiple PZEM-004T (with "Software Serial)" by first - programming a unique address to each device.
Note: one only device must be connected to the serial bus at that time.
Yes this is exatcly like that. To configure the adress, only one PZEM should be connected at time. Once each PZEM is configured, then all Tx can be connected together and all Rx can be connected together. Only one UART (HW or SW) is necessary: I test with 4 PZEM, but should work with more.
This PZEM is the first. Its configuration of serial Pins will affect next PZEM.
If several PZEMs foreseen, don't use HW serial (or invert Tx and Rx to configure as SW serial).

Especially the part in brackets of the hint above is a mystery for me.
How could I "invert Tx and Rx" ?
It means that if you want to use GPIO3(Rx) and GPIO1(Tx) with several PZEM, it is possible under condition that you configure as SW serial and wire GPIO3 on PZEM RX and GPIO1 on PZEM TX. If you make a regular connection GPIO3 on PZEM TX and GPIO1 on PZEM RX, it will run as HW serial but a bug exists where some frames of PZEM are sometime missed.

mihai.icey.ro
Normal user
Posts: 15
Joined: 01 May 2019, 00:24

Re: Support for PZEM 004T Energy monitor

#293 Post by mihai.icey.ro » 12 Feb 2022, 08:55

Hello,
Can someone explain to me something about the PZEM?

The value from Energy_WH it's the total consumption from the beginning of the device till the present?

If i want to see all the power used from Day1 to Day2, i need to make the sum from day1 to day2.

do I have to reduce the consumption of day 1 from day 2?

I want to understand the logic because i want to calculate the price of the energy used.

It gives me a headache


Thank you!

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

Re: Support for PZEM 004T Energy monitor

#294 Post by djelau » 12 Feb 2022, 20:52

Hello

Energy_WH is the total power consumption since the PZEM is first powered (it is power loss tolerant).

So each day, the Energy_WH value is higher than previous day. So Day1 consumption =Day2 @ 00h00 - Day1 @ 00h00

Or you can reset the Energy_WH value at the begining of each day and then get the value without any calculation at the end on the current day.
Reminder to reset the value:
http://*espeasyip*/control?cmd=resetenergy,*PZEM address*

mihai.icey.ro
Normal user
Posts: 15
Joined: 01 May 2019, 00:24

Re: Support for PZEM 004T Energy monitor

#295 Post by mihai.icey.ro » 13 Feb 2022, 09:20

But something is not right and I don't know how to test it.

How it's possible to consume in 24 hours just 308.35Wh?

I have a server that consumes 130w. a switch with 50W, some lights and a laptop.

It's there a way to check it?

Thanks!

Also, does espeasy store the last value in case of a power failure?

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

Re: Support for PZEM 004T Energy monitor

#296 Post by djelau » 13 Feb 2022, 12:12

About energy unit:
< 10 kWh, unit is Wh (1 kWh= 1000 Wh), such as : 9999 Wh.
10 kWh and more,unit is kWh, such as : 9999,99 kWh
So if your pzem is running for a long time, then the unit is kWh.

1. What type of current probe do you use ? If open one, be sure that it is stongly closed around a single wire.
2. When you say 130W, how do you get this information ? a measurement or on the label ? Because on the label, it is a maximum.
3. It's there a way to check it? => Have a look at Power_W value to confirm the mean value ~13W (indeed it's low, so check 1.).
4. Values are stored in PZEM directly. Neither calculation, nor mesurement are performed at ESP level. Everything is made by PZEM. Only communication to retreive value is performed by ESP. In case of power loss, value will be restore in ESP as soon as PZEM sends its values.

mojso
Normal user
Posts: 6
Joined: 04 Jan 2021, 20:01

Re: Support for PZEM 004T Energy monitor

#297 Post by mojso » 13 Feb 2022, 18:38

how to connect wemos d1 mini properly with pzem 004T v3.0 100A? schematic rx / tx as in this picture
can i use 3.3v with the same schematic or do I need a
1k ohm resistor, from the 5v pin in the optocoupler
20220213_182926.jpg
20220213_182926.jpg (307.73 KiB) Viewed 11218 times
Or
20220213_185159.jpg
20220213_185159.jpg (326.45 KiB) Viewed 11215 times

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

Re: Support for PZEM 004T Energy monitor

#298 Post by djelau » 13 Feb 2022, 22:11

@mojso

Supply PZEM with 5V directly (as your first schematic. No 1k requested). But don't use D3 and D4 for communication because these pin can prevent ESP to boot. D1,D2 can be used in place.

mojso
Normal user
Posts: 6
Joined: 04 Jan 2021, 20:01

Re: Support for PZEM 004T Energy monitor

#299 Post by mojso » 13 Feb 2022, 22:33

djelau wrote: 13 Feb 2022, 22:11 @mojso

Supply PZEM with 5V directly (as your first schematic. No 1k requested). But don't use D3 and D4 for communication because these pin can prevent ESP to boot. D1,D2 can be used in place.
thanks for the reply. in espeasy pzem settings d1 and d2 are not allowed
maybe D6 and D7 will be ok to use

Screenshot_20220213-223121_Chrome.jpg
Screenshot_20220213-223121_Chrome.jpg (131.79 KiB) Viewed 11191 times

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

Re: Support for PZEM 004T Energy monitor

#300 Post by djelau » 14 Feb 2022, 10:22

mojso wrote: 13 Feb 2022, 22:33 thanks for the reply. in espeasy pzem settings d1 and d2 are not allowed
Menu Hardware -> I2C Interface -> GPIO ⇄ SDA = None / GPIO → SCL = None
Then, D1,D2 will be available.

(Same for D9-Rx/D10-Tx in Tools->Advanced -> uncheck "Enable Serial port")

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests