Flowcode8 Modbus with PZEM-004T Power Monitor
-
- Posts: 14
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 10, 2020 2:40 pm
Flowcode8 Modbus with PZEM-004T Power Monitor
Hi, I am using Flowcode to communicate with the above power monitor and it is working fine using the Modbus RTU ReadInputRegister component. However, I wish to reset the total kWh energy of the module and the command to do this is Slave Address (0x01) + 0x42 + CRC check high byte + CRC check low byte. I cannot see any way in flowcode to send this command. Can anyone help me please?
-
- Matrix Staff
- Posts: 1952
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 510 times
- Been thanked: 698 times
Re: Flowcode8 Modbus with PZEM-004T Power Monitor
Hello,
It looks like this is not a standard modbus command and so is tricky to do, we can maybe look at generating a custom version of the component that will allow this. What version of Flowcode are you using?
It looks like this is not a standard modbus command and so is tricky to do, we can maybe look at generating a custom version of the component that will allow this. What version of Flowcode are you using?
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 14
- Joined: Thu Dec 10, 2020 2:40 pm
Re: Flowcode8 Modbus with PZEM-004T Power Monitor
Hi, I am using Flowcode v8.2.2.15 Professional. I am just a hobbyist but I've always bought the professional version in case I ever wanted to do something commercial but never have! The PZEM-004T seems to be a very popular unit for power monitoring so I think if Flowcode could have a component to support it that would be great. I would be grateful for any help you could give as I am keep to get this project up and running and it is just the reset that is holding me back. Many thanks, here is a link for the user manual of the version 3 unit.
https://innovatorsguru.com/wp-content/u ... Manual.pdf
https://innovatorsguru.com/wp-content/u ... Manual.pdf
-
- Valued Contributor
- Posts: 1685
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 374 times
- Been thanked: 583 times
Re: Flowcode8 Modbus with PZEM-004T Power Monitor
Hi
The PZEM-004T is used in the Mains Power Monitor as found here
https://www.flowcode.co.uk/app-developer/free-apps/
This may give you some pointers.
Regards
The PZEM-004T is used in the Mains Power Monitor as found here
https://www.flowcode.co.uk/app-developer/free-apps/
This may give you some pointers.
Regards
-
- Posts: 14
- Joined: Thu Dec 10, 2020 2:40 pm
Re: Flowcode8 Modbus with PZEM-004T Power Monitor
Hi, yes I took a look at that but I can't see anywhere in the code where it manages to send the reset total kWh code to the power monitor so unless I've missed something, my problem still remains. I could of course just keep a count of the total in my program and reset that when needed but I don't want to do it that way and just wish there was an easy way to send this Modbus RTU command via Flowcode. Many thanks for sending me the link though and it will give me some useful tips.
-
- Valued Contributor
- Posts: 1685
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 374 times
- Been thanked: 583 times
Re: Flowcode8 Modbus with PZEM-004T Power Monitor
Hi
It was quite a few months back that I built one so I'll need to check, but I'm sure you could reset the values. I can'r remember if that was was done "in app" or if it actually reset the device itself.
I'll try and have a look over the weekend.
Regards
It was quite a few months back that I built one so I'll need to check, but I'm sure you could reset the values. I can'r remember if that was was done "in app" or if it actually reset the device itself.
I'll try and have a look over the weekend.
Regards
-
- Matrix Staff
- Posts: 2086
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 644 times
- Been thanked: 702 times
Re: Flowcode8 Modbus with PZEM-004T Power Monitor
Hi
I'm creating a PZEM-004T component to take all the hard work out of getting the PZEM-004T to work.
These are all the working functions so far: It's work in progress for the other functions.
Hopefully, it will be ready soon.
The component is for Flowcode v10 which of course is free.
The reset energy and the read voltage, current frequency, power, power factor & energy are working.
If you want the component without the alarm functions then I will post it at your request.
When all the functions are working, then it will be available via the component database.
Colin if you want a reset function then what about trying Flowcode v10 as all the components are free to use and there are some great new features.
I have placed the PZEM-004T in Misc Circuit so its also available within App Developer.
For future reference these forums are on for Flowcode v9 and v10.
This is the v8 forums
I'm creating a PZEM-004T component to take all the hard work out of getting the PZEM-004T to work.
These are all the working functions so far: It's work in progress for the other functions.
Hopefully, it will be ready soon.
The component is for Flowcode v10 which of course is free.
The reset energy and the read voltage, current frequency, power, power factor & energy are working.
If you want the component without the alarm functions then I will post it at your request.
When all the functions are working, then it will be available via the component database.
Colin if you want a reset function then what about trying Flowcode v10 as all the components are free to use and there are some great new features.
I have placed the PZEM-004T in Misc Circuit so its also available within App Developer.
For future reference these forums are on for Flowcode v9 and v10.
This is the v8 forums
Martin
-
- Valued Contributor
- Posts: 1685
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 374 times
- Been thanked: 583 times
Re: Flowcode8 Modbus with PZEM-004T Power Monitor
Hi Martin
Thanks for the news on the component. I did build the FAD version last year and I did find it useful, but after a week I'd no real further use for it as I then knew what my electrical devices were consuming etc.
I did mean to revisit things, especially as I "think" I have resolved my ESP32 issues (I was originally using some from a well known market with terrible range at best). I was going to send the data to TS as I thought keeping a PC running to log data was a bit counter productive
This component will make things easier by the looks of things.
Regards
Thanks for the news on the component. I did build the FAD version last year and I did find it useful, but after a week I'd no real further use for it as I then knew what my electrical devices were consuming etc.
I did mean to revisit things, especially as I "think" I have resolved my ESP32 issues (I was originally using some from a well known market with terrible range at best). I was going to send the data to TS as I thought keeping a PC running to log data was a bit counter productive

Regards
-
- Posts: 14
- Joined: Thu Dec 10, 2020 2:40 pm
Re: Flowcode8 Modbus with PZEM-004T Power Monitor
Hi Martin,
That's great news and thanks so much for doing this. I'll give Flowcode 10 a try as you suggest. I think a lot of people will be pleased to see this new component! I'm really grateful!
That's great news and thanks so much for doing this. I'll give Flowcode 10 a try as you suggest. I think a lot of people will be pleased to see this new component! I'm really grateful!
-
- Matrix Staff
- Posts: 2086
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 644 times
- Been thanked: 702 times
Re: Flowcode8 Modbus with PZEM-004T Power Monitor
Hi if anyone what to try out the new PZEM-004T component.
To do that, Browse to this location using file explorer, it's hidden by default so just paste the link into your address bar.
save the attached component in the above location
If Flowcode is already open, then you will need to reload your project for the new components to work.
Here are all the enabled functions: For the component to work there is no requirement for a variable within the return value.
Can you please let me know how you get on with the component?
It will be added to the update system next week. The PZEM-004T voltage is accurate to 0.5%, so you are not seeing a PZEM-004T that is out of tolerance.
My mains voltage is too high at times.
To do that, Browse to this location using file explorer, it's hidden by default so just paste the link into your address bar.
Code: Select all
C:\ProgramData\MatrixTSL\FlowcodeV10\Components
If Flowcode is already open, then you will need to reload your project for the new components to work.
Here are all the enabled functions: For the component to work there is no requirement for a variable within the return value.
Can you please let me know how you get on with the component?
It will be added to the update system next week. The PZEM-004T voltage is accurate to 0.5%, so you are not seeing a PZEM-004T that is out of tolerance.
My mains voltage is too high at times.
- Attachments
-
- PZEM004T.fcpx
- (11.72 KiB) Downloaded 504 times
Martin