Tunnel – Sending GPS positions in real time to server using TCP socket or HTTP

¿Buscas alguna otra cosa?

Scenario details:

  • Some port facilities dispose of vehicles that lack being equipped with a real-ime GPS locating system
  • Being a real-time system it does not need to save GPS locations history to the internal datalogger of the device in order to be sent when it later (as it is done in a conventional fleet control system),but these GPS locations should be sent as soon as possible to a sentral server, every second, if possible
  • GPS locations should be sent in JSON format to the central server, and the transmission method should be chosen between TCP Socket (the quickest method with the minimal rate of 1-2 seconds) or through HTTP (it is a bit slower). The IP address for transmission via socket is 200.1.2.3 and the port is TCP 20010

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

EXAMPLE of configuration (config.txt file) for the indicated scenario. Solution for quick communication via Socket TCP:

Configuration Observations
COMM2_baudrate: 9600
COMM2_bitsperchar: 8
COMM2_autocts: off
COMM2_autorts: off
COMM2_stopbits: 1
COMM2_parity: none
GPRS_apn: movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0
GPS_mode: socket
GPS_period: 2
GPS_ip: 200.1.2.3
GPS_port: 20010
MTX_mode: none
MTX_pin: 0000
MTX_model: MTX-4G-JAVA-IOT-STD-N-GPS
MTX_atLimited: off
MTX_numGSMErrors: 180
MTX_ping: 30
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
Serial port baud rate
8 bit data
No flow control
No flow control
1 stop bit
No parity
APN GPRS provided by the GSM operator
GPRS Login
GPRS Password
Permanent 3G session
Sending location vía SOCKET TCP
Attempt to send GPS location every 2 sconds
IP address receiving GPS locations
TCP port where GPS location is sent
We will not use TCP serial port gateways
The SIM card PIN (if there is any)
MTX modem model being used
No limits for AT commands
N. of GSM errors to reset
Ping every 30 minutes without comms
IP address to ping
Commands SMS sent from any mobile phone
The modem will send IP to a missed call or SMS
It is possible to send commands to MTX via SMS
SMS replies to sent AT commands
Any incoming connection form any IP is allowed
Telnet is activated
Telnet login
Telnet password
Port chosen for Telnet

Details:

  • MTX modem, having connected to a 3G network, will connect to the IP address 200.1.2.3 and the port TCP 20010
  • GPS location will be sent via sending a JSON object. Here is an example of JONSON transmission:
{“IMEI”:”358884051192529”,”TYPE”:”GPS”,”DATE”:”2016/11/04”,”TIME”:”20:44:35”,“LAT”:”41.62963”,”NS”:”N”,”LON”:”2.3609116”,”EW”:”E”,”ALT”:”185.7”,”SPE”:”0.25”,“COU”:”0.00”,”TA”:”3”,”HPO”:”1.90”,”VDO”:”1.44”,”SAT”:”4”}

Where:

IMEI the unique identification number of the modem
TYPE JSON type (GPS in this case)
DATE UTC date returned via GPS
TIME UTC time returned via GPS
LAT GPS Latitude
NS N=North, S=South
LON GPS Longitude
EW E=East , W=West
ALT Altitude (meters)
SPE Speed (km/h)
COU Coure
STA Status. 0=no Fix, 2=2D, 3=3D
HPO Horizontal accuracy indication. The lower the better
VDO Vertical accuracy indication. The lower the better
SAT satellite Nº

EXAMPLE of configuration (config.txt file) for the scenario. Solution for quick communication via HTTP:

Configuration Observations
COMM2_baudrate: 9600
COMM2_bitsperchar: 8
COMM2_autorts: off
COMM2_autorts: off
COMM2_stopbits: 1
COMM2_parity: none
GPRS_apn: movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0
GPS_mode: logger
GPS_period: 30
LOGGER_enabled: on
LOGGER_httpMode: getjson
LOGGER_password: 12345678
LOGGER_server: www.myServer.com/page.asp?data=
LOGGER_registerSize: 500
LOGGER_numRegistersRam: 2
LOGGER_numRegistersFlash: 0
MTX_mode: none
MTX_pin: 0000
MTX_model: MTX-4G-JAVA-IOT-STD-N-GPS
MTX_atLimited: off
MTX_numGSMErrors: 180
MTX_ping: 30
MTX_pingIP: 8.8.8.8
MTX_TPServer: es.pool.ntp.org
MTX_TPServer2: 2.europe.pool.ntp.org
MTX_TPProtocol: ntp
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
Serial port (where internal GPS is connected) 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
Permanent 3G session
Sending location via logger (HTTP)
Attempt to send GPS location every 30 sconds
Logger activated to store GPS locations
JSON sent via HTTP GET
JSON user’s field
Web platform address where Son is sent
Size of the record
Only RAM memory (real time)
Only RAM memory real time
We will not use TCP serial gateways
The SIM card PIN (if there is any)
MTX modem model being used
No limits for AT commands
N. GSM errors to reset
Ping every 30 minutes without comms
IP address to ping
Time server (MTX has to synchronized the time)
Backup time server
NTP protocol used
SMS with commands can be sent from any cell
Modem will reply with its IP to a missed call/SMS
It is possible to send commands to MTX via SMS
SMS replies to sent AT commands
Any incoming connection form any IP is allowed
Telnet is activated
Telnet login
Telnet password
Port chosen for Telnet

Details:

  • Stores locations collected every 30 secs in LOGGER_ and sends it to an URL in LOGGER_server
  • Not necessary to store locations. Recommended to set LOGGER_numRegistersFlash to “0”
  • JSON format is exactly the same as shown in the previous method
  • If the method GPS_mode is specified, fasthttp can reduce the value of GPS_period to 10 secs. Keep in mind that when applying this method, LOGGER_ will be only used for sending GPS positions via HTTP in real time, not for additional tasks like MODBUS registers readings, etc.