News

Telemetry advanced gateway

Advanced example 1. GPRS-RS232 gateway (TCP server mode) with sending of IP to a private server

The following example will show how to configure MTX-Tunnel to create a transparent Serial GPRS (RS232 or RS485) tunnel that is permanently connected to GPRS. SIM cards with dynamic IP addresses will be used; therefore, each time a change in the IP address is detected, MTX-Tunnel must send the new IP address to the server so that it is known at all times and a connection can be made to establish a Serial GPRS gateway whenever required.

Details of the example scenario:

  • There are 100 devices with RS232 ports (115200,8,N,1 and hardware flow control) which need to be monitored from a control center via GPRS. 100 MTX-Tunnels will be used to act as a transparent Serial GPRS tunnel.
  • Access to the RS232 devices must be available at all times, so the modem connected to the device’s serial port must remain continuously connected to GPRS, waiting for a connection. Modems will only accept incoming connections from the IP central office (200.200.200.200) and the backup ADSL of the central office (200.200.200.201).
  • In order to reduce the cost, SIM cards with dynamic IP addresses will be used. As there are many devices to be controlled, DynDNS cannot be used and the MTX-Tunnels must send their IP address to the private DNS server. Each time the MTX-Tunnel changes its IP address, it must be sent to the control center (IP address 200.201.202.203 and TCP port 20000). In this way, the control center PC will always know the current IP address of each modem.

Configuration files for the MTX-IND and 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.

The parameters to be looked at from this example are those with the “DNS_” prefix. These are the ones that make sure MTX-Tunnel sends its IP address to the server each time it changes. For this we configure the “DNS_enabled” parameter to “on”. The IP address will be sent via a TCP/IP socket to an IP (DNS_server) and TCP port (DNS_port), meaning the “DNS_mode” parameter contains “socket”. A Web server with “http” could be used, but this would be another example.

Telemetry low consumption

Example 1. GPRS communications in Ultra-Low Power mode (ULP)

The following example shows the typical configuration for an ultra-low power system with GPRS communications. Let us imagine that our scenario takes place in the countryside and therefore standard power supplies (220V) are not available. We have three devices with RS232 ports that will collect specific data that we want to read once a day from a control center.

As mentioned, power consumption is critical in this application and therefore the GPRS modems must be totally switched off (consumption of 2µA) and only switched on for a few minutes a day so that the information can be sent to the server. In this way we can ensure that the modem’s batteries last several years.

Details of the example scenario:

  • There are three weather stations with RS232 ports. These are battery operated and meteorological data is continually stored inside. We need to read this data once a day via GPRS, without compromising the system’s low power consumption; i.e. the GPRS modem connected to the weather station must use as little power as possible.

For this reason, the GPRS modem has to be in low power mode (2 µA) for 24 hours.

  • Then, after 24 hours, the modem has to wake up and connect to the GPRS and the remote server (IP address 200.201.202.203).
  • Once connected, the MTX-Tunnel must identify itself so that the server knows which of the three stations has made the connection. For this, each modem must send a unique ID, for example “Equipo1”, “Equipo2” and “Equipo3”. Once sent, the transparent GPRS-RS232 tunnel between the central servers and the weather stations will be established, meaning the central server can read the data as if a serial RS232 cable were connected.
  • The connection will last two minutes. If the two minutes pass and no GPRS traffic is sent or received, MTX-Tunnel will return to its ULP mode and will not wake up again until 24 hours later.

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


Configuration files for the MTX-IND and 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.

Example 2. Relay control via GPRS and reading of analog and digital inputs

The following example is similar to the previous one but instead of controlling the relays via SMS, we will do it using GPRS. We will assume that we need to create a PC application that can connect to several GPRS devices which are distributed geographically to commute with relays and to read the status of six digital inputs and two analog inputs – one which is 0-2.4V and the other 4-20mA. We will use the MTX-Tunnel-IND platform, given it consists of four relays, 6 digital inputs and 2 analog inputs.

How do we do this? The easiest way is with Telnet. MTX-Tunnel supports Telnet, therefore we can open an MSDos console, writing “Telnet xxx.xxx.xxx.xxx” where “xxx.xxx.xxx.xxx” is the current IP address of the MTX-Tunnel, and we will be remotely connected to the MTX-Tunnel (which have GPRS connectivity) using our PC (which we assume has an Internet connection). Once connected, we can send AT commands to the modem. Below we have an example:

