Page 1 of 2

Modbus TCP/IP

Posted: 26 Jul 2019, 09:59
by suthesh
Hi,

I am currently trying to send my safety controller data via the virtual outputs which is via the Modbus TCP/IP. I would like to read the data from my safety controller. Basically the Rev Pi Core 3 is my master and the safety controller is my slave. For the safety controller the addressing starts at “0”. I followed the tutorial on how to use RevPi Core as Modbus TCP Master. But still cant get the readings. I am not sure which part i have done wrong. I am not quite sure about the address part.

Basically below would be the steps i have done:
1) Enabling the modbus tcp master under the services tab.
2) Adding the modbus tcp master in pictory and also putting in my slave ip address. Both ip addresses are in the same network.
3) Right clicking the modbus tcp master and clicking extended data. below attached has an image. (This is the part i am not sure if i did correctly.)
4) I also use the command "piTest -d" to check if the modbus tcp master has been configured and save in the pictory. It has no issues here.

Ok so below attached are my safety controller Modbus TCP/IP operating manual images.
I would need some help here as my knowledge on Modbus TCP/IP is quite low.

I decided to use the function code read discrete inputs as i am using just to read the data in bits format from the slave. I am not sure if this is correct. But based on the operating manual of the safety controller i used that function code. So once again my safety controller addressing starts from 0. So must i use the virtual output bit 1 in my safety controller software?

And also please tell me the command to make sure i can see the bit 1 when activated. is this command correct, "piTest -r Input_Bit_1" ?

Re: Modbus TCP/IP

Posted: 29 Jul 2019, 12:06
by Amar
Virtual inputs seems to be in coil registers as they have r/w access.To read them from controller you need READ_COILS function.
Virtual output could be read with READ_Discrete_INPUTS function. Safety controller addressing need not be changed.
You can check in wireshark with mtcp filter if communication is actually working.The command to check bit 1 status with piTest is correct.

Re: Modbus TCP/IP

Posted: 30 Jul 2019, 08:25
by suthesh
Hi Amar,

Thanks for your reply will take a look in wire shark. So lets say if i use virtual inputs I must change the register address from 513 to 1 is it?

Re: Modbus TCP/IP

Posted: 30 Jul 2019, 14:29
by Amar
Hi Suthesh,
Yes.As per your previous attached image virutal input 1 is corresponding to address 1.For better clarity i would suggest to use a open source Modbus master simulator tool like QModMaster.You can connect your controller with it and exactly observe how your inputs and outputs are behaving with various function codes and then adapt accordingly with RevPi.

Re: Modbus TCP/IP

Posted: 31 Jul 2019, 04:35
by suthesh
Hi Amar,

Thanks alot for your help. Managed to write the bits, but did not try the reading function yet. Thanks alot for giving me a better understanding of how the Modbus works.

Re: Modbus TCP/IP

Posted: 06 Aug 2019, 12:02
by David_GT
I seems you are working with a PNOZmulti from Pilz.

I do the same several weeks ago. Here you have some information related to that communication:

In PiCtory you need to define the slave properties (PNOZmulti):
slave_IP_adress
slave_TCP_port

In PNOZmulti the port is fix to 502

Now you need to define the extended data (see attached files). PNOZmulti starts with register 0, but in RevPi we can not chose that, then we maintain 1. That affects to the read register, that will start from 8193 (8192+1).

Save all configuration and go to a terminal. You can test:
piTest -w Output_Bit_1, 1 (for example)
or
piTest -r Input_Bit_1

Hope it helps!

Re: Modbus TCP/IP

Posted: 07 Aug 2019, 05:43
by suthesh
Hi David,

Yes i am indeed working with the PNOZmulti from PILZ. Thank you so much for your help. Also i would like to know if you have any idea to use this modbus data's and sending it to the azure cloud. Do you have any details on this? I am currently using NODE-RED as there are the Azure nodes in it.

Re: Modbus TCP/IP

Posted: 08 Aug 2019, 13:18
by David_GT
suthesh wrote: 07 Aug 2019, 05:43 Hi David,

Yes i am indeed working with the PNOZmulti from PILZ. Thank you so much for your help. Also i would like to know if you have any idea to use this modbus data's and sending it to the azure cloud. Do you have any details on this? I am currently using NODE-RED as there are the Azure nodes in it.
Hi suthesh;

I am working with Node-Red too, but I only make some test with IBM cloud (IBM Watson). No experience with Azure.

Re: Modbus TCP/IP

Posted: 08 Aug 2019, 13:23
by suthesh
Hi David,

Is there free trial for the usage of IBM Watson?

Re: Modbus TCP/IP

Posted: 08 Aug 2019, 13:35
by David_GT
suthesh wrote: 08 Aug 2019, 13:23 Hi David,

Is there free trial for the usage of IBM Watson?
Yes!