Tunnel – Configuration modification from a PHP, ASP… webserver

¿Buscas alguna otra cosa?

Scenario details:

  • There are 1000 devices with RS232 port (115200,8,N,1 and HW flow control) which need to be monitored from a Central Control site via GPRS.For this purpose MTX-Tunnel will be used, acting as a 3G serial transparent tunnel
  • It is important to be able to access RS232 devices at any moment, therefore the modem connected to the serial port of the device should remain connected to 3G permanently waiting for a connection
  • For reasons of economy, SIM cards with dynamic IP address will be used.Taking into consideration the number of modems DynDNS use is discarded, and it is MTX-Tunnel that should send to a WEB server via HTTP GET (JSON) the IP (assigned by GSM operator) it has at any moment along with its status(coverage,etc.). Every time the modem changes IP address, it should sent to the control center (with URL http://www.miweb.com/datosIP.asp) its new IP to communicate the change. Independently on IP change, the modem will send its status data every 600 seconds (10 minutes)
  • It is important to be able to change the configuration of any MTX-Tunnel from a WEB Server. Since MTXTunnel will be sending its IP every 10 minutes minimum, HTTP request of the modem will be used to send configuration as a response (if there is any new configuration). This way it is very easy to make a massive configuration change of the 1000 modems

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

EXAMPLE of configuration file (config.txt file):

Configuration Observations
COMM2_baudrate: 115200
COMM2_bitsperchar: 8
COMM2_autorts: on
COMM2_autocts: on
COMM2_stopbits: 1
COMM2_parity: none

GPRS_apn: movistar.es
GPRS_login: MOVISTAR
GPRS_password: MOVISTAR
GPRS_timeout: 0

MTX_PIN: 0000
MTX_model: 199801393
MTX_mode: server
MTX_urc: off
MTX_rssiLevel: 10
MTX_ATEmbedded: on

TCP_port: 20010
FIREWALL_enabled: off
DNS_enabled: on
DNS_mode: http
DNS_httpMode: getjson
DNS_password: 12345678
DNS_server: www.miweb.com/datosIP.asp?data=
DNS_period: 600
DNS_aux: 0
Data rate of communication of serial port
Number of bits
CTS hardware flow control activated
RTS hardware flow control activated
1 stop bit
No parity
APN GPRS provided by the GSM operator
GPRS Login
GPRS Password
Modem is always GPRS connected
SIM Card PIN
MTX modem model
Modem is configured as TCP server
We do not need URC notification messages
Modem coverage LED enabled
Embedded AT commands sending allowed
TCP port of MTX for 3G-RS232 gateway
Firewall desactivated
IP to DNS sending service activated
Sending information via HTTP
HTTP GET JSON mode
Password string for higher security
URL of DNS sever where modem status is sent
Every 10 secs status is sent to the webserver
Auxiliary field to control configuraion version

Details:

  • With this configuration a JSON will be sent via HTTP GET to a specified Web server. It will be sent every time the device is reset, or its IP is changed every 10 minutes (as it happened before). Therefore, at least once every 10 minutes MTX-Tunnel will communicate with the WEB 
  • Server sending a JSON similar to the one shown in the following example:
{“IMEI”:357042060366409,”TYPE”:”DNS”,”P”:”12345678”,”IP”:”88.28.253.206”, ”CSQ”:26, “VER”:”9.12”,”AUX”:”0”,”MOD”:”201”,”VCC”:12000}
  • Where:
    IMEI: IMEI of the modem (Unique for each modem)
    TYPE: JSON type sent (DNS in this case)
    P: User field specified in DNS_password
    IP: Current modem IP
    CSQ: rssi of the modem (between 0 and 31)
    VER: MTX-Tunnel version
    AUX: Auxiliary field to control configuraion version
    MOD: MTX modem model
    VCC: MTX supply voltage (in millivolts)
  • When our WEB Server receives a JSON, the only thing for us to do is to compare the configuration version sent by MTX-Tunnel (field AUX of JSON) to the version we have on our Web Server. Let’s imagine, for example, that we have changed the configuration of a MTX-Tunnel on the server and indicated that the current configuration version is DNS_AUX: 1. When the MTX-Tunnel sends its JSON, we will receive a value AUX “0”. Since it is diferent from “1” (this is what we have on our server), we will send a new configuration to the moden
  • To send the new configuration to the modem we can send an AT command from the WEB server containing something like:
<MTXTUNNELR>AT^MTXTUNNEL=SETCONFIG,
COMM_baudrate: 115200
COMM_bitsperchar: 8
COMM_autocts: on
COMM_autorts: on
COMM_stopbits: 1
……
DNS_password: 12345678
DNS_server: www.miweb.com/datosIP.asp?data=
DNS_period: 600
DNS_aux: 1
</MTXTUNNELR>
  • That means that, as a response to periodic HTTP transmission of the modem, we send form the WEB server ALL the configuration file containing changes made and specify the value of the new configuration in DNS_aux.Really you are substituting modem’s “config.txt” file with the one you are sending.
  • Once the new configuratioof is received, the modem will reboot automatically. In few seconds it will communicate with the WEB Platform again to indicate its new IP and will check again the AUX parameter received inside of JSON. If everything has done correctly, the corresponding value of the new configuration will be “1”
  • Data transmission from your WEB Platform to the modem should be carried out according to the Server type you work with. For example, if the variable “configuration” contains all the configuration to be sent, from an ASP Server you could use something like:
<%
Response.Write(configuration)
%>

In a PHP server it could be something like:

<?php
echo $configuration;
?>
  • If you need to test this method, we recommend you to ask us for an account on our test server www.metering.es You will find it useful for your first tests and better understanging of how it works. For that and in case of any doubt send us an email to gsmsupport@matrix.es