Tunnel – Periodical sending of vehicle’s GPS locations and the registers of Modbus RTU temperature sensor RS485 to a Web server. Occasional 3G-5RS232 gateway for PLC’s firmware actualization

¿Buscas alguna otra cosa?

Scenario details:

  • We have a truck whose GPS location and temperature of the 3 temperature sensors should be monitored. The truck is also equipped with a control PLC with RS232 serial port.There should be the possibility to update the PLC’s firmware remotely by the above mentioned serial port at any moment
  • The modem must collect GPS location every 1 minute and send it in JSON format to a Web server throught HTTP POST
  • The modem must read the temperature from the RS485sensors every 10 minutes and send it to a Web server throught HTTP POST
  • The modem should be ready for updating the control PLC at any moment, therefore a 3GRS232 gateway must be activated in TCP 20010 port
  • The modem should be able to be configured remotely via SMS and Telnet

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

EXAMPLE of settings (file config.txt) for such scenario:

Configuration Examples
COMM_baudrate: 19200
COMM_bitsperchar: 8
COMM_autorts: off
COMM_autorts: off
COMM_stopbits: 1
COMM_parity: none
COMM2_baudrate: 9600
COMM2_bitsperchar: 8
COMM2_autorts: off
COMM2_autocts: off
COMM2_stopbits: 1
COMM2_parity: none
GPRS_apn: movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0
MTX_PIN: 0000
MTX_mode: server
MTX_model: MTX-4G-JAVA-IOT-N-GPS
MTX_portAux: modbusmaster
MTX_TPProtocol: ntp
MTX_TPServer: ntp.roa.es
MTX_TPServer2: es.pool.ntp.org
MTX_ping: 35
MTX_pingIP: 8.8.8.8
MTX_rssiLevel: 10
MTX_serverTimeout: 300
TCP_port: 20010
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
LOGGER_enabled: on
LOGGER_password: ID001
LOGGER_server: dominio.com/datos.asp?datos=
LOGGER_registerSize: 300
LOGGER_numRegistersFlash: 1500
LOGGER_httpMode: postjson
MODBUS_address: 1;2;3
MODBUS_start: 1;1;1
MODBUS_numwords: 1;1;1
MODBUS_period: 300
MODBUS_readCommand: 4;4;4
MODBUS_regType: 2;2;2
GPS_period: 60
DNS_enabled: on
DNS_password: ID00001
DNS_server: www.miservidorWeb.com/json.asp
DNS_mode: http
DNS_httpMode: postjson
DNS_period: 3600
Serial port baud rate (PLC HMI communication)
Number of bits
No flow control
No flow control
1 stop bit
No parity
Serial port baud rate
Number of bits
No flow control
No flow control
1 stop bit
No parity
APN of SIM card
GPRS Login
GPRS Password
Modem is always GPRS connected
SIM Card PIN
3G-RS232 gateway configured for the current PLC
MTX modem model
The aux port used as master modbus MTX
Time synch. protocol
Time server (the MTX must sync the time)
Backup time server
Ping every 35 minutes without comms
IP address to ping
Coverage led of MTX-65i activated
If no gateway traffic in 300s socket server closed
Principal serial port gateway RS232
All phone numbers are authorized
IP sent to phone which called or “on” SM
Remote AT commands by SMS enabled
Modem response to AT command with SMS
Any IP will be able to connect to the modem
Telnet is activated
Telnet login
Telnet password
Telnet port 20023
We enable the MTX Logger, to store the records
Field to identify the origin of the frames
Server URL, will receive JSON data
Register size
Maximum number of records in MTX
HTTP POST mode (JSON) selected
Modbus addresses to be read
Initial address of each sensor to be read
Registers number to be read
Period in seconds within which a reading is done
Sensors read with modbus 0x04 command
The registers have 2 bytes (unsigned word)
Every minute one GPS position is read
DNS service activated to inform periodically
Field says where frames come from
URL to send the JSON with data
Configuration mode http
HTTP POST is used to send data
Status sent everytime IP changes or every 3600s

Details:

  • The format of JSON object that MTX-Tunnel will send to a Web server, for sensor 1 (23.0º) is similar to the following structure:
{“IMEI”:353234028103206,”P”:”ID00001”,”TYPE”:”MODB”,”A”:1,”TS”:”20/04/13 08:31:44”,”ST”:1, “V1”:230}
  • For sensor 2 (24.5º)
{“IMEI”:353234028103206,”P”:”ID00001”,”TYPE”:”MODB”,”A”:2,”TS”:”20/04/13 08:31:44”,”ST”:1, “V1”:245}
  • For sensor 3 (22.1º)
{“IMEI”:353234028103206,”P”:”ID00001”,”TYPE”:”MODB”,”A”:2,”TS”:”20/04/13 08:31:44”,”ST”:1, “V1”:221}
  • And for GPS frames:
{“IMEI”:357044060013890,”TYPE”:”GPS”,”P”:”ID00001”,”DATE”:”2016/10/30”, “TIME”:”21:35:51”,”LAT”:”41.629803”,”NS”:”N”,”LON”:”2.3609767”,”EW”:”E”, ”ALT”:”197.61”,”SPE”:”2.98”,”COU”:”9.85”,”STA”:”3”,”HPO”:”1.25”,”VDO”:”0.75”, “SAT”:”05”}

Where:

IMEI IMEI of the modem
TYPE Data frame type
P Text specified in the parameter LOGGER_password
DATE UTC date collected directly from GPS
TIME UTC time collected directly from GPS
LAT Latitude
NS N=North, S=South
LON Longitude
EW E=East, W=West
ATL Altitude
SPE Speed
COU Direction (0 – 359º)
STA GPS status (0=No fix, 2=2D, 3=3D)
HPO Horizontal accuracy (the closer to 1 the better)
VDO Vertical accuracy (the closer to 1 the better)
SAT Satellite nº
  • Remeber that the modem model used in this example has 2 serial ports: the main port (RS232) and the secondary port (RS232 and RS485). To configure the secondary port as RS485 you should set microswitch 2 in “ON”, as it is shown in Annex A of this manual