Support for PZEM 004T Energy monitor

Moderators: grovkillen, Stuntteam, TD-er

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

Re: Support for PZEM 004T Energy monitor

#151 Post by TD-er » 30 Nov 2019, 23:25

Can you make a pull request for it on GitHub?
That's easier to discuss compared to downloading ZIP and looking at separate files.

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

Re: Support for PZEM 004T Energy monitor

#152 Post by djelau » 01 Dec 2019, 00:04

Why not. But unfortunately, I ve no knowlege about how to work with github! As said I'm a beginner.

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

Re: Support for PZEM 004T Energy monitor

#153 Post by TD-er » 01 Dec 2019, 01:37

djelau wrote: 01 Dec 2019, 00:04 [..] As said I'm a beginner.
Well, we all start as a beginner. :)

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

Re: Support for PZEM 004T Energy monitor

#154 Post by djelau » 01 Dec 2019, 21:17

I try to do something in "Pull requests" of ESPEasyPluginPlayground. Don't know if I'm in right way ...

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

Re: Support for PZEM 004T Energy monitor

#155 Post by TD-er » 01 Dec 2019, 21:57

I have seen your PR and already commented on it :)

NiCOOLaS
New user
Posts: 5
Joined: 17 Jan 2020, 17:45

Re: Support for PZEM 004T Energy monitor

#156 Post by NiCOOLaS » 17 Jan 2020, 19:04

djelau wrote: 30 Nov 2019, 23:05 ...
If you want to use several PZEM, you need to add several occurence of the pluggin.
First occurence of pluggin allows to configure serial interface and modify address of PZEM.
Next occurence of the pluggin only allows to read an adress and reset energy
...
Hello, thanks for plugin.
What kind of sensor to choose in domoticz to display data?
I have a pzem-004(V3.0) sensors, it can transmit more data than V1, can you add this data (VA, VAr, PF...) to the plugin?
Here's how, for example, in tasmota, this data is transferred:
pzemtasmota.png
pzemtasmota.png (29.1 KiB) Viewed 1152566 times

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

Re: Support for PZEM 004T Energy monitor

#157 Post by djelau » 20 Jan 2020, 13:55

I don't know about domoticz, because I use Jeedom.
But what I know is in Espeasy, it's not possible to have more than 4 data in a pluggin.

To bypass this, you can create a second occurence of this plugin with the same PZEM address than the first occurence. In this second occurence, you can select the other missing data that are not in the first occurence.

By the way, PZEMv3 only measures 6 parameters: Voltage, Current, Active power, Active energy, Frequency, Power factor. Other parameters that you can find in Tasmota (Apparent power, Reactive power, Today and yesterday energy) are calculated by Tasmota. It can be done with a dummy device in espeasy if you really need this information

NiCOOLaS
New user
Posts: 5
Joined: 17 Jan 2020, 17:45

Re: Support for PZEM 004T Energy monitor

#158 Post by NiCOOLaS » 22 Jan 2020, 11:18

djelau wrote: 30 Nov 2019, 23:05 ...
Known restriction:
Don't use HW serial when several PZEM connected in series. Over 2 PZEM, frames conflict occurs and I don't know why. The solution is to use SW serial with GPIO1 as TX and GPIO3 as RX (or to use other pins with software serial)
...

Djelau

I had difficulties with connecting 2 devices at the same time.
I connect both devices in parallel and if I connect load to one of it, then the data is displayed, and if I connect the load to both devices, then NAN.
I changed the GPIO. turned on / off Serial port.
Сan you write instructions for beginners. so that in steps from 0 to configure 2 devices on your firmware :oops: :roll:


Here are the pictures assembled diagram and settings, what needs to be changed in them?
shema.jpg
shema.jpg (198.33 KiB) Viewed 1152482 times
pz1.jpg
pz1.jpg (141.7 KiB) Viewed 1152482 times
pz2.jpg
pz2.jpg (123.25 KiB) Viewed 1152482 times

RobertM
Normal user
Posts: 23
Joined: 22 Oct 2017, 15:23

Re: Support for PZEM 004T Energy monitor

#159 Post by RobertM » 22 Jan 2020, 13:22

djelau wrote: 30 Nov 2019, 23:05
First occurence of pluggin allows to configure serial interface and modify address of PZEM.

Djelau

NiCOOLaS
New user
Posts: 5
Joined: 17 Jan 2020, 17:45

Re: Support for PZEM 004T Energy monitor

#160 Post by NiCOOLaS » 22 Jan 2020, 14:35

RobertM wrote: 22 Jan 2020, 13:22
djelau wrote: 30 Nov 2019, 23:05
First occurence of pluggin allows to configure serial interface and modify address of PZEM.

Djelau

If this post is for me, then I first assigned the devices different numbers 1 and 2, respectively.

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

Re: Support for PZEM 004T Energy monitor

#161 Post by djelau » 22 Jan 2020, 22:59

Hi,

First I update my code since last month. Updated files are viewtopic.php?f=5&t=2595&start=100#p41093. Perhaps it can help.
Sources are now https://github.com/djelau/ESPEasyPluginPlayground

Otherwise, you use GPIO1 as TX and GPIO3 as RX. I said "don't use HW serial" => You should invert these wires only on Node MCU side:
Capture2.JPG
Capture2.JPG (22.67 KiB) Viewed 1150971 times
Then, in the first occurence of the plugin, select "Software serial" as serial port. And configure like that (take care that data acquisisiton interval is more that 1sec also):
Capture.JPG
Capture.JPG (56.08 KiB) Viewed 1150972 times

NiCOOLaS
New user
Posts: 5
Joined: 17 Jan 2020, 17:45

Re: Support for PZEM 004T Energy monitor

#162 Post by NiCOOLaS » 23 Jan 2020, 14:28

djelau wrote: 22 Jan 2020, 22:59 ...And configure like that ...
Thank you very much !
Everything works

p.s.
How to do, when the load is disconnected, the values changed to - 0, not NAN
Can this be done in the rules?

1. ESP:
1.jpg
1.jpg (103.28 KiB) Viewed 1150949 times
2. Domoticz:
Add rules:

Code: Select all

on PZ1#Voltage_(V) do
SendToHTTP 10.0.0.131,8080,/json.htm?type=command&param=udevice&idx=95&nvalue=0&svalue=[PZ1#Voltage_(V)] 
SendToHTTP 10.0.0.131,8080,/json.htm?type=command&param=udevice&idx=96&nvalue=0&svalue=[PZ1#Current_(A)] 
SendToHTTP 10.0.0.131,8080,/json.htm?type=command&param=udevice&idx=97&nvalue=0&svalue=[PZ1#Power_(W)];[PZ1#Energy_(WH)]
endon

on PZ2#Voltage_(V) do
SendToHTTP 10.0.0.131,8080,/json.htm?type=command&param=udevice&idx=99&nvalue=0&svalue=[PZ2#Voltage_(V)] 
SendToHTTP 10.0.0.131,8080,/json.htm?type=command&param=udevice&idx=100&nvalue=0&svalue=[PZ2#Current_(A)] 
SendToHTTP 10.0.0.131,8080,/json.htm?type=command&param=udevice&idx=101&nvalue=0&svalue=[PZ2#Power_(W)];[PZ2#Energy_(WH)]
endon
2.jpg
2.jpg (93.49 KiB) Viewed 1150949 times
3. Made a case :D
Energo.jpg
Energo.jpg (353.01 KiB) Viewed 1150949 times

jack2222
New user
Posts: 3
Joined: 02 Feb 2020, 09:49

Re: Support for PZEM 004T Energy monitor

#163 Post by jack2222 » 02 Feb 2020, 10:00

Dear all,

I am trying to use Djelau binaires on a NoceMCU. I have try to follow the guideline in this thread but whatever I've tried I kept with a "NaN" value display on the espeasy. Any idea why ? I have tried software serial and hardware serial with the same results.

I see the led on the PZEM blinking at the frequency of the request but kept with a NaN displayed. Any idea what's wrong ? :idea:

Annotation 2020-02-02 101540-3.png
Annotation 2020-02-02 101540-3.png (54.45 KiB) Viewed 1150796 times
Annotation 2020-02-02 101320-2.png
Annotation 2020-02-02 101320-2.png (52.49 KiB) Viewed 1150796 times
Annotation 2020-02-02 101320.png
Annotation 2020-02-02 101320.png (92.72 KiB) Viewed 1150796 times
And the physical wiring :
IMG_0758.jpg
IMG_0758.jpg (2.67 MiB) Viewed 1150795 times
but I am getting crazy in reading the "NaN" :
Capture.PNG
Capture.PNG (25.42 KiB) Viewed 1150793 times
I am sure I miss Something,... The question, is what part did I miss ?

NiCOOLaS
New user
Posts: 5
Joined: 17 Jan 2020, 17:45

Re: Support for PZEM 004T Energy monitor

#164 Post by NiCOOLaS » 02 Feb 2020, 11:04

If only one PZEM, then try select HW default, not SW serial.

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

Re: Support for PZEM 004T Energy monitor

#165 Post by djelau » 03 Feb 2020, 08:14

Hello everyone,

Something to clarify for everyone: it's really not mandatory to use RX/TX pin of your WEMOS/nodeMCU => Any pin can be used with the solution of "software serial". Then, if you have trouble, first try to change for other pins. As an example, for my 5 PZEM on a WEMOS, here is the configuration:
Capture1.JPG
Capture1.JPG (24.71 KiB) Viewed 1150750 times
The first line means that TX of the PZEM is connected to GPIO 4 of te WEMOS.
The second line means that RX of the PZEM is connected to GPIO 5 of te WEMOS

To Jack2222:
Your hardware configuration seems to be OK:
The purple wire from TX PZEM is connected to GPIO 1 (don't care if named TX0 in espeasy)
On the other side the orange wire to RX PZEM is connected from GPIO 3 (don't care if named RX0 in espeasy)
Capture.JPG
Capture.JPG (27.24 KiB) Viewed 1150750 times
But I think the problem is your configuration of serial port in the general settings:
Capture3.JPG
Capture3.JPG (21.86 KiB) Viewed 1150750 times
Indeed, here TX is used to transmit whereas in the plugin PZEM you declare it to receive. Then you ve got trouble ....

Tell me if it solves your problem (otherwise don't use GPIO1 and GPIO3).

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

Re: Support for PZEM 004T Energy monitor

#166 Post by djelau » 03 Feb 2020, 08:32

NiCOOLaS wrote: 02 Feb 2020, 11:04 If only one PZEM, then try select HW default, not SW serial.
Yes but orange and pink purple must be inverted to connect PZEM TX to Node RX / Node TX to PZEM RX

jack2222
New user
Posts: 3
Joined: 02 Feb 2020, 09:49

Re: Support for PZEM 004T Energy monitor

#167 Post by jack2222 » 03 Feb 2020, 22:01

Dear all, a great support from the Community…

I have to confess, my only issue was about the power of the PZEM. The nodeMCU was not delivering the expected 5V I've tried with an other ESP (Wemos D1) and it worked directly… Now everything is working perfectly ! Thank you all !

User avatar
dynamicdave
Normal user
Posts: 257
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: Support for PZEM 004T Energy monitor

#168 Post by dynamicdave » 04 Feb 2020, 13:31

I've just ordered a PZEM-004 v3 from China (with the external split CT sensor) - this particular version is housed in a plastic box for safety.

I'm a bit confused as to the correct connection for AC mains as they seem to vary between photos.

On the function diagram (screenshot-090) it shows 'Live' on the bottom terminal, while on the wiring diagram (screenshot-091) it shows it on the second from the bottom terminal.

I don't suppose it matters as it's AC mains - just thought I'd ask.

What is also confusing is the choice of colours.
Here in the UK we use 'brown' as 'live' and 'blue' as 'neutral' (no red wires at all) - but maybe in China it's different ??
Attachments
ScreenShot092.png
ScreenShot092.png (1.04 MiB) Viewed 1150675 times
ScreenShot091.png
ScreenShot091.png (401.25 KiB) Viewed 1150675 times
ScreenShot090.png
ScreenShot090.png (132.76 KiB) Viewed 1150675 times

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

Re: Support for PZEM 004T Energy monitor

#169 Post by TD-er » 04 Feb 2020, 17:41

If you swap live and neutral, I can imagine it will give a 180 degree phase difference between measured current and voltage, so if supported by the sensor, you could get a negative reading on the current.

The current is measured via a coil right?
So I expect there will be some issues with regards to determine the cos-phi or power factor as a coil will smooth out the current measurement anyway.
Not sure if that's a bad thing though, as some appliances do draw a really non-sinus current, which makes it hard to determine a proper apparent and real power consumption.
But it will give quite an incorrect power measurement on highly inductive loads or some dimming circuits that switch on and off during the period.

User avatar
dynamicdave
Normal user
Posts: 257
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: Support for PZEM 004T Energy monitor

#170 Post by dynamicdave » 04 Feb 2020, 18:39

Thanks for the feedback.
Yes the current is measured using a coil clamped around one of the mains cables.

My question was... does it matter which way round the L and N wires are connect in respect of destroying the PZEM-004 ?

From your response I think it doesn't - just might affect the reading.

David.

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

Re: Support for PZEM 004T Energy monitor

#171 Post by djelau » 05 Feb 2020, 16:07

I don't have clear answer about how to connect L and N. But I made so many test when I developped the plugin without taking care of the direction of L/N. And I never noticed that the measurements was negative (cos phi or current). Thus I can deduce that PZEM internal component detects the direction of the current.

User avatar
dynamicdave
Normal user
Posts: 257
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: Support for PZEM 004T Energy monitor

#172 Post by dynamicdave » 06 Feb 2020, 07:37

Hi @djelau
Thanks for your response.

The only thing I was concerned about was damaging (i.e. KILLING) the PZEM-004 by connecting the AC connections the wrong-way round.

I can't wait for the energy sensor to arrive so I can get the system up and running - sounds like a lot of fun.

PS: I've ordered the version that comes in a plastic box as I thought that would be safer !!!!!

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

Re: Support for PZEM 004T Energy monitor

#173 Post by djelau » 06 Feb 2020, 09:15

There is no wrong way as it is AC. It can be connected in any direction.
dynamicdave wrote: 04 Feb 2020, 13:31 What is also confusing is the choice of colours.
Here in the UK we use 'brown' as 'live' and 'blue' as 'neutral' (no red wires at all) - but maybe in China it's different ??
And about wires color, neutral shall be blue. Line can be any color except blue, green/yellow (common colors are red, brown, black). This is the norm in France.

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

Re: Support for PZEM 004T Energy monitor

#174 Post by TD-er » 06 Feb 2020, 14:34

djelau wrote: 06 Feb 2020, 09:15 [...]
And about wires color, neutral shall be blue. Line can be any color except blue, green/yellow (common colors are red, brown, black). This is the norm in France.
Here in the Netherlands we used to have "red" and "green" as wire colours until the '70s I guess.
Those were rather bad chosen colors for several reasons:
- Red was neutral, green was "live". That's counter intuitive.
- Red / Green is the most common form of color blindness.

So we now have:
- Blue for neutral
- Brown for "live"
- Black for "live" to switch something on/off (e.g. from a wall switch to a light bulb)
- Yellow/Green for earth/ground.

There is also a grey one possible, but that was for 3-phase if I'm not mistaken. (0-line???)

User avatar
dynamicdave
Normal user
Posts: 257
Joined: 30 Jan 2017, 20:25
Location: Hampshire, UK

Re: Support for PZEM 004T Energy monitor

#175 Post by dynamicdave » 06 Feb 2020, 16:39

Well I'm sort of hoping that now we have left the EU (I live in the UK) we'll be able to change the colour of our wires back to the scheme we had when I was a lad.

Red was Live
Black was Neutral
Green was Earth

Ha, ha, ha - wishful thinking.

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

Re: Support for PZEM 004T Energy monitor

#176 Post by djelau » 06 Feb 2020, 16:43

So, you have your answer about the connection of phase and neutral: do the opposite of me and it will work (I am from France). :D

White_SinSay
New user
Posts: 1
Joined: 13 Feb 2020, 03:24

Re: Support for PZEM 004T Energy monitor

#177 Post by White_SinSay » 13 Feb 2020, 03:29

djelau wrote: 30 Nov 2019, 23:05 Hi guys,

This is my first post, so keep cool. I'm a great fan of ESPeasy; So I try to contribute with this code for PZEM004Tv30. I'm not a software expert so please be tolerant with me.

Hardware part:
PZEM004Tv30 can be wired in parallel without any aditionnal component: simply connect RX of PZEM together and Tx of PZEM together.
However, if programming the address, only one PZEM must be connected at once during address setting.

Software part:
If you want to use several PZEM, you need to add several occurence of the pluggin.
First occurence of pluggin allows to configure serial interface and modify address of PZEM.
Next occurence of the pluggin only allows to read an adress and reset energy
Energy can also be reset with command : http://<espeasyip>/control?cmd=resetenergy,<PZEM address> (example: "http://192.168.0.1/control?cmd=resetenergy,2" => Reset energy of the PZEM with address #2)

I modify PZEM004Tv30.h and PZEM004Tv30.cpp in order to be compatible with espeay serial. Please use it rather than official PZEM004Tv30.h and PZEM004Tv30.cpp from PZEM github.

Known restriction:
Don't use HW serial when several PZEM connected in series. Over 2 PZEM, frames conflict occurs and I don't know why. The solution is to use SW serial with GPIO3 as TX and GPIO1 as RX (or to use other pins with software serial)
I try only with WEMOS D1mini. So I compile 1M bin, but I don't test it. 4M is OK
Don't hesitate to give me your feedback. And feel free to improve my code.

Djelau
NodeMcu + PZEM-004Tv30 (2pcs), works fine
I requested "ESP_Easy_mega-20191003_PZEM_core_ESP8266_4M1M.bin"

But it does not work DS18B20
It works on the original firmware

pmalvino
Normal user
Posts: 15
Joined: 03 Aug 2016, 22:34

Re: Support for PZEM 004T Energy monitor

#178 Post by pmalvino » 18 Feb 2020, 11:50

Hello, i install the firmware pzem-004 v30 multiple, but only use one pzem, the problem is that the energy shown on espeasy is not correct. I use this firmware because it work better with a display oled ssd1306. Is there a way to fix this?

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

Re: Support for PZEM 004T Energy monitor

#179 Post by djelau » 18 Feb 2020, 12:52

White_SinSay wrote: 13 Feb 2020, 03:29 NodeMcu + PZEM-004Tv30 (2pcs), works fine
I requested "ESP_Easy_mega-20191003_PZEM_core_ESP8266_4M1M.bin"

But it does not work DS18B20
It works on the original firmware
I don't test this configuration. Normally, plugins are independant so my plugin shouldn't have any impact on the DS18B20. But I'll check anyway.

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

Re: Support for PZEM 004T Energy monitor

#180 Post by djelau » 18 Feb 2020, 13:36

pmalvino wrote: 18 Feb 2020, 11:50 Hello, i install the firmware pzem-004 v30 multiple, but only use one pzem, the problem is that the energy shown on espeasy is not correct.
I tested on 1 PZEM with sucess. What do you mean by not correct ? Stucked? alway 0?
Have in mind that the vealue is in kWh thus I could take a couple of hours to change.

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

Re: Support for PZEM 004T Energy monitor

#181 Post by djelau » 18 Feb 2020, 23:36

White_SinSay wrote: 13 Feb 2020, 03:29 But it does not work DS18B20
It works on the original firmware
I perform some test without problem on "ESP_Easy_mega-20191003_PZEM_core_ESP8266_4M1M.bin": I'm able to have DS18B20 and 2 PZEM on the same Wemos. My PZEM are connected with software serial on D1/D2 pin / Refresh 2s and 6s. DS18B20 is connected on D6 pin / Refresh 4s.
My succesful tests:
DS18 with 3V3 supply => OK
DS18 with 5V supply => OK
DS18 with 840ohm PU => OK
DS18 with 10kohm PU => OK
DS18 9bit/10bit/11bit/12bit => OK
Create DS18 device first and then PZEM devices => OK
Erase the flash
Create PZEM devices first and then DS18 devices => OK
Recompile with ESPeasy20200204 => OK

Some question for you: the DS18b is detected (Device Address is proposed) ?
Are you sure about current capability of the NodeMCU to supply all devices ? It seems that power supply of the Node MCU is weak.
jack2222 wrote: 03 Feb 2020, 22:01 Dear all, a great support from the Community…
I have to confess, my only issue was about the power of the PZEM. The nodeMCU was not delivering the expected 5V I've tried with an other ESP (Wemos D1) and it worked directly… Now everything is working perfectly ! Thank you all !

VagoAutomat
New user
Posts: 6
Joined: 06 Mar 2020, 18:28

Re: Support for PZEM 004T Energy monitor

#182 Post by VagoAutomat » 06 Mar 2020, 18:54

Hi, newbie here.
I bought a pzem-004t, an ESP2866 board, download some code from git, follow all instruction but.... I cannot manage in have all the set working.

My target is to publish over my mqtt server the values collected by the ESP from the pzem.
I wrote the routine for posting a value over mqtt and it works. So I paste all necessary for setting up the pzem comunication but... I need to uplug tx and rx cable during the sketch upload, and ok, but with the rx and tx connected the ESP is hung and no values are published because it cannot connect to the pzem

Can you help me?

thks
Attachments
20200306_184033.jpg
20200306_184033.jpg (1.8 MiB) Viewed 1149502 times
20200306_184005.jpg
20200306_184005.jpg (1.97 MiB) Viewed 1149502 times

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

Re: Support for PZEM 004T Energy monitor

#183 Post by djelau » 06 Mar 2020, 21:46

I need to uplug tx and rx cable during the sketch upload, and ok, but with the rx and tx connected the ESP is hung and no values are published because it cannot connect to the pzem
As already repeated: it's really not mandatory to use RX/TX pin of your WEMOS/nodeMCU => Any pin can be used with the solution of "software serial". See my post #165

VagoAutomat
New user
Posts: 6
Joined: 06 Mar 2020, 18:28

Re: Support for PZEM 004T Energy monitor

#184 Post by VagoAutomat » 06 Mar 2020, 22:33

Yep, you' re right.

I changed ports and library.

The library I'm using is this

PZEM004Tv30.h instead of PZEM004T.h

And the setup is

PZEM004Tv30 pzem( D5, D6, 1 ) instead of serial. 1 is the address, no longer needed the fake ip address to be defined.

Thankyou, all works perfectly now.

Stefano
Attachments
EE.PNG
EE.PNG (15.29 KiB) Viewed 1149480 times

VagoAutomat
New user
Posts: 6
Joined: 06 Mar 2020, 18:28

Re: Support for PZEM 004T Energy monitor

#185 Post by VagoAutomat » 07 Mar 2020, 17:34

Hi all again.
All is in place, just one thing I cannot explain.

The current value is correctly shown on between 0 and 5 A range despite the values seems ok.
The card has no particular configuration, the card is very simple

entity: sensor.corrente
min: 0
severity:
green: 0
red: 16
yellow: 10
theme: default
type: gauge
max: 16

... :?:
Attachments
3.PNG
3.PNG (15.37 KiB) Viewed 1149351 times
2.PNG
2.PNG (13.48 KiB) Viewed 1149351 times
1.PNG
1.PNG (14.86 KiB) Viewed 1149351 times

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

Re: Support for PZEM 004T Energy monitor

#186 Post by TD-er » 07 Mar 2020, 21:14

What does the ESPEasy page show?
Maybe the issue is in the interpretation of the values between your system and ESPEasy?

VagoAutomat
New user
Posts: 6
Joined: 06 Mar 2020, 18:28

Re: Support for PZEM 004T Energy monitor

#187 Post by VagoAutomat » 09 Mar 2020, 20:13

Uhm...

MQTT receive an empty string, trying to modify the conversion from float to string but... 5 as maximum value... mmmhhh
Attachments
ABC.PNG
ABC.PNG (27.75 KiB) Viewed 1148951 times

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

Re: Support for PZEM 004T Energy monitor

#188 Post by djelau » 11 Mar 2020, 07:55

Strange behavior...
Perhaps you can copy the value to a dummy device and then send this dummy value to your controller.

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

Re: Support for PZEM 004T Energy monitor

#189 Post by TD-er » 11 Mar 2020, 09:07

Or refer to them in rules and send them to the log using logentry.

Code: Select all

logentry,"PZEM: [taskname#varname]"

VagoAutomat
New user
Posts: 6
Joined: 06 Mar 2020, 18:28

Re: Support for PZEM 004T Energy monitor

#190 Post by VagoAutomat » 24 Mar 2020, 18:44

Hi all, after some 'singular' test for debug purpose I reviewed the code and all work correctly now.

Thankyou
Attachments
okPZEM.jpg
okPZEM.jpg (76.56 KiB) Viewed 1144850 times

Marco
New user
Posts: 3
Joined: 30 Mar 2020, 15:25

Re: Support for PZEM 004T Energy monitor

#191 Post by Marco » 30 Mar 2020, 15:37

djelau wrote: 30 Nov 2019, 23:05 Hi guys,

This is my first post, so keep cool. I'm a great fan of ESPeasy; So I try to contribute with this code for PZEM004Tv30. I'm not a software expert so please be tolerant with me.

Hardware part:
PZEM004Tv30 can be wired in parallel without any aditionnal component: simply connect RX of PZEM together and Tx of PZEM together.
However, if programming the address, only one PZEM must be connected at once during address setting.

Software part:
If you want to use several PZEM, you need to add several occurence of the pluggin.
First occurence of pluggin allows to configure serial interface and modify address of PZEM.
Next occurence of the pluggin only allows to read an adress and reset energy
Energy can also be reset with command : http://<espeasyip>/control?cmd=resetenergy,<PZEM address> (example: "http://192.168.0.1/control?cmd=resetenergy,2" => Reset energy of the PZEM with address #2)

I modify PZEM004Tv30.h and PZEM004Tv30.cpp in order to be compatible with espeay serial. Please use it rather than official PZEM004Tv30.h and PZEM004Tv30.cpp from PZEM github.

Known restriction:
Don't use HW serial when several PZEM connected in series. Over 2 PZEM, frames conflict occurs and I don't know why. The solution is to use SW serial with GPIO3 as TX and GPIO1 as RX (or to use other pins with software serial)
I try only with WEMOS D1mini. So I compile 1M bin, but I don't test it. 4M is OK
Don't hesitate to give me your feedback. And feel free to improve my code.

Djelau
Hi Djelau
I have tried your firmware and it works well. I wanted to ask you a pleasure could you create a firmware test version of esp easy or add the blynk library in your firmware?
thank you very much
sorry for my bad english
Marco

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

Re: Support for PZEM 004T Energy monitor

#192 Post by djelau » 01 Apr 2020, 16:33

Hello Marco,

OK I'll try to add Blynk controller (C012). This is what you want ?
For 4Mb ?

Update:
I don't test it !
Attachments
ESP_Easy_mega-20200204_PZEM+Blynk_normal_ESP8266_4M1M.zip
(552.01 KiB) Downloaded 2385 times

Marco
New user
Posts: 3
Joined: 30 Mar 2020, 15:25

Re: Support for PZEM 004T Energy monitor

#193 Post by Marco » 08 Apr 2020, 15:06

djelau wrote: 01 Apr 2020, 16:33 Hello Marco,

OK I'll try to add Blynk controller (C012). This is what you want ?
For 4Mb ?

Update:
I don't test it !
Hi,
Yes Blynk and 4M
In the next few days I try and then I'll tell you if it works.

thank you very much
Marco

asl07
New user
Posts: 1
Joined: 01 May 2020, 11:41

Re: Support for PZEM 004T Energy monitor

#194 Post by asl07 » 01 May 2020, 11:47

Hi,

Thanks for all the great info shared o this thread. I have some doubts regarding safety, please forgive me if I am too newbie.

I have installed this pzem 004-t https://es.aliexpress.com/item/32955314 ... hweb201603_
The CT that comes with has no specs, however I assume it is a 100-1 ratio

I have seen information online that says if the secondary side of the CT becomes open cirtuited, then a dangerous high voltage could appear between the wires, so they should always be short circuited or using a burden resistor. The wires of the CT are quite thin, and I wonder if something dangerous could happen if the connection to the pzem loosens up, or the wires break for some reason. Should I install a burden resistor between them or something?

Thanks for your help!

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

Re: Support for PZEM 004T Energy monitor

#195 Post by djelau » 02 May 2020, 14:15

What does CT mean ?

However, your PZEM is a v1.0 not a v30 because optocoupler are black and not white. So not use the plugin for PZEMv30 is not compatbile with your PZEM.

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

Re: Support for PZEM 004T Energy monitor

#196 Post by xxrock » 01 Jul 2020, 17:53

Hello, people
I try to connect ESP8266 to PZEM-004T. I load firmware and connect pins. But I can not see real digits. How can I check that PZEM-004 send any datat to ESP8266?
Attachments
Снимок2.PNG
Снимок2.PNG (27.63 KiB) Viewed 1139657 times
Снимок.PNG
Снимок.PNG (25.51 KiB) Viewed 1139657 times
IMG_20200701_214333.jpg
IMG_20200701_214333.jpg (2.76 MiB) Viewed 1139657 times

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

Re: Support for PZEM 004T Energy monitor

#197 Post by djelau » 01 Jul 2020, 23:55

Hello,

You connect a PZEM 004T v3 but the plugin that you use is not the one that I create for v3: PZEM-004Tv30-Multiple. So I can't help you.

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

Re: Support for PZEM 004T Energy monitor

#198 Post by xxrock » 02 Jul 2020, 07:41

djelau wrote: 01 Jul 2020, 23:55 Hello,

You connect a PZEM 004T v3 but the plugin that you use is not the one that I create for v3: PZEM-004Tv30-Multiple. So I can't help you.
Bad news :(
Any chance to connect PZEM 004T v3? What is diffrence? Maybe I can modify current plugin? Any tips and links will be helpful. Thank you in advance.

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

Re: Support for PZEM 004T Energy monitor

#199 Post by djelau » 02 Jul 2020, 10:03

For PZEM v3, have a look to this post:
viewtopic.php?p=41093#p41093

I advice not to use NodeMCU because voltage level are 3v3 whereas PZEM expects 5V. Try a Wemos.

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

Re: Support for PZEM 004T Energy monitor

#200 Post by xxrock » 05 Jul 2020, 11:58

djelau wrote: 01 Jul 2020, 23:55 Hello,

You connect a PZEM 004T v3 but the plugin that you use is not the one that I create for v3: PZEM-004Tv30-Multiple. So I can't help you.
Sorry first time I use old firmware. Now I load yours. I connect RX-TX, TX-RX, G-GND, VIN-5V
but stell zeros... Can you please give advise what I do wrong?
Attachments
Снимок2.PNG
Снимок2.PNG (26.14 KiB) Viewed 1139509 times
IMG_20200705_154654.jpg
IMG_20200705_154654.jpg (4.14 MiB) Viewed 1139509 times
Снимок.PNG
Снимок.PNG (51.5 KiB) Viewed 1139509 times

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests