Suchen Sie etwas anderes?
Scenario details:
- We need to monitor 100 devices with an RS232 port (115200.8.N.1 and HW flow control) from a central control station using a GPRS link. This will be done using the MTX-Tunnel acting as a transparent serial – 4G tunnel
- Access to the RS232 remote devices at any time is mandatory, so the modem connected to the serial port device (which needs to be controlled) must remain permanently connected to 4G waiting for a connection. Access to the modems must only be allowed for the IP coming from the PC Control (200.200.200.200) and also for a backup IP coming from the central office fiber line, whose IP is: 200.200.200.201
- In order to reduce costs, SIM cards will use dynamic IP addressing. As we have a large number of modems, we will not use DynDNS. So MTX Tunnel will send the IP every time that it the WEB server has been assigned a new one by HTTP (the IP address value assigned by the GSM operator). Every time a modem changes the IP address, the modem must send the new IP address value to the control centre (with URL http://www.miweb.com/datosIP.asp and port 8080). This way the external WebServer will store the IP in a SQL server database so the PC control centre has access to the devices at all times
Solution: MTX-Tunnel firmware + MTX-Java-IoT/MTX-Java-T/MTX-Java-T2
Config.txt configuration file:
Configuration | Observations |
COMM_baudrate: 115200 COMM_bitsperchar: 8 COMM_autocts: on COMM_autorts: on COMM_stopbits: 1 COMM_parity: none GPRS_apn: movistar.es GPRS_login: MOVISTAR GPRS_password: MOVISTAR GPRS_DNS: 8.8.8.8 GPRS_timeout: 0 MTX_PIN: 0000 MTX_model: MTX-4G-JAVA-IOT-STD-N MTX_mode: server MTX_urc: off TCP_port: 20010 FIREWALL_enabled: on FIREWALL_IP1: 200.200.200.200 FIREWALL_IP2: 200.200.200.201 DNS_enabled: on DNS_mode: http DNS_httpMode: get DNS_password: 12345678 DNS_server: miweb.com:8080/datosIP.asp DNS_extended: off |
Serial port baud rate 8 bit data CTS hardware control enabled RTS hardware control enabled 1 stop bit No parity GPRS APN from your network operator GPRS Login GPRS Password Google DNS. Must be used if TCP_IP is set to DNS Value 0 means MTX-Tunnel is always connected If SIM card has no PIN security, use 0000 MTX terminal modem model used TCP server mode URC messages will not be sent TCP port used Enabled to accept authorized IPs This IP can only connect to remote modem This IP can only connect to remote modem DNS service enabled GPRS IP address sent using HTTP GET It will be reported by HTTP GET Password string sent in DNS communication DNS server URL GPIO and ADC values extra information is not sent |
Details:
- Bear in mind that when using HTTP, if you use a TCP port different to the standard HTTP (TCP 80), the port must be included in the parameter “DNS_server” and not in “DNS_port”
- Each time MTX-Tunnel changes the IP address, it will connect through and use the following URL: http://www.miweb.com:8080/datosIP.asp?IMEI=&PASS=12345678&IP=
- The web server will receive the parameters sent by the MTX-Tunnel and store the IP address in a database. You can collect the parameters from the ASP page by inserting this example code in “datosIP.asp”.
<%
IMEI=Request.QueryString (“IMEI”)
Password=Request.QueryString (“PASS”)
IP=Request.QueryString (“IP”)
%>
- If you prefer (recomended), you can send data to the server in JSON format via GET or POST. For example, if you wanted to send data in JSON format via HTTP GET, you would have to modify the configuration with something like this:
Configuration | Observations |
DNS_server: www.miweb.com:8080/datosIP.asp?data= DNS_httpMode: getjson |
URL where the IP will be sent Data will be sent in JSON format |
- And to send data in JSON format via HTTP POST you would have to modify the configuration the following way:
Configuration | Observations |
DNS_server: www.miweb.com:8080/datosIP.asp DNS_httpMode: postjson |
URL where the IP will be send Data will be sent in JSON format |
- When your modem is configured in getjson / postjson mode it will send a JSON with the following format:
{“IMEI”:357042060366409,”TYPE”:”DNS”,”P”:”12345678”,”IP”:”88.28.253.206”, “CSQ”:26,”VER”:”9.12”,”AUX”:””,”MOD”:”201”}
Where each parameter is:
IMEI | the unique identification number of the modem |
TYPE | type of JSON sent (DNS in this case) |
P | user’s field specified in DNS_password parameter |
IP | modem’s current IP |
CSQ | rssi of the modem (between 0 and 31) |
VER | MTX-Tunnel version |
MOD | MTX modem model |
- Remember that you dispose of the configuration parameters DNS_header1, DNS_header2, DNS_header3 if you want to add headers to your HTTP requests