In this example we can see that we have connected to the MTX-Tunnel via Telnet, and we send the AT command “AT+CSQ”. This AT command lets us know (remotely) the GSM coverage. Likewise, we can use an AT command to commute with the relays. In particular, we can use the following commands:

AT^SSIO=0,0 and AT^SSIO=0,1    to actívate and deactivate Relay 1 from the device RL1
AT^SSIO=1,0 and AT^SSIO=1,1    to actívate and deactivate Relay 2 from the device RL2 AT^SSIO=2,0 and AT^SSIO=2,1    to actívate and deactivate Relay 3 from the device RL3 AT^SSIO=6,0 and AT^SSIO=6,1    to actívate and deactivate Relay 4 from the device RL7.

To read the six digital inputs, similar to the previous commands, we can use the following:

AT^SGIO=3
AT^SGIO=4
AT^SGIO=5
AT^SGIO=7
AT^SGIO=8
AT^SGIO=9

And finally, to read the analog inputs, we will use these commands:

AT^SRADC=0    to read the A/D converter configured to 0-2.4V
AT^SRADC=1    to read the A/D converter configured to 4-20mA

We can send these commands very easily via Telnet using an MSDos console, although it is also very easy to program an application (in Visual Basic, .Net, C#, Java, etc.) that connects to the MTX-Tunnel’s TCP23 port (or the configured TCP port) and sends the AT commands to commute with the relays or analog and digital inputs.

Finally, we will activate the DynDNS service in such a way that a SIM card with a fixed IP address is not necessary.

Configuration files for the MTX-IND and 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.

 

 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_model: MTX65IND The chosen MTX model is MTX65IND
 MTX_mode: none No configuration is used (we do not use a Serial GPRS gateway)
 
 FIREWALL_enabled: off Firewall deactivated
 
TELNET_enabled: on Telnet activated
 TELNET_port: on TCP port for Telnet
 TELNET_login: user Login for Telnet
TELNET_password: 1234 Password for Telnet
 DYNDNS_enabled: on DynDNS service activated
 DYNDNS_server: members.dyndns.org DynDNS server for the account
 DYNDNS_hostname: mtxtunnel.dyndns.org The name of the DNS created in DynDNS for MTX-Tunnel
 DYNDNS_login: usuario Username of the DynDNS account
 DYNDNS_password: miPassword Password for the DynDNS account

 

Reading and remote control, sms alarm

SMS example 1. Sending an SMS alarm following a change in digital inputs

Details of the example scenario:

  • The scenario is very simple: you only need to send an SMS when a digital signal from an external circuit changes from “0” to “1”.
  • The SMS alarm must be sent for security reasons to five telephone numbers (677777771, 677777772, 677777773, 677777774, 677777775). The text must be “ALARM DETECTED”.
  • Once the alarm is produced, the digital signal can change continuously and therefore the number of SMS messages that can be sent must be limited to one per hour.

Proposed solution: MTX-65i and MTX-Tunnel. alarm-sms

Configuration files for the MTX-65i and 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.

 

 

 MTX_model: MTX65i The chosen MTX model is MTX65i
 MTX_mode: none A Serial GPRS Tunnel is not necessary
 MTX_urc: off We do not need the URC information messages
 ALARM_gpioEnabled: on We activate the SMS alarm service due to digital input changes
 ALARM_gpioValue: 1 The alarm will be sent when the digital input changes from “0” to “1”
 ALARM_gpioMessage1: ALARM DETECTED Text to be sent via SMS.
 ALARM_gpioPause: 3600 Stops more than one alarm being sent in an hour
 ALARM_smsNumber1: 677777771 Telephone 1 where the SMS alarm is to be sent
 ALARM_smsNumber2: 677777772 Telephone 2 where the SMS alarm is to be sent
 ALARM_smsNumber3: 677777773 Telephone 3 where the SMS alarm is to be sent
 ALARM_smsNumber4: 677777774 Telephone 4 where the SMS alarm is to be sent
 ALARM_smsNumber5: 677777775 Telephone 5 where the SMS alarm is to be sent