New component: PZEM-004T Power Monitor

For general Flowcode discussion that does not belong in the other sections.
jgu1
Posts: 813
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 696 times
Been thanked: 183 times

Re: New component: PZEM-004T Power Monitor

Post by jgu1 »

Hi Martin!

I received my module today, 10A it seemed to work, (after I discoverd that the switches D3 and D4 is active low :lol: )almost, its probaly me who is doing something wrong.

I see in the display:
Voltage ok
Current ok
Energy ok (after I discover that it is adding up :lol:
Power ok
Powerfactor ok Funny to see if I have something with inductance connected ;)

I try to change the Alarm treshold in the Properties, but but is always zero?
And I can´t change the "Alarm state" As far I understand the treshold is fixed in the properties. And it is possible to change the alarm on/off alarm state
(button 2 D4)?
I suppose the GPIO 35 label is for the TTGO ;)

Very useful device :D

What am I do wrong, please.

Thank´s in advance.

Jorgen
Attachments
Arduino_Uno_Mains_PM_LCDv1.0.fcfx
(46.85 KiB) Downloaded 496 times
Treshold.png
Treshold.png (98.99 KiB) Viewed 3939 times

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 702 times

Re: New component: PZEM-004T Power Monitor

Post by medelec35 »

Hi Jorgen.

Yes, the switches are active low.
When D4 is pulled to GND then the display will show:
SW = Set thresh
Keep D4 at GND until the value within properties is shown as Alarm thresh value.

You don't change the alarm state as that is read from the power monitor.
You just set the flowchart up to act on the state that is read.
If the alarm is not triggered then the value read will be 0.
If the alarm is triggered then the value read will be 65535.

If using If:Variable within a decision branch, then the result will be true for any value except 0

The reason the threshold always read 0 is that you have the wrong function within the 7 branch of the Switch component.
You have a PZEM-004T::Initialise instead of PZEM-004T::ReadPowerAlarmThresholdValue.
Martin

jgu1
Posts: 813
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 696 times
Been thanked: 183 times

Re: New component: PZEM-004T Power Monitor

Post by jgu1 »

Well ok Martin, now it make sense, I will play with it. As mentioned Very usefull device. And fyrthermore, yes I accidentally change the macro "read poweralarm Treshold" to initialise the PZM004 sorry :o it work now

Thank you

Jorgen

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 702 times

Re: New component: PZEM-004T Power Monitor

Post by medelec35 »

Hi Jorgen.
I'm glad you having working now.
Yes, I agree it's a very useful device indeed.
It's because of the PZEM-004T I called national grid out to lower my mains voltage as it rises above the 230 + 10% on a daily basis.
They fitted their official logger and it agreed with PZEM-004T.
The only thing with the power factor is you can't tell if capacitive or inductive which is a shame.
You have done really well modifying the example to show values on the LCD, well done!
Martin

jgu1
Posts: 813
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 696 times
Been thanked: 183 times

Re: New component: PZEM-004T Power Monitor

Post by jgu1 »

Hi Martin!

Ok with the power supply company, yes there I can see it is efficient, hopefully you convinced them that something was wrong with the stability :D
I have tried to make some comparisons with my FLUKE meter, the PZM-004 is very accurate ;) And ok with the powerfactor, just what we can see there is a skewed load whether it is to one side or the other, you know vectordiagram. :D

Anyway Martin, thank´s again for a nice tool in FC and as soon I get my TTGO I will test that also, and you hear.

Br Jorgen

jgu1
Posts: 813
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 696 times
Been thanked: 183 times

Re: New component: PZEM-004T Power Monitor

Post by jgu1 »

Hi MArtin!

As promised hereby the result of test. The PZEM004 also work with the ESP TTGO very nice ;)
And the overload also work fine, this time I have a heater conneted. :D

Br Jorgen
Attachments
TTgo PZM.jpg
TTgo PZM.jpg (92.23 KiB) Viewed 3888 times

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 702 times

Re: New component: PZEM-004T Power Monitor

Post by medelec35 »

Hi Jorgen.
I'm pleased it's working for you.
The only issue is you must run the module from the 3V supply, or you will damage the ESP32 device.
The notes within the wiki covers that (The sentence just above the red warning).
Martin

jgu1
Posts: 813
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 696 times
Been thanked: 183 times

Re: New component: PZEM-004T Power Monitor

Post by jgu1 »

Well, thank´s for info :oops: I did´notice that. I change it to 3,3v still work :D

Jorgen

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 702 times

Re: New component: PZEM-004T Power Monitor

Post by medelec35 »

That's OK.
What I have done is changed the font to red warning on the wiki about the voltage from ESP32 must be 3V and not 5V
Martin

jgu1
Posts: 813
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 696 times
Been thanked: 183 times

Re: New component: PZEM-004T Power Monitor

Post by jgu1 »

Yes, good idea, same for me :D
Attachments
ESP32_TTGO_Mains_PM_red_alarm.fcfx
(37.84 KiB) Downloaded 419 times

Post Reply