Modbus TCP Examples

Topics about the Software of Revolution Pi
Post Reply
ECNJAPR
Posts: 7
Joined: 06 Feb 2019, 15:02

Modbus TCP Examples

Post by ECNJAPR »

I am searching for information to write/read the Modbus TCP Slave/Master data from Python. I don't know what should be written in code to access de configuration from PiCtory. Are there any examples using Modbus TCP to communicate with any other device using Python. Using RevPi Connect.
Industrialsys
Posts: 3
Joined: 10 Feb 2019, 18:25

Re: Modbus TCP Examples

Post by Industrialsys »

Hi
I'm creating a node red aplication with Rev Pi Connect. On this aplication all data is collected via Modbus TCP functions. For that purpose I execute several commands. What is your idea?
Do you pretend to know what command you should run to retreive values from proccess image to inside your application?
User avatar
dirk
KUNBUS
Posts: 2111
Joined: 15 Dec 2016, 13:19

Re: Modbus TCP Examples

Post by dirk »

Hi, this is a good question because we have tutorials about the usage of the Modbus TCP / RTU / Master / Slave virtual Modules in PiCtory. But with Node-Red we currently have no experience. What about that Node-RED Modbus TCP Node https://flows.nodered.org/node/node-red ... -modbustcp ? And here is a Modbus Node https://flows.nodered.org/node/node-red-contrib-modbus and here is a Modbus Python library https://pypi.org/project/pymodbus3/
ECNJAPR
Posts: 7
Joined: 06 Feb 2019, 15:02

Re: Modbus TCP Examples

Post by ECNJAPR »

I am using the Pi Connect to communicate from one Ethernet Port (ETH0) to the other (ETH1). I was using the pyModbusTCP Library but I got stuck at setting communication with each ethernet port in the same program.
Industrialsys
Posts: 3
Joined: 10 Feb 2019, 18:25

Re: Modbus TCP Examples

Post by Industrialsys »

Hi to all
As I told before I integrate Node Red with my Rev Pi Connect. I was able to see that Dirk send information about the way to make Node Red the Modbus TCP Master.
My aproach was a bit different. Node Red just provide GUI for the operator and manage all information collected by Modbus TCP channel. Modbus information is collected by PiCtory. I configure all network in this tool. To bring all collected data to Node Red I used Exec node and run command to read / write. I had to active Swamp mpde because CPU overload. Please check the attached file.
Pictory is a very nice tool despite the fact it doesn't handle float variables. This fact brings some complectity when you need to use such kind data.
If further details are needed please let me know.
Attachments
1.png
1.png (275.29 KiB) Viewed 10867 times
baharalbahar
Posts: 2
Joined: 01 Jul 2022, 11:16

Re: Modbus TCP Examples

Post by baharalbahar »

Hello,

I have been trying to run a pyModbusTCP server on the revpi to communicate with my HMI over ethernet.

The python server is a simple publisher and listener for coils and holding registers, and I need it to send and receive data from and to the HMI (sensor values for display, configuration values for input.. etc)

It runs perfectly between my pc and the hmi, but I am unable to communicate between the revpi and the hmi.

I tried to set the revpi as a modbusTCP master with no success. I also tried to do it over ethernet without a special setup on the revpi side and still no luck.

Could there be something blocking it somehow?
baharalbahar
Posts: 2
Joined: 01 Jul 2022, 11:16

Re: Modbus TCP Examples

Post by baharalbahar »

baharalbahar wrote: 25 Feb 2023, 09:57 Hello,

I have been trying to run a pyModbusTCP server on the revpi to communicate with my HMI over ethernet.

The python server is a simple publisher and listener for coils and holding registers, and I need it to send and receive data from and to the HMI (sensor values for display, configuration values for input.. etc)

It runs perfectly between my pc and the hmi, but I am unable to communicate between the revpi and the hmi.

I tried to set the revpi as a modbusTCP master with no success. I also tried to do it over ethernet without a special setup on the revpi side and still no luck.

Could there be something blocking it somehow?
So after a few tests, I was able to make it work, with the correct static ip settings on the PLC side!
Post Reply