Tunnel – Using API to send SMS to external PLC devices connected to COM1 at the same time that the 4G-RS232 tunnel is active

¿Buscas alguna otra cosa?

Scenario details:

  • From the central offices we need to access periodically via 4G the PLC serial port to send instructions and collect results. To access it we’ll use MTX-Tunnel as a 4G-RS232 gateway
  • MTX-Tunnel must always have the IP session established to be able to access the PLC device at any moment. It will use the port TCP 20010
  • The PLC device should be able to send an SMS alarm at any moment. PLC is connected to MTX-Tunnel via the only serial port, so the serial 4G tunnel can coexist with seding AT commands by the PLC using the same serial port (to send the SMS)

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

Config.txt configuration file:

Configuration Observations
COMM_baudrate: 115200
COMM_bitsperchar: 8
COMM_autocts: off
COMM_autorts: off
COMM_stopbits: 1
COMM_parity: none
GPRS_apn: movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0
MTX_model: MTX-4G-JAVA-T
MTX_mode: server
MTX_ATMux: on
MTX_ping: 30
MTX_pingIP: 8.8.8.8
TCP_port: 20010
FIREWALL_enabled: off
TELNET_enabled: on
TELNET_login: user
TELNET_password: 1234
TELNET_port: 20023
Serial port baudrate
8 bit data
CTS hardware control disabled
RTS hardware control disabled
1 bit stop
No parity
GPRS APN from your network operator
GPRS Login
GPRS Password
Modem is permanently connected to GPRS
MTX terminal modem model used
TCP server mode
AT multiplexing mode on serial port enabled
Minutes for connectivity supervision ping
Connectivity supervision IP address
TCP port for 4G-RS232
Firewall disabled
Modem’s Telnet unabled
Telnet username
Telnet password
Telnet port

Detailed explanation:

The simplest way to solve this scenario is to use an AT command multiplexer. This allows you to send AT commands at same time that the GPRS-serial tunnel is established. Enable the MTX_ATMux parameter to “on” to activate the multiplexer.

The AT commands must have a special format, between tags:

<MTXTUNNEL></MTXTUNNEL>

In the example, to send “WARNING HIGH TEMPERATURE REACHED” to the end phone number 666123456 the command will be:

<MTXTUNNEL>AT^MTXTUNNEL=SMS,666123456,WARNING HIGH TEMPERATURE REACHED</MTXTUNNEL>

The command is interpreted and MTX TUNNEL executes it. The AT response will also be between the same tags.