Tunnel – Providing IP to Master Modbus RTU and Modbus RTU slaves

¿Buscas alguna otra cosa?

Scenario details:

  • We have a PLC with Modbus RTU RS485 communications which, acting as master, performs periodic readings of 3 slave devices also with Modbus RTU RS485 communications
  • It is necessary to replicate that same scenario, with the same RS485 devices, but with IP communications, since it is not possible to carry out a wiring when the different elements are located at kilometers distances between them
  • SIM cards will be used with private APN, so each device will have a MTX-Tunnel modem with fixed IP address to facilitate communications and increase security

Solution: MTX-Tunnel firmware + MTX-Java-IoT/MTX-Java-T/MTX-Java-T2

Configuration example (config.txt file) for the indicated scenario. MTX-Tunnel MASTER:

Configuration Observations
COMM_baudrate: 9600
COMM_bitsperchar: 8
COMM_autorts: off
COMM_autocts: off
COMM_stopbits: 1
COMM_parity: none
GPRS_apn: movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0
MTX_PIN: 0000
MTX_mode: udp
MTX_model: 199801393
MTX_ping: 35
MTX_pingIP: 8.8.8.8
SMS_allPhones: on
SMS_sendIP: on
SMS_ATEnabled: on
SMS_ATResponse: on
FIREWALL_enabled: off
TELNET_enabled: on
TELNET_login: user
TELNET_password: 1234
TELNET_port: 20023
UDP_IP: 10.1.1.10@1,10.1.1.20@2,10.1.1.30@3
UDP_ localPort: 20010
UDP_ remotePort: 20010
Serial port baud rate
Number of bits
No flow control
No flow control
1 stop bit
No parity
APN GPRS provided by the GSM operator
GPRS Login
GPRS Password
Modem is always GPRS connected
SIM Card PIN
UDP communications will be used
MTX modem model
Ping every 35 minutes without comms
IP address to ping
Send SMS with commands from any phone
Modem responds with IP to missed call or SMS
It is possible to send commands to MTX via SMS
MTX responds with SMS to a sent SMS command
It’s possible to connect to the modem from any IP
We enable the Telnet of the modem
Login for Telnet
Password for Telnet
Telnet port for remote configuration changes
IPs and slave Modbus RTU address are indicated
Local communications UDP port
Remote communications UDP port

Configuration example (config.txt file) for the indicated scenario. MTX-Tunnel SLAVES:

Configuration Observations
COMM_baudrate: 9600
COMM_bitsperchar: 8
COMM_autorts: off
COMM_autocts: off
COMM_stopbits: 1
COMM_parity: none
GPRS_apn: miapn.movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0
MTX_PIN: 0000
MTX_mode: udp
MTX_model: 199801393
MTX_ping: 35
MTX_pingIP: 8.8.8.8
SMS_allPhones: on
SMS_sendIP: on
SMS_ATEnabled: on
SMS_ATResponse: on
FIREWALL_enabled: off
TELNET_enabled: on
TELNET_login: user
TELNET_password: 1234
TELNET_port: 20023
UDP_IP: 10.1.1.1
UDP_ localPort: 20010
UDP_ remotePort: 20010
Serial port baud rate
Number of bits
No flow control
No flow control
1 stop bit
No parity
APN GPRS provided by the GSM operator
GPRS Login
GPRS Password
Modem is always GPRS connected
SIM Card PIN
UDP communications will be used
MTX modem model
Ping every 35 minutes without comms
IP address to ping
Send SMS with commands from any phone
Modem responds with IP to missed call or SMS
It is possible to send commands to MTX via SMS
MTX responds with SMS to a sent SMS command
It’s possible to connect to the modem from any IP
We enable the Telnet of the modem
Login for Telnet
Password for Telnet
Telnet Port for Remote Configuration Changes
Modbus master IPs are indicated
Local communications UDP port
Remote communications UDP port

Details:

  • To solve this scenario UDP communications are used. Each time the modem is connected to the master PLC it receives a communication frame. Modbus analyzes the received frame by looking for the Modbus RTU address of the slave to which it is addressed. Once the address is found, the frame is sent only to the IP associated with the corresponding slave modbus RTU device
    • Example for the following configuration:
    • UDP_IP: 10.1.1.10@1.10.1.1.20@2.10.1.1.30@3
  • If the master modem receives a modbus RTU frame and verifies that the destination address is for the slave device with address modbus @2, it forwards the received frame to the associated address, in this case 10.1.1.20.
  • Other devices on the market forward the frame to all associated devices, with the consequent problem of increasing data traffic and, therefore, higher economic cost and lower communication speed
  • Do not forget to establish a communication timeout in the master PLC of at least 2 seconds