Page 3 of 3

Re: Flowcode8 Modbus with PZEM-004T Power Monitor

Posted: Mon Jul 17, 2023 3:00 pm
by medelec35
Hi Colin.
Many Thanks for the feedback.
The specifications show the power monitor is used with a 100A transformer.
As you are using a non-specified transformer the values returned are going to be incorrect.
As for the max value, the 9's is not the maximum value of the power module.
I chose a value that should be greater than what the unit is capable of, hence all the 9's
So if you see a value of all 9's then there is a communication issue.
I will look into it tomorrow to see if there is an alternative way.

Re: Flowcode8 Modbus with PZEM-004T Power Monitor

Posted: Tue Jul 18, 2023 3:09 am
by colinwoodcock
Hi Martin,

Yes I wasn't suggesting Flowcode was at fault for me having to multiply my values by a factor of three! I was just mentioning it for interest in that you can use other current transformers with this module as long as their output is 100mA and then just apply the appropriate correction factor to the measured value. As for the error checking, unless you find another way then it is easy enough for my program to reject any reading exceeding the modules maximum value which would solve the problem. Regards, Colin.

Re: Flowcode8 Modbus with PZEM-004T Power Monitor

Posted: Tue Jul 18, 2023 8:08 am
by medelec35
Flowcode does CRC error checking with the module and when CRC error checking fails it returns all 9's which is impossible in real life as the number of 9s exceeds the module's maximum value.
A value needs to be returned if there is an issue with CRC or not.
Can't return a 0 as there might not be any current flow or power consumption etc. in real-life measurement.
Therefore, I thought if all values comprised of just 9's then it would be obviouse there was an issue with the module comms.
What I can do is leave all the 9's in and get the initialise to return a 255 if there is a comms issue, or return 0 if comms is ok.
How does that sound, as all the read functions can be bypassed if initialise returns 255

Re: Flowcode8 Modbus with PZEM-004T Power Monitor

Posted: Tue Jul 18, 2023 8:41 am
by colinwoodcock
Hi Martin. Yes, that sounds a great idea! Nice and simple. Regards, Col.

Re: Flowcode8 Modbus with PZEM-004T Power Monitor

Posted: Tue Jul 18, 2023 9:58 am
by medelec35
Hi Colin.
I have attached the updated component that returns 0 if PZEM-004T is detected and 255 if it's not.
After replacing the new component, if your project is already open you will need to reload it.
Note: As the check is only done during initialisation, if the module comms break after then the value will again be 99999.

Re: Flowcode8 Modbus with PZEM-004T Power Monitor

Posted: Tue Jul 18, 2023 10:00 am
by colinwoodcock
Thanks Martin, will try it asap.

Re: Flowcode8 Modbus with PZEM-004T Power Monitor

Posted: Tue Jul 18, 2023 10:07 am
by medelec35
No problem.
What you can also do is use a decision branch that states if the current > 300 then "CRC fail" etc.