Page 5 of 7

Re: Support for PZEM 004T Energy monitor

Posted: 06 Jul 2020, 18:10
by djelau
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.

Re: Support for PZEM 004T Energy monitor

Posted: 09 Jul 2020, 14:41
by xxrock
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 1521772 times

Re: Support for PZEM 004T Energy monitor

Posted: 09 Jul 2020, 15:25
by djelau
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.

Re: Support for PZEM 004T Energy monitor

Posted: 09 Jul 2020, 16:12
by TD-er
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.

Re: Support for PZEM 004T Energy monitor

Posted: 09 Jul 2020, 17:36
by xxrock
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

Re: Support for PZEM 004T Energy monitor

Posted: 09 Jul 2020, 18:47
by grovkillen
Could you show how you have mounted it, over one wire? Or else the net sum will always be zero.

Re: Support for PZEM 004T Energy monitor

Posted: 09 Jul 2020, 20:08
by TD-er
What Jimmy said (Grovkillen), you should only have 1 wire of the AC string going through this coil, not both wires.

Re: Support for PZEM 004T Energy monitor

Posted: 09 Jul 2020, 20:52
by djelau
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.

Re: Support for PZEM 004T Energy monitor

Posted: 10 Jul 2020, 06:36
by xxrock
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 1521688 times

Re: Support for PZEM 004T Energy monitor

Posted: 10 Jul 2020, 11:16
by djelau
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 !

Re: Support for PZEM 004T Energy monitor

Posted: 05 Aug 2020, 05:19
by ice77
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

Re: Support for PZEM 004T Energy monitor

Posted: 14 Aug 2020, 21:32
by djelau
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.

Re: Support for PZEM 004T Energy monitor

Posted: 23 Aug 2020, 19:10
by ice77
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 1521160 times
Here is a pic of the power measurement of an Intel NUC 8i5 with proxmox.

dear community - have phun and stay tuned :-)

Re: Support for PZEM 004T Energy monitor

Posted: 24 Aug 2020, 11:49
by djelau
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.

Re: Support for PZEM 004T Energy monitor

Posted: 27 Aug 2020, 17:56
by xxrock
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?

Re: Support for PZEM 004T Energy monitor

Posted: 04 Sep 2020, 17:40
by Andrew Mamohin
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!

Re: Support for PZEM 004T Energy monitor

Posted: 05 Sep 2020, 11:53
by djelau
Hi,

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

Re: Support for PZEM 004T Energy monitor

Posted: 05 Sep 2020, 14:33
by TD-er
Is it based on different source code compared to what is in the main repository?
If so, can you make a pull request?

Re: Support for PZEM 004T Energy monitor

Posted: 05 Sep 2020, 22:20
by djelau
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 ?

Re: Support for PZEM 004T Energy monitor

Posted: 06 Sep 2020, 11:46
by TD-er
I get it then is one of the playground plugins?
If so, which is it, then we can add it to the main repository.

Re: Support for PZEM 004T Energy monitor

Posted: 10 Sep 2020, 12:44
by olegvstt
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.

Re: Support for PZEM 004T Energy monitor

Posted: 10 Sep 2020, 12:57
by olegvstt
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.

Re: Support for PZEM 004T Energy monitor

Posted: 12 Sep 2020, 08:50
by olegvstt
Please tell me how you can integrate the library https://github.com/maxzerker/PZEM-017-v1 into ESP Easy.

Re: Support for PZEM 004T Energy monitor

Posted: 14 Sep 2020, 17:21
by djelau
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

Re: Support for PZEM 004T Energy monitor

Posted: 15 Sep 2020, 12:40
by olegvstt
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.

Re: Support for PZEM 004T Energy monitor

Posted: 15 Sep 2020, 16:25
by olegvstt
I tried it, it didn't work. Can anyone have a bin file PZEM-017 for ESPEasy, send Please.

Re: Support for PZEM 004T Energy monitor

Posted: 16 Sep 2020, 09:42
by olegvstt
- Integrate these 3 files in the official source code + update plugin list
Please describe how to integrate these 3 files into VS Code.

Re: Support for PZEM 004T Energy monitor

Posted: 11 Oct 2020, 16:03
by olegvstt
Please help me connect the PZEM-017 to EspEasy.

Re: Support for PZEM 004T Energy monitor

Posted: 12 Oct 2020, 23:52
by djelau
olegvstt wrote: 11 Oct 2020, 16:03 Please help me connect the PZEM-017 to EspEasy.
I don't think you will have lot of answers in this topic for PZEM 004T. Better way would be to open a new topic about PZEM017.

About directory organization, for PZEM004Tv30.cpp and PZEM004Tv30.h, I create a new directory in \lib\PZEM-004T-v30
For the P251_PZEM004Tv3.ino file, I put it in \src
And finally, in define_plugin_sets.h, I add #define USES_P251 to activate the plugin.

Re: Support for PZEM 004T Energy monitor

Posted: 15 Oct 2020, 12:50
by ssd
Hi,

Can someone please provide connection diagram for connecting PZEM-004t withesp8266 nodemcu and load? I am unable to get any value on ESPeasy web interface.

Re: Support for PZEM 004T Energy monitor

Posted: 15 Oct 2020, 13:47
by IgorTu
Hi!
I've problem with P_251 plugin compile under platformio-ide. follow errors was happen:

Compiling .pio/build/custom_ESP8266_4M1M/libeca/Regexp/Regexp.cpp.o
lib/PZEM-004T-v30/PZEM004Tv30.cpp: In constructor 'PZEM004Tv30::PZEM004Tv30(uint8_t, uint8_t, uint8_t)':
lib/PZEM-004T-v30/PZEM004Tv30.cpp:58:56: error: no matching function for call to 'ESPeasySerial::ESPeasySeria
l(uint8_t&, uint8_t&)'
swSerial= new ESPeasySerial(receivePin, transmitPin);
^
lib/PZEM-004T-v30/PZEM004Tv30.cpp:58:56: note: candidates are:
In file included from lib/PZEM-004T-v30/PZEM004Tv30.h:31:0,
from lib/PZEM-004T-v30/PZEM004Tv30.cpp:1:
.pio/libdeps/custom_ESP8266_4M1M/ESPeasySerial/ESPeasySerial.h:220:3: note: ESPeasySerial::ESPeasySerial(ESPE
asySerialPort, int, int, bool, unsigned int, bool)
ESPeasySerial(ESPEasySerialPort port,
^
.pio/libdeps/custom_ESP8266_4M1M/ESPeasySerial/ESPeasySerial.h:220:3: note: candidate expects 6 arguments,
2 provided
.pio/libdeps/custom_ESP8266_4M1M/ESPeasySerial/ESPeasySerial.h:210:7: note: constexpr ESPeasySerial::ESPeasyS
erial(const ESPeasySerial&)
class ESPeasySerial : public Stream {
^
.pio/libdeps/custom_ESP8266_4M1M/ESPeasySerial/ESPeasySerial.h:210:7: note: candidate expects 1 argument, 2
provided
*** [.pio/build/custom_ESP8266_4M1M/lib946/PZEM-004T-v30/PZEM004Tv30.cpp.o] Error 1

Re: Support for PZEM 004T Energy monitor

Posted: 15 Oct 2020, 13:58
by TD-er
You are probably either missing this
#include <ESPeasySerial.h>

or you have not included the lib_dep in the platformio.ini configuration.

Code: Select all

lib_deps                  = https://github.com/TD-er/ESPEasySerial.git#v2.0.5
You probably need more then just this lib.
See the platformio_xxx.ini files in the repository.

Re: Support for PZEM 004T Energy monitor

Posted: 15 Oct 2020, 14:01
by Ath
ssd wrote: 15 Oct 2020, 12:50 Hi,

Can someone please provide connection diagram for connecting PZEM-004t withesp8266 nodemcu and load? I am unable to get any value on ESPeasy web interface.
If you start reading from message #205 in this thread and down it should be quite clear.

Re: Support for PZEM 004T Energy monitor

Posted: 15 Oct 2020, 15:06
by IgorTu
TD-er wrote: 15 Oct 2020, 13:58 You are probably either missing this
#include <ESPeasySerial.h>

or you have not included the lib_dep in the platformio.ini configuration.

Code: Select all

lib_deps                  = https://github.com/TD-er/ESPEasySerial.git#v2.0.5
You probably need more then just this lib.
See the platformio_xxx.ini files in the repository.
Thanks! You absolutely right! (it was happen, not full libraries depensity integration) Re-depensity resolve it error

Re: Support for PZEM 004T Energy monitor

Posted: 15 Oct 2020, 16:15
by IgorTu
Ho to use DAC output in PCF8591?

Re: Support for PZEM 004T Energy monitor

Posted: 15 Oct 2020, 16:53
by IgorTu
while compile normal_ESP8266_4M1 or dev_
happen follow errors:
Compiling .pio/build/normal_ESP8266_4M1M_VCC/src/src/Commands/Blynk.cpp.o
/PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino: In function 'boolean Plugin_
251(byte, EventStruct*, String&)':
/PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino:54:37: error: 'SENSOR_TYPE_QUAD' was not declared in this scope
Device[deviceCount].VType = SENSOR_TYPE_QUAD;
^
In file included from /PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino:11:0:
.pio/libdeps/normal_ESP8266_4M1M_VCC/PZEM-004T-v30/PZEM004Tv30.h:82:10: error: 'void PZEM004Tv30::init(uint8_
t)' is private
void init(uint8_t addr); // Init common to all constructors
^
/PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino:226:46: error: within this co
ntext
P251_PZEM_sensor->init(P251_PZEM_ADDR);
^
In file included from /PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino:11:0:
.pio/libdeps/normal_ESP8266_4M1M_VCC/PZEM-004T-v30/PZEM004Tv30.h:82:10: error: 'void PZEM004Tv30::init(uint8_
t)' is private
void init(uint8_t addr); // Init common to all constructors
^
/PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino:259:48: error: within this context
P251_PZEM_sensor->init(P251_PZEM_ADDR);
^
In file included from /PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino:11:0:
.pio/libdeps/normal_ESP8266_4M1M_VCC/PZEM-004T-v30/PZEM004Tv30.h:82:10: error: 'void PZEM004Tv30::init(uint8_
t)' is private
void init(uint8_t addr); // Init common to all constructors
^
/PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino:301:47: error: within this context
P251_PZEM_sensor->init(event->Par1);
^
Compiling .pio/build/normal_ESP8266_4M1M_VCC/src/src/Commands/Common.cpp.o
Compiling .pio/build/normal_ESP8266_4M1M_VCC/src/src/Commands/Controller.cpp.o
Compiling .pio/build/normal_ESP8266_4M1M_VCC/src/src/Commands/Diagnostic.cpp.o
*** [.pio/build/normal_ESP8266_4M1M_VCC/src/ESPEasy.ino.cpp.o] Error 1

Re: Support for PZEM 004T Energy monitor

Posted: 15 Oct 2020, 22:44
by TD-er
If you're seeing errors like those, I guess you are not using the latest source code of ESPEasy.

Re: Support for PZEM 004T Energy monitor

Posted: 16 Oct 2020, 07:55
by Ath
IgorTu wrote: 15 Oct 2020, 16:53 /PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino:54:37: error: 'SENSOR_TYPE_QUAD' was not declared in this scope
Device[deviceCount].VType = SENSOR_TYPE_QUAD;
That should at least be adjusted to: (just a quick peek in one of the other, more current, _Pxxx.ino files)

Code: Select all

         Device[deviceCount].VType = Sensor_VType::SENSOR_TYPE_QUAD;
IgorTu wrote: 15 Oct 2020, 16:53 In file included from /PlatformIO/Projects/ESPEasy-power/src/_P251_PZEM004Tv3.ino:11:0:
.pio/libdeps/normal_ESP8266_4M1M_VCC/PZEM-004T-v30/PZEM004Tv30.h:82:10: error: 'void PZEM004Tv30::init(uint8_
t)' is private
void init(uint8_t addr); // Init common to all constructors
^
That is a different error, but should be easily fixed by moving the declaration into the correct region (public:) in the class definition

Re: Support for PZEM 004T Energy monitor

Posted: 16 Oct 2020, 09:19
by ssd
Hello,

I am trying to connect PZEM-004t with nodemcu with the following configuration:-

Nodemcu is connected to a laptop USB. 5V, GND for PZem is taken from raspberry pi, and TX of PZem is connected to D7, and RX is connected to D6.
pzem.png
pzem.png (28.12 KiB) Viewed 1519384 times
It gives me Nan in all the fields. I have disabled serial port in settings as well.
The LED of D2 is turned ON all the time. D1 is off.

Re: Support for PZEM 004T Energy monitor

Posted: 16 Oct 2020, 11:01
by TD-er
Well that configuration just simply is wrong.
You cannot have an I2C address set and GPIO pins.
That's not using the correct ESPEasy serial wrapper calls.

Re: Support for PZEM 004T Energy monitor

Posted: 16 Oct 2020, 11:43
by IgorTu
TD-er wrote: 15 Oct 2020, 22:44 If you're seeing errors like those, I guess you are not using the latest source code of ESPEasy.
what source version you reccomend?

Re: Support for PZEM 004T Energy monitor

Posted: 16 Oct 2020, 22:25
by olegvstt
I have it connected like this, everything works.Image

Re: Support for PZEM 004T Energy monitor

Posted: 17 Oct 2020, 06:48
by ssd
TD-er wrote: 16 Oct 2020, 11:01 Well that configuration just simply is wrong.
You cannot have an I2C address set and GPIO pins.
That's not using the correct ESPEasy serial wrapper calls.
I am using plugin 251 from the ESPeasy plugin and it is set by default. Can anyone suggest a perfect plugin without an I2C address?

link of plugin I am using: - https://github.com/djelau/ESPEasyPlugin ... 004Tv3.ino

Re: Support for PZEM 004T Energy monitor

Posted: 17 Oct 2020, 07:52
by ssd
olegvstt wrote: 16 Oct 2020, 22:25 I have it connected like this, everything works.Image
Can you provide me the link and the schematic diagram for the same?

Re: Support for PZEM 004T Energy monitor

Posted: 17 Oct 2020, 08:17
by ssd
ssd wrote: 17 Oct 2020, 06:48
TD-er wrote: 16 Oct 2020, 11:01 Well that configuration just simply is wrong.
You cannot have an I2C address set and GPIO pins.
That's not using the correct ESPEasy serial wrapper calls.
I am using plugin 251 from the ESPeasy plugin and it is set by default. Can anyone suggest a perfect plugin without an I2C address?

link of plugin I am using: - https://github.com/djelau/ESPEasyPlugin ... 004Tv3.ino
by using plugin_171 I am unable to set port under devices tab also values shown are 0.
value-zero.png
value-zero.png (41.68 KiB) Viewed 1519254 times
pzem-2.png
pzem-2.png (36.71 KiB) Viewed 1519253 times

Re: Support for PZEM 004T Energy monitor

Posted: 18 Oct 2020, 08:58
by olegvstt
Disable on the Hardware I2C Interface tab and on the Tools tab advanced Serial port.

Re: Support for PZEM 004T Energy monitor

Posted: 18 Oct 2020, 10:55
by iotn00b
First of all many thanks to Espeasy and PZEM-multi developers!! You do an awesome job and help so many enthusiasts!

I used espeasy firmware for 2+ years, but as sensors and setups get more complicated while plugin/controller sets remain quite conservative I have to master custom builds. And here is where problems start, as I'm not developer and not really comfortable with PIO. For example: how to get full output if it is reaaly long? Or how to click on error and got positioned on a guilty line of source code.

I use 1M boards and need both Blynk and PZEM compiled. I tried ESPEasy_mega-20191003 as a source and it worked. Then I wanted to try more up-to-date source, did the same as for 20191003 but neither 20201009 nor 20201016 worked. PIO either throws a lot of 'warning: "BUILD_NO_DEBUG" redefined' junk and overflows console and status = success or fails on some unrelated libraries but second run without any change succeeds. Either way when I flashed and booted, I didn't have BLYNK in Controllers or PZEM in Devices. Initially I wanted to ask for help, but then figured out myself so I'll document it below. May be someone can find it helpful.

What I did:
- downloaded sources
- put PZEM004Tv30.cpp and PZEM004Tv30.h from the Playground to ./lib/PZEM-004T-v30
- had some errors in PZEM004Tv30.cpp regarding a number of arguments (related to ESPeasySerial.h) so I changed PZEM004Tv30.cpp:
swSerial= new ESPeasySerial(receivePin, transmitPin); TO swSerial= new ESPeasySerial(ESPEasySerialPort::software, receivePin, transmitPin);
- put _P251_PZEM004Tv3.ino to ./src
- changed _P251_PZEM004Tv3.ino
Device[deviceCount].VType = SENSOR_TYPE_QUAD; to Device[deviceCount].VType = Sensor_VType::SENSOR_TYPE_QUAD;
(thanks to several posts above)
- added a section for my board to platformio_esp82xx_envs.ini

Code: Select all

[env:test_ESP8266_1M]
extends                   = esp8266_1M
platform                  = ${testing.platform}
platform_packages         = ${testing.platform_packages}
build_flags               = ${testing.build_flags}
                            ${esp8266_1M.build_flags}
                            -DUSE_CUSTOM_H
board                     = ${esp8266_1M.board}
framework                 = arduino
- chose this setup as default in platformio.ini
default_envs = test_ESP8266_1M
- added Blynk and PZEM via ./src/Custom.h
#define USES_P251 // PZEM-04T
#define USES_C012 // Blynk HTTP
#define USES_C015 // Blynk

- removed some sensors which I don't use to save memory in ./src/Custom.h like this:
#ifdef USES_P025
# undef USES_P025 // ADS1115
#endif

- just in case I added to define_plugin_sets.h
#define USES_C012 // Blynk HTTP
#define USES_C015 // Blynk
after #ifdef CONTROLLER_SET_TESTING
and
#define USES_P251 // PZEM-04T
after
#ifdef PLUGIN_SET_TESTING
- Looks like Blynk got skipped due to the following section of define_plugin_sets.h

Code: Select all

// Due to size restrictions, disable a few plugins/controllers for 1M builds
#ifdef SIZE_1M
  #ifdef USES_C003
    #undef USES_C003
  #endif
  #ifndef LIMIT_BUILD_SIZE
    #define LIMIT_BUILD_SIZE
  #endif
#endif
...
#ifdef LIMIT_BUILD_SIZE
...
  #ifdef USES_BLYNK
    #undef USES_BLYNK
I fixed it by commenting out:

Code: Select all

//  #ifdef USES_BLYNK
//    #undef USES_BLYNK
//  #endif

One question though: do I need to change wait timeouts in ./lib/ESPEasySerial/ESPeasySoftwareSerial.cpp like in post #126 (viewtopic.php?p=36179#p36179) ?
MAX_PIN 15 instead of MAX_PIN 16
and
unsigned long wait = m_bitTime + m_bitTime / 2; instead of unsigned long wait = m_bitTime + m_bitTime / 3 - 500;
and
while (ESP.getCycleCount()-start < wait);
wait += m_bitTime;

instead of
WAIT;

Re: Support for PZEM 004T Energy monitor

Posted: 19 Oct 2020, 07:20
by ssd
olegvstt wrote: 18 Oct 2020, 08:58 Disable on the Hardware I2C Interface tab and on the Tools tab advanced Serial port.
I flushed my ESPeasy and reinstalled the firmware and the sensor works perfectly fine with the 217 plugin without disabling I2C interface or serial port. Will it have any adverse effect in long term? or is it fin if it is working perfectly?

Thanks!! :D

Re: Support for PZEM 004T Energy monitor

Posted: 22 Oct 2020, 15:08
by olegvstt
It does not work for me when the serial port is on.

Re: Support for PZEM 004T Energy monitor

Posted: 22 Oct 2020, 15:14
by olegvstt
I meant uncheck the box here.