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 Chipfryer!

Thank you for testing my program, would you share your testprogram? ;)

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!

I dared to play with your Arduino examble from WIKI meanwhile waitingtime, You could have a look at my edit progam, I added a display and disable the ack for init in the loop "!PZEM004TInitRtrnValue" It work but as you mentoid it will only show 99999,0 ect. until PZEM004 is connected. :D

But I dont quite understand how the alarm threshold work. I understand it´s an alarm for overpower, but where do I set the value for the alarm, could you explain :) Please.

Have order a TTGO for test too :lol:

Jorgen
Attachments
Arduino_Uno_Mains_PM_LCDv1.0.fcfx
(45.56 KiB) Downloaded 542 times

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 »

Think I got it, found where I can set the max power :D

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 have noticed you have got 2 x ReadVoltage functions.
I would recommend changing one of the ReadVoltage functions to ReadPower.
Also If you use ReadEnergy then x that by the price per KWh, then you will know how much you are paying for the current energy value.
I did that and it tallied with my smart meter.

Edit. I have just noticed a new post with a new project I have not yet looked at, while I was looking at your PZMLcd.fcfx project.
My comment only applies to PZMLcd.fcfx project.
Martin

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 have just tested your Arduino_Uno_Mains_PM_LCDv1.0.fcfx project on hardware inluding the display.

The only issue I have spotted is the Aalarm status string for the display is too long.
This will cause two issues.

1. The full Alarm status sting can't be all displayed on the LCD.

2. As the string is too long it overspills to line 0 on the display.
So the

Code: Select all

Freq=50Hz
is then appended to

Code: Select all

rigg=50Hz

All else is working including the UART from pin 2 which will require a TTL UART to USB converter:
UART output Uno.png
UART output Uno.png (8.44 KiB) Viewed 4103 times
The one built into Arduino Uno is used for power monitor MODBUS
Martin

chipfryer27
Valued Contributor
Posts: 1687
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: New component: PZEM-004T Power Monitor

Post by chipfryer27 »

Hi Jorgen

Was busy today fitting a point to multi-point link so only catching up with posts now.

Looks like you have things well in hand.

Regards

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!

Yes Martin I know, I am forced to shorten the texts, no problem, when I have received the PZEM004 I will try to use an Ili display ;) I still can edit/use your examble.

Chipfryer, yes I think beginning to be confidential with this component, too :lol: And by study martin's way of programming, I learn something new.

Look forward to get the device and the TTGO. Thank´s for your help, I come back when something new.

Br 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 are getting confident with the PZEM-004T Power Monitor component.
You have done a great job with adding the LCD, well done.
In my opinion, the PZEM-004T is a brilliant device.
I have several with the 100A split transformer which is better than the 10A version since you don't need to break the wire that goes through the transformer.
As for the display showing over power and the UART wording remaining the same how about:
PZEM-004T Overpower.png
PZEM-004T Overpower.png (46.25 KiB) Viewed 4070 times
?
jgu1 wrote:
Sun Jul 23, 2023 1:53 pm
Think I got it, found where I can set the max power :D
That's great.
I added the Alarm Threshold Level (W) to properties to make it easier to set any value.
Alarm Threshold Level Properties.png
Alarm Threshold Level Properties.png (6.03 KiB) Viewed 4068 times
Of course, you can enter a value directly within the SetPowerThresholdLevel function
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!

Thank you. Concerning the overpower Good idea, and when the module is connected and some value is come in, there is less digit. Alarm threshold setting in properties, very nice, so this give the next question :D what alarm is comming, in the display or is it possible to set an output?

Further more, I learn some new, how you use the switch IDX.smart, and can be used in other program too, give a very good overwiev :D

10A versus 100A ok, I think these I order is 10A. https://www.ebay.com/itm/334899613470?var=544084698363 Is it possible to change te coil?

Yes, the PZEM-004T device look very interesting an I look forward to receive and test and again a good component in FC from you ;) .

Br 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
jgu1 wrote:
Mon Jul 24, 2023 6:59 pm
what alarm is comming, in the display or is it possible to set an output?
You can place an output high within the Yes branch of If:ReadReadPZEM004Uint decision icon and an output low within the No branch.
jgu1 wrote:
Mon Jul 24, 2023 6:59 pm
Further more, I learn some new, how you use the switch IDX.smart, and can be used in other program too, give a very good overwiev :D
You can learn about the switch component within the Wiki.
jgu1 wrote:
Mon Jul 24, 2023 6:59 pm
Yes, the PZEM-004T device look very interesting an I look forward to receive and test and again a good component in FC from you ;) .
Thank you, I appreciate the comments :D
Martin

Post Reply