How to connect a Modbus RTU
device to an Ethernet network?
Determine the Modbus driver
First of all, you need to determine which Modbus driver on the SCADA host you want to use.
There are four possible options:
1. SCADA host with Modbus TCP driver
2. SCADA host with Modbus RTU driver – with built-in serial port
3. SCADA host with Modbus RTU driver – no built-in serial port
4. SCADA host with “Ethernet Encapsulation” driver
Option 1: SCADA host with Modbus TCP driver
This option requires an MGate protocol converter. You can use the Modbus TCP protocol to communicate with Modbus RTU devices through the gateway. There are many ” Modbus gateways ” available in the automation market that provide Modbus TCP connectivity for Modbus TCP slaves. When the gateway receives a Modbus TCP request, it converts the packet to Modbus RTU and immediately sends it to the Modbus RTU devices.
Option 2: SCADA host with Modbus RTU driver – with built-in serial port
This option is suitable if you just want to connect your existing SCADA host and Modbus RTU devices to an Ethernet network. If your SCADA host is equipped with a serial port, then a couple of gateways can solve this problem. As shown in the network diagram, MGate can convert Modbus RTU packet to Modbus TCP and vice versa. If there is no built-in serial port, this solution is not suitable for you, use option 3.
Option 3: SCADA host with Modbus RTU driver – no built-in serial port
If you want to use existing SCADA software and devices, but your SCADA host does not have a serial port, use a serial device serverto create a virtual COM port. This way you will be able to access remote serial devices through the server, and the functionality will correspond to the real COM port. To create a “virtual COM port”, the serial device server will install a virtual COM port driver on your SCADA host. To enable this port, set the serial device server to virtual COM port mode. All data transmitted through it will be sent to the remote serial port of the serial device server. Since the virtual COM is identical to the real one in terms of OS and SCADA, you can send a Modbus RTU request to it directly.
Option 4: SCADA Host with “Ethernet Encapsulation” Driver
If your SCADA host does not have a serial port and you do not want to install a virtual COM port driver, then you can use the “Ethernet Encapsulation” driver instead. Please note that the SCADA software must support the “Ethernet Encapsulation” connection type. Using the Ethernet Encapsulation drivers is recommended if you have advanced knowledge of serial and TCP/IP protocols.
The serial device server must be switched to the “Raw Socket” or “tunneling” mode, in which when SCADA sends Modbus RTU packets to devices, the connection between the host and the serial device server is made through a transparent TCP / IP or UDP channel without protocol conversion. The serial device server must be configured correctly because The Modbus RTU protocol determines the end of a packet based on pauses in transmission. If the Modbus RTU packet is split into two or more TCP/IP or UDP packets, you may encounter some problems. If you cannot properly configure packet transmission between serial channels and Ethernet networks, it is recommended to use the option with a gateway (2) or virtual COM port (3).
Although serial device servers can be used to connect Modbus RTU devices to an Ethernet network, the gateway option (2) is the preferred option and will satisfy almost all system requirements. Your host must support the Modbus TCP protocol, but this rarely causes problems because this protocol is very popular and widespread. Here are a few situations in which you need to use the presented option with a gateway:
Multiple Masters or Network Redundancy
An Ethernet connection not only allows for remote access, but also supports multiple connections. Most gateways support up to 32 connections, ie. 32 SCADA hosts can simultaneously request data from Modbus RTU devices. In this situation, it is quite difficult to provide network redundancy using a serial device server, because most servers do not support multiple masters, on the other hand, using gateways will not cause any problems.
One connection for multiple Modbus RTU devices
Sometimes it is necessary to use a single connection on a SCADA host to poll multiple Modbus RTU devices connected to different serial ports. The gateway is the only solution that can implement such a routing mechanism. Gateways with multiple serial ports can be configured to send a Modbus request to the appropriate serial port based on the unique IDs of the slaves. Sever serial devices can’t handle such a complex task.
Simultaneous access to the device from the old Modbus RTU controller and the new Modbus TCP SCADA
While the Ethernet protocol makes it easy to set up remote access, it is sometimes necessary to maintain existing local connections to a controller or HMI. The problem is that the serial port on the device is already connected to the gateway, so there is no serial port for the HMI connection. To solve this problem, some gateways are equipped with a “Serial Redirector” feature. This system is very similar to a router in that the gateway can forward a request between different serial ports based on the slave ID.
There are many options for converting Modbus between serial and Ethernet. Although the simple option of transparent communication between serial and Ethernet ports can be used in this case, when working with industrial protocols, such as Modbus, a special gateway is much better suited.
Using such a gateway may require a large initial investment, but it provides a more stable connection in the long run and is able to recognize Modbus packets for proper processing.