0

I have developed my arduino code using below library. I tested code working fine over modbus RTU slave. Now i am planning to use RS485 to wifi instead of wire connection. In order to get data over web apllication i need to add another layer of modbus TCP-IP. can some one suggest me is it possible to without changing any hardware add library function which can acts like MODBUS RtU over TCP-IP protocol.

if any library avilable please share it I am using WIFI device like below. rs485 to wifi

MODBUS RTU

1

Modbus TCP simply put is a Modbus packet wrapped in a TCP packet.

There is no 'additional layer of Modbus' added on top. If we look at the osi model pictured below you can see there is only one Modbus application layer (i.e modbus slave/server)

Modbus OSI Layer (stolen from http://www.protoconvert.com/

Essentially if the wifi->RS485 gateway strips the payload from the TCP packets and simply spits it out the serial side then no modifications are necessary (apart from the obvious RS485 transceiver you will need to interface the arduino with the gateway).

What you will need to make sure is that the gateway will only send packets directed to port 502 to the arduino (502 is the Modbus TCP port) as it is possible other IP traffic could cause some drama for the modbus slave.

Additionally, you will have to ensure that you set the slave ID of the arduino to be what is specified by the master. Are you also building the Modbus TCP client? If not it is very possible that the required slave ID is 255 which is not supported by the modbus library you have linked.

Modbus (serial) slave IDs can only be between 1 and 247 for traditional reasons when Modbus was first standardised as it was only envisioned to be on serial, however when Modbus TCP was introduced an additional addressing layer (TCP / IP) meant that the unit ID (slave ID when using Modbus TCP) could be anything from 0 - 255. It is common for some vendors (at least in industrial automation) to use a unit ID of 255 for standard Modbus transactions scanning IO and diagnostic or configuration transactions to be send to other unit IDs (essentially making the TCP server a modbus router, forwarding packets to one of the multiple Modbus servers running on that single slave device)

  • I am not having plan to develop any modbus TCP ip protocol or make any hardware changes. I would like to know with existing library how can i convert the modbus packets into tcp-ip packets to make work as modbus RTU over TCP IP. There is library for modbus TCPIP can use to implement my code – AMPS Jun 30 '16 at 9:40
  • A mentioned in my post whether or not the mobus library you linked will work depends on the master/client and what unit id it will be polling. Do you what this will be? What is the master/client? Do you have any control over it? – Ben Southwell Jun 30 '16 at 10:02
  • the device going to be client.Scada system acts like Master. Intially we used wired connections and now we wanted to go with wireless without changing hardware. By USR model , USR-630 we can config either server or client.we just passing data like modbus packets. I found its working fine with modbus packets. We expected to wifi device convert modbus packets into TCP-IP packets. Since it not doing it , how we can convert into TCP-ip packets – AMPS Jun 30 '16 at 10:28
  • I suspect you mean the arduino device is going to be server/slave? If you want to change from wired to wireless you must change hardware , seeing how that is what you want to do. As I have said before you need to make sure the client I.e your scada can use a unit id in the Renee of 1-247. What is a USR630? What do you mean exactly by "we expected wifi device to convert modbus packets into tcp ip packets" this does not describe your problem at all. – Ben Southwell Jun 30 '16 at 11:19
  • I am using connection from A and B connection from Existing arduino Slave device and connected to rs485 to wifi. we can config device ID up to 248 device. with device i could able to communicate like wired connection but i could not able to connection in scada over web app. our scada engineer asking to give protocol that convert MODBUS packets into TCP-IP packets. Thats reason i am looking for expert suggestions here – AMPS Jun 30 '16 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.