Tunnel – Use of MTX-Tunnel as a datalogger. Sending customized and periodic serial data for proprietary protocols

¿Buscas alguna otra cosa?

Scenario details:

  • We have a device with an RS232 serial port. Internal registers need to be read and sent to a Web platform every 10 minutes
  • In order to read the records, a proprietary protocol is used. This means that certain bytes of data (proprietary protocol) must be sent via the device’s serial port for it to respond with the internal registry values
  • Because of this, the modem must periodically send pre-programmed bytes of data via its RS232 serial port, collect the device’s responses and, attaching a timestamp, send them to a Web server via a JSON object
  • There are two pieces of data to be sent in order to be read every 10 minutes. These are:
    313233F435 and 42A12B42421F4343
  • The serial port configuration is 115200bps, 8 data bits, 1 stop bit and no parity

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

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

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_PIN: 0000
MTX_mode: server
MTX_model: MTX-4G-JAVA-IOT-STD-N
MTX_TPServer: es.pool.ntp.org
MTX_TPServer2: 2.europe.pool.ntp.org
MTX_TPProtocol: ntp
MTX_ping: 35
MTX_pingIP: 8.8.8.8
MTX_ATEmbedded: on
MTX_urc: off
MTX_ATLimited: off
TELNET_enabled: on
TELNET_login: user
TELNET_password: 1234
TELNET_firewall: off
TELNET_port: 20023
SMS_allPhones: on
SMS_ATEnabled: on
SMS_ATResponse: on
LOGGER_enabled: on
LOGGER_password: ID-12345678
LOGGER_server: 90.166.108.200/json/set.asp?data=
LOGGER_registerSize: 600
LOGGER_numRegistersFlash: 200
LOGGER_numRegistersRam: 3
LOGGER_serverLogin: user
LOGGER_serverPassword: 1234
LOGGER_serialData1: 313233F435
LOGGER_serialData2: 4141204242204343
LOGGER_serialPeriod: 600
LOGGER_ httpMode: getjson
LOGGER_serialFrequency: 1
Serial port baud rate
8 bit data
No flow control
No flow control
1 stop bit
No parity
GPRS APN by the GSM operator
GPRS Login
GPRS Password
MTX-Tunnel is always GPRS connected
If SIM card has no PIN security, use 0000 value
GPRS/serial gateway in server mode
MTX-Terminal modem model used
Time server (the MTX must synchronize the time)
Backup time server
NTP protocol used
Ping every 35 minutes without comms
IP address to ping
To send AT commands from Web platform
We don’t need URC information messages
To execute any AT command
To send remote commands, etc.
Telnet Login
Telnet Password
MTX accepts connections from all IPs
Telnet port
All phone numbers are authorized
AT commands can be sent via SMS
SMS replies to AT commands
Logger activated
Password to be sent to the Web platform
Web platform address
Size of the record
Number of records in flash storage
Number of records in RAM memory
Username of the Webserver
Password of the Webserver
First data to be sent
Second data to be sent
Data is sent every 600 secs (10 mins)
Mode HTTP GET (JSON)
We want to log all answers

Details:

  • The JSON object received by the server will have the following format:
{“IMEI”:353234028104337,”TS”:”08/06/14 13:39:33”,”P”:”ID-12345678”,”TYPE”:“SERIAL”,”SER”:”313233343536373839300d0a”}

Where:

IMEI is the modem’s IMEI
TS is the Timestamp (the date/time of the modem)
P The password of the user
TYPE JSON type
SER The serial data in hexadecimal format (2 digits per byte)

This means that for every string logged by MTX-Tunnel, a JSON object will be sent via GPRS or 3G (depending on the model of the modem) in its previous format (received by HTTP GET in the “data” variable, as can be seen in the LOGGER_server parameter).

The MTX-Tunnel will send a JSON object for every reading that is taken. IN the case of the example, 2 JSON objects will be received every 10 minutes.