News

Fleet tracking and management

Fleet Control Example 1. Sending GPS position and I/Os to the server by GPRS.

In this example we will see how to configure the MTX-Tunnel-GPS. The device will be installed in a vehicle to periodically send its GPS position and I/Os (analog and digital inputs and outputs) to a PC Server. As well as sending the GPS position, GSM cells are required to obtain an approximate location in the event that there is no GPS coverage (for example, when the vehicle is underground or in a garage). In this case, the Telnet service will be activated to remotely connect to the device and be able to carry out maintenance.

Details of the example scenario:

  • The GPS position of a MTX-Tunnel-GPS that is installed in a van needs to be sent to a central server with IP address 200.201.202.203 and TCP 20010.
  • The MTX-Tunnel-GPS must take the GPS position every 30 seconds and send it in real time to a TCP socket server.
  • In the event of there being no GPS coverage, the modem is required to send every two minutes a KeepAlive message with the necessary information to be able to locate the vehicle using GSM cell locations.
  • Telemetry data (digital inputs) from devices that are connected to the digital inputs of the modem must also be sent.
  • Remote access to the configuration of the modem must be available, as well as the ability to monitor data such as GSM coverage in any given moment, or to read the modem’s analog inputs that are connected to other devices. To do this, the Telnet service must be activated. For security reasons, the Telnet service must only be accessed via the central IP address, which is 200.201.202.210.

Proposed solution using MTX-Tunnel-GPS.

 Configuration file of MTX-Tunnel-GPS for the previously proposed solution

This is the configuration that must be inputted in the file MTXTunnelGPS.jad of the modem to be able to carry out the implementation described in the scenario.

 

By configuring the MTX-Tunnel-GPS device with these parameters, the device will periodically send the GPS position to the PC Server. The structure of the file sent with the data can be found in the MTX-Tunnel-GPS file (specifically in Annex 1, page 73).

 

Metering, meters reading

Example 1. Reading of an electric meter via GSM and GPRS

 

Details of the example scenario:

  • The readings of an electric meter are to be taken every 10 minutes. Due to this being so frequent, the meter will be accessed via GPRS instead of by GSM calls in order to reduce costs.
  • The energy provider (Endesa, Iberdrola, etc.) will make a conventional GSM call to carry out a meter reading once a day.
  • The GSM call must take priority. When the modem receives a call from the energy provider, it must “freeze” GPRS communications to give way to the readings carried out by the provider. Once the GSM call is terminated, GPRS connections must be reestablished.

Proposed solution using MTX-65i and MTX-Tunnel.

 

  1. Readings of the electric meter are continuously carried out via GPRS and in real time from the office.
  2. When the electricity provider (Endesa, Iberdrola, etc.) makes the daily GSM call to the modem to read the meter, GPRS communications are frozen to give way to the call from the provider which takes priority.
  3. Once the GSM call is terminated, real time GPRS communications are established.

 

Configuration files for the MTX-Tunnel for the proposed solution:

This configuration is what must be inputted in the configuration file of the modem to be able to carry out the implementation described in the scenario.

 

 COMM_baudrate: 9600 Speed of the serial communication port with the PLC
 COMM_bitsperchar: 8 Number of data bits
 COMM_autorts: off No flow control
 COMM_autocts: off No flow control
 COMM_stopbits: 1 Configure 1 stop bit
 COMM_parity: none No parity bit
 
 GPRS_apn: movistar.es APN GPRS provided by the GSM operator
 GPRS_login: MOVISTAR Login GPRS provided by the GSM operator
 GPRS_password: MOVISTAR GPRS password provided by the GSM operator
 GPRS_timeout: 0 The modem will be permanently connected
 
MTX_mode: server GPRS connection in server mode
 MTX_model: MTX65i Modem model
 MTX_ping: 35 Ping frequency to supervise the connection
 MTX_pingIP: 8.8.8.8 IP (for example) of Google so the Ping can be carried out
 MTX_radioBand: europe GSM band in Europe
 MTX_rssiLevel: 10 Red LED shown when network coverage is poor
 
TCP_port:20010  TCP port to establish the serial GPRS Gateway
 Firewall_enabled: off Firewall deactivated
 
CSD_enabled: on Allows GSM calls to be received from the energy provider (Endesa, Iberdrola, etc.)

 

Modbus

Example 1. Modbus datalogger to send data to WebServer

 

Details of the example scenario:

  • We have a PLC Modbus RTU which has a series of variables/records (for example, temperature/meters) in its internal memory which must be read and sent periodically to a Web server.
  • Because of this, the MTX-Tunnel must request from the PLC, via a serial port, that these records be read every 15 minutes. These records are: for the temperature record number 20, and the meters are in the records 21, 22 and 23 respectively.
  • The MTX-Tunnel must send the value of the records to a Web server via HTTP GET using a JSON object after each reading; however, it must be able to store up to 1500 readings in flash memory in case of a GPRS communication failure, and these will be sent when communications are restored.
  • The MTX-Tunnel must be accessible at all times to be able to read the records of the PLC in real time, as well as to write in them and modify the configuration of the PLC.

Proposed solution using MTX-65i and MTX-Tunnel.

Datalogger modbus gprs

Configuration files for the MTX-Tunnel for the proposed solution:

This configuration is what must be inputted in the configuration file of the modem to be able to carry out the implementation described in the scenario.

 

 COMM2_baudrate: 9600 Speed of the serial communication port with the PLC
 COMM2_bitsperchar: 8 Number of data bits
 COMM2_autorts: off No flow control
 COMM2_autocts: off No flow control
 COMM2_stopbits: 1 Configure 1 stop bit
 COMM2_parity: none No parity bit
 
 GPRS_apn: movistar.es APN GPRS provided by the GSM operator
 GPRS_login: MOVISTAR Login GPRS provided by the GSM operator
 GPRS_password: MOVISTAR GPRS password provided by the GSM operator
 GPRS_timeout: 0 The modem will be permanently connected
 
 MTX_PIN: 0000 The SIM card’s PIN number
 MTX_mode: none Serial GPRS Gateway mode. Set to “none” as they are not used
 MTX_model: MTX65i MTX65i model where MTXTunnel is installed
 MTX_portAux: modbusmaster Aux port to be used as Modbus master
 MTX_TPServer: time-a.timefreq.bldrdoc.gov Time server (MTX must synchronize the time)
 MTX_TPServer2: ptbtime1.ptb.de Backup server time
 MTX_ping: 35 Ping will be sent every 35 minutes when there is no connection
 MTX_pingIP: 8.8.8.8 Address where the ping is sent
 MTX_radioBand: europe Not necessary. “Europe” indicated if MTX is installed in Europe
 MTX_rssiLevel: 10 LED to show network coverage of MTX-65i is activated
 
 SMS_allPhones: on SMS can be sent using commands from any mobile phone
 SMS_sendIP: on The modem will respond with its IP via a missed call or SMS
 SMS_ATEnabled: on Commands can be sent to MTX via SMS
 SMS_ATResponse: on MTX will respond with an SMS to commands sent via SMS
 
 FIREWALL_enabled: off Connections to the modem (via Telnet) can be made from any IP
 
 TELNET_enabled: on Set up Telnet on the modem
 TELNET_login: user Login for Telnet
 TELNET_password: 1234 Password for Telnet
 TELNET_firewall: off Connections via Telnet to MTX can be made from any IP
 
 LOGGER_enabled: on Activation of Logger of MTX to store readings
 LOGGER_password: ID00001 Field that will allow us to identify where the connections come from
 LOGGER_server: www.miservidorWeb.com/json.asp?data= URL where the JSON with data will be sent
 LOGGER_registerSize: 300 Size of the internal register of MTX
  LOGGER_numRegistersFlash: 1500 The maximum number of records inside MTX
 
 MODBUS_address: 1 Modbus address of the device to be read
 MODBUS_start: 20 Address of the first Modbus record to be read
 MODBUS_numwords: 4 Number of records to be read after the first
 MODBUS_period: 900 MODBUS_period: 900

 

Details:

  • In this example a MTX-65i with RS232 communication is used for MODBUS communication against a PLC, although it could easily be an RS485 without problem. In this case, a MTX-65i-RS485 model could be used (with incorporated RS485 communications).
  • A summary of this example is as follows: the modem periodically (every 15 minutes) reads a series of ModBus records from the PLC and sends them via a JSON object to a Web server (at the URL specified in the LOGGER_server parameter). If the record cannot be sent (due to there being no GPRS coverage or because of a down server), the data is stored in memory to be sent later. Through Telnet it is possible to connect directly to the device and consult/change the PLC’s records in real time (for this, search for the commands AT^MTXTunnel=getmodbus and AT^MTXTUNNEL=setmodbus in this manual).
  • The JSON object sent to the URL specified in LOGGER_server is encrypted in the following way: {“IMEI”:353234028103206,“P”:“ID00001”,“A”:1,“TS”:“20/08/12 08:31:44”,“V1”:23,“V2”:275,“V3”:274,“V4”:32765}

This means that the Web server receives a JSON object with the IMEI of the modem, a password field (P) that can also be used to identify the device (if you do not want to use the IMEI), the device’s Modbus address (A),the timestamp (TS) of when the Modbus data was read, and V1, V2, etc.