Modbus TCP/IP

Topics about the Software of Revolution Pi
suthesh
Posts: 13
Joined: 06 Mar 2019, 03:38
Location: Singapore

Modbus TCP/IP

Post 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" ?
Attachments
data area.PNG
data area.PNG (23.69 KiB) Viewed 13625 times
addressing the virtual outputs.PNG
addressing the virtual outputs.PNG (46.93 KiB) Viewed 13625 times
extended data.PNG
extended data.PNG (20.06 KiB) Viewed 13625 times
User avatar
Amar
KUNBUS
Posts: 160
Joined: 15 Jul 2019, 12:58

Re: Modbus TCP/IP

Post 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.
KUNBUS
suthesh
Posts: 13
Joined: 06 Mar 2019, 03:38
Location: Singapore

Re: Modbus TCP/IP

Post 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?
Attachments
virtual input register.PNG
virtual input register.PNG (44.13 KiB) Viewed 13526 times
User avatar
Amar
KUNBUS
Posts: 160
Joined: 15 Jul 2019, 12:58

Re: Modbus TCP/IP

Post 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.
KUNBUS
suthesh
Posts: 13
Joined: 06 Mar 2019, 03:38
Location: Singapore

Re: Modbus TCP/IP

Post 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.
David_GT
Posts: 12
Joined: 02 May 2019, 09:11

Re: Modbus TCP/IP

Post 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!
Attachments
RevPi_M_TCP_3.PNG
RevPi_M_TCP_3.PNG (56.51 KiB) Viewed 13416 times
RevPi_M_TCP_2.PNG
RevPi_M_TCP_2.PNG (102.84 KiB) Viewed 13416 times
RevPi_M_TCP_1.PNG
RevPi_M_TCP_1.PNG (263.95 KiB) Viewed 13416 times
suthesh
Posts: 13
Joined: 06 Mar 2019, 03:38
Location: Singapore

Re: Modbus TCP/IP

Post 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.
David_GT
Posts: 12
Joined: 02 May 2019, 09:11

Re: Modbus TCP/IP

Post 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.
suthesh
Posts: 13
Joined: 06 Mar 2019, 03:38
Location: Singapore

Re: Modbus TCP/IP

Post by suthesh »

Hi David,

Is there free trial for the usage of IBM Watson?
David_GT
Posts: 12
Joined: 02 May 2019, 09:11

Re: Modbus TCP/IP

Post by David_GT »

suthesh wrote: 08 Aug 2019, 13:23 Hi David,

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