Tunnel – Meter reading via GSM call and/or IP communications (without SSL/ TLS security). Incorporation of Device Manager (with SSL/TLS security) for modem management

Scenario details:

  • A large pack of electric meter boxes is available. For 15 years until today the readings of the contractors are carried out through GSM data calls (CSD) made to the modems connected to the electric meter boxes through the RS232 port. This project aims to make an evolution of this system, going from a GSM communications system (CSD) to one of IP communications (2G/3G). In addition, it is intended to add a remote modem management system (Device Manager) that allows remote monitoring of them, as well as being able to make changes to remote configurations, firmware update, certificate management, etc.
  • It is necessary to add high security to the system. This:
    1. The modems will be listening on TCP port 20010 (TCP Server mode) to make a transparent IP-RS232 gateway, but only accept connections from authorized IP addresses
    2. Communications between modems and Device Manager must be secure. Connections will be established from the modem (TCP Client) and must be SSL/TLS. MQTTS protocol will be used
    3. Modems should only accept CSD calls that are made from authorized telephone numbers, that is, from the telephone numbers of the Accountant Reading Center


Config.txt configuration file (master):

Configuration Observations
COMM_baudrate: 9600
COMM_bitsperchar: 8
COMM_autorts: off
COMM_autocts: off
COMM_stopbits: 1
COMM_parity: none
GPRS_apn: movistar.es
GPRS_timeout: 0
MTX_mode: 2G
MTX_PIN: 0000
MTX_mode: server
MTX_model: 199801422
MTX_ping: 35
MTX_ATLimited: off
SMS_allPhones: off
SMS_sendIP: off
SMS_ATEnabled: on
SMS_ATResponse: on
SMS_validPhone1: +34666123456
SMS_validPhone2: +34666123457
FIREWALL_enabled: on
TCP_port: 20010
MQTT_enabled: on
MQTT_server: ssl://broker.cervello.io:8883
MQTT_id: yku41420t957oh8t
MQTT_login: jfj1usly8ijhh9hizfr453
MQTT_password: gthhdte67y3ttes33fgg
MQTT_attopic1: [IMEI]/AT
MQTT_atrtopic: [IMEI]/ATR
MQTT_keepalive: 300
DNS_enabled: on
DNS_mode: mqtt
DNS_mqttTopic: [IMEI]/dns
DNS_extended: off
DNS_period: 600
CSD_enabled: on
CSD_allPhones: off
CSD_validPhone1: 666333444
CSD_validPhone2: 666444555
Serial port baud 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
Modem is always GPRS connected
GPRS connection server typeGPRS connection server type
Modem model
Ping time to oversee connection
Google IP (f.e.) to ping
No AT commands limitations
Send SMS with commands from any phone
Modem won’t respond to a missed call/SMS
Commands can be sent to the MTX by SMS
MTX responds with an SMS to a command SMS
Authorized phone number 1
Authorized phone number 2
Authorized IP will be able to connect to modem
IP address authorized 1
IP address authorized 2
Establish the gateway between ports
MQTT service enabled
Broker IP/DNS specified, including identifying port
MQTT topic to send AT commands
Topic to send replies to commands to
Connection keep alive (300 seconds)
Status data sending activated
MQTT sending mode
Topic where status data are sent
Extended data (E/S, ADCs…) are not sent
One sending every 600 secs (5 mins.)
CSD calls are enabled
Only telephone numbers admitted for CSD
Authorized phone number 1
Authorized phone number 2


  • In this scenario, it is possible to connect to the meter box by making a TCP/IP connection (on TCP port 20010) from the reading platform to the modem, but the connection via GSM data call (CSD) is also allowed. That is why in this scenario the modem must be forced to work using the 2G network (parameter GPRS_mode: 2g). In case of not needing GSM data calls, the GPRS_mode parameter can be changed to an “auto” value, that way the modem would use the 2G/3G network according to availability
  • We must adjust the values of the COMM_ parameters to match the configuration of the serial port of the meter box to which the modem is connected
  • In this example, the Cervello broker has been used as Device Manager, which is a platform fully compatible with MTX modems. Consult the Cervello documentation for operational monitoring of modem status, remote configuration changes, etc.
  • If we use SSL communications against the Device Manager and need to incorporate the root certificates of your broker, at the end of this document there’s an Annex with the procedure