What is MTXTunnel? 

The MTXTunnel is a piece of software that you can order from Matrix to installed on the following MTX modems (MTX65i, MTX65IND, MTX65ULP, MTX65+G,MTX65IND2 y MTX65i-RS485)

What is MTXTunnel used for? 

The MTXTunnel can be mainly used to create a transparent GPRS/GSM Gateway – RS232/485 serial. If you already have a machine or device with a serial port and you want to read/control it in the same way as if it were physically connected to your computer with a serial cable, MTXTunnel is the solution.

This is the scenario: serial equipment connected to a PC to read/write data in the device…

… with GPRS-Serial MTXTunnel gateway, the above scenario is showed in the following example. 

Now your PC has to establish a TCP/IP connection with MTXTunnel. Then, EVERYTHING you send to this TCP/IP connection will be sent to the equipment’s serial port by MTXTunnel. On the contrary, all of the information in the equipment’s serial port is sent to your server using the GPRS network. It’s as if the device were connected to the PC. 

¿Does MTXTunnel have to be at the PC server’s side?

It depends, but in general, it is not needed at the PC server’s side 99% of the time.

Ø     Not needed: If you already have your PC control software and already have the option to connect as TCP/IP or UDP, a modem with MTXTunnel is not needed. Just configure the IP and port of remote MTXTunnel and your PC will use the ready internet connection to send and receive data remotely.

Ø     Not needed: If your PC control software does not have the option of connecting using TCP/IP or UDP and the only option you have is to choose a COM port, the MTXTunnel+modem is also not needed. There are some freeware drivers for your operating system as Windows can emulate a COM port. Once this free driver is installed, a virtual COM (like COM100) will be installed in your PC and you must point to the IP and TCP port of the MTXTunnel remote. You must choose this virtual COM in your PC software. Please contact gsmsupport@matrix.es for more information about recommended emulation COM-TCP drivers.

Ø     Needed: If you need a “serial cable replacer” because for example you have to communicate 2 RS232 serial devices remotely and there is no intelligence or PC control software (you cannot install virtual COM port), you will need 2 MTXTunnels, one in each end. This is the scenario:

Does the PC always have to start the connection? Can MTXTunnel connect to the PC?

MTXTunnel has the following modes TCP Server, TCP Client and UDP.

  • TCP Server mode. MTXTunnel is waiting for incoming connections. This is to say that the remote device (PC server) will start and establish the GRPS-Serial Gateway. 
  • TCP Client mode. MTXTunnel will start the Gateway. It will connect to the configured IP + port of the server PC AND establish the GRPS-Serial Gateway automatically.
  • UDP mode. UDP is not oriented to connection protocol. MTXTunnel just waits for UDP packet and sends them to the serial port and vice versa. The data present at serial port is sent to a PC via UDP.

Does MTXTunnel have to be permanently connected to GPRS, whether it’s set as TCP Server, TCP Client or UDP?

No. It’s not. If your application requires it to do so, MTXTunnel can be always GPRS connected. Remember that network operators will bill the data volume, not time. 

If you do not need MTXTunnel to be connected 100% of the time and you want the connection to be sporadic, MTXTunnel can be activated in these situations:

1. – Missed call from authorized phone number.

2. – Incoming SMS including the word “on” from an authorized phone number.

3. – By a change on a level of an input.

4. – If the analog input is higher than configured.

5. – With any date/hour scheduled timing.

6. – Just when data is present on RS232 port (only TCP Server mode).

So… how long is MTXTunnel active for (GPRS connected)?

It’s configurable by the GPRS_timeout parameter. You can specify the time in minutes after which, if it doesn’t detect traffic at GPRS connection, MTXTunnel will close the session.

I want to use MTXTunnel as a TCP server so I can connect to them periodically from my PC in the central office. Do I need a SIM with a fixed IP address?

It is not mandatory. You have various ways to find out the remote IP if using normal dynamic IP addressing SIMs. You can either make a missed call or send an SMS with the word “on” to remote MTXTunnel equipments. MTXTunnel will reply with an SMS including the IP obtained at this moment in time.

New MTXTunnel is DynDNS featured. DynDNS is a service allowing you to associate DNS name (like modem1.dyndns.org) to the IP obtained by MTXTunnel. For now, you can use this for free: www.dyndns.org

I found that in my case I’m going to use thousands of MTXTunnel devices. I cannot use missed calls or SMSs to work out IP addresses. I do not want to use DynDNS as it can be difficult to handle and even costly. What can I do?

 The MTXTunnel will inform the server PC every time an IP address changes.  

You just need to enable a configuration parameter so each time MTXTunnel changes the IP it will send frame data to a server PC with the following information: IMEI, the newly obtained IP obtained and an optional user-configurable text.

Is it possible to send the new IP to a Web server? I’m more familiar with Web programming –ASP, PHP- rather than TCP-IP sockets. I’m thinking about using a Data Base. Is this possible?

Yes, it is. If you prefer, it’s possible for MTXTunnel to send the newly obtained IP address to a Web Server using http GET (URL + parameters).

MTXTunnel can be installed on several Cinterion-based modem terminals like MTX65i, MTX65IND2, MTX65ULP y MTX65+G.  What are the differences between them?

For main applications, the MTX65i is suitable.

If you need RS485 serial communication, remote activation of relays, or to be able to remotely read 4-20mA, the recommended modem is MTX65IND2.

If power consumption is critical, use the MTX65ULP modem as it can be completely powered-off (consumption is around 2uA) except in the configured situations.

If you need some extra features like GPS positioning, you should choose the MTX-65+G.

You are talking about relays, analog inputs…  Is MTXTunnel more than a Serial-GPRS Gateway? 

At the same time, MTXTunnel is a serial-GPRS Gateway and can also control digital input/outputs, analog inputs, relays, GPS receiver, devices connected to SPI/I2C, it can also read modbus serials and 868MHz radio devices…


-MTXTunnel can remotely read a digital input or change a digital output or switch a relay.

-MTXTunnel can send (X seconds configurable) digital input/output statuses, the GPS positioning to a PC or Web Server or via UDP/SMS and can remotely read a sensor connected to SPI/I2C. Look at the examples at the end of the manual to give yourself more of an idea.

And for example, I can control a relay from a PC in my office by sending an AT command via a TCP/IP connection?

Yes, you can send AT commands via TCP/IP; you can also send them from a normal modem, via serial ports or you can send them via SMS. You can also switch relays or read or write digital input/outputs on your Web page  (look at the API section in the manual and the example scenarios in the Annex)

So if I have understood correctly , I can send AT commands via SMS and I can switch a relay via SMS too? Even so, sending an AT command via SMS isn’t practical they are very complicated. 

You do not have to send the exact AT command. This means that the SMS text does NOT have to be “AT^SSIO=0, 0” to activate Relay #1. You can configure it and use ALIAS text.

Example: “RELE1ON” is the text of the SMS to activate GPIO0 (Relay #1). MTXTunnel will interpret it to AT^SSIO=0, 0.

You can create up to 10 different ALIAS text strings.

According to the specifications the MTX65i, MTX65IND and MTX65ULP have 2 serial ports. Could I control two RS232 serial devices with a single modem and a single SIM card?

Yes, you can.  MTXTunnel can control 2 RS232 external devices with just one SIM card. MTXTunnel will run 2 serial-GPRS running in parallel. Just remember that the MTX65i and the MTX65ULP secondary port cannot use flow control because the do not have the CTS and RTS lines; they only have the TX and RX lines. Look at the annex for a configuration example.

What about MTXTunnel installed on MTX65+G which has a GPS receiver inside? Can I use it for fleet management?

It’s not intended for professional fleet management. MTXTunnel reads the GPS positioning using some of the MTXTunnel GSM/GPRS services: IP tunnel, WebServer, Telnet or SMS.

MTXTunnel can be configured to automatically send the GPS position every X seconds. However, MTXTunnel does not internally store the position in the Flash memory. This is a typical application if GPRS coverage is lost. So, this is for basic fleet management as professional ones normally stores position points like a data logger. So it can only be used for very basic fleet management. There is another version of MTXTunnel intended for professional track & trace using the MTX-65+G device. This version is called the MTXTunnel-GPS and has another license price, configuration parameters and also the general functionality is different.

What is WebServer used for?

MTXTunnel WebServer which is included can be used to read the digital input/outputs or analog inputs and to change digital outputs easily  or relays from any PC (connected to internet) using a common internet browser.

Not only this, you can see and modify the MTXTunnel remotely. Also you can execute AT remote commands, like network coverage (AT+CSQ), check incoming SMS…

What is Telnet used for?

You can basically do the same with the Telnet service in MTXTunnel as you can with WebServer and run remote AT commands. It’s designed to be able to control MTXTunnel remotely through third party applications. Please read the Telnet and API section for more information. Whenever you are struggling to decide between Webserver and Telnet, we recommend Telnet as the remote access is a lot quicker.

I’m worried about unauthorized access when using Webserver or Telnet. 

MTXTunnel has an internal firewall which can be activated. Then MTXTunnel will only accept connections from previously configured IP addresses. Any other IP addresses will be blocked. Unauthorized access will not be granted to GPRS-serial tunnels, Webserver or Telnet.

Yes this is the problem but for maintenance purposes, I would like access to MTXTunnel at any time and in any location, from any IP address.

In this case Firewall WebServer must be disabled, but we recommend protecting WebServer with a Login and Password. MTXTunnel can work with our without a Login/Password (public WebServer). The same applies for Telnet.

Going back to talking about SMS, you said we could control a digital output/relay via SMS but would it be possible to send an SMS alarm when a digital input changes?

You can configure MTXTunnel to send special and configured SMS text strings up to 10 configured different phone numbers when a change in digital input is detected.

MTXTunnel 5.0 is a GRPS-Serial tunnel Gateway. What is a GRPS-I2C, GPRS-SPI, HTTP-Serial or SMS-Serial tunnel? Do you have some examples?


GPRS-I2C Tunnel: You can read an I2C sensor remotely like a temperature sensor.

GPRS-SPI Tunnel: For example you can write data on SPI bus and if a display is connected to it, the data will be on display.

HTTP-Serial Tunnel: Example. You have a Web page with a form. All filled form data can be sent to serial port MTXTunnel connected device. Then MTXTunnel will collect the machine response and send the data as a web response to your Web page.

SMS-Serial Tunnel:  Example. You can define a special text like “MTX” at the beginning of the SMS string. The text after this special string will be redirected to the serial port of the machine. MTXTunnel can get the response from the machine and send another SMS to the user. Example: “MTX 12345”: MTXTunnel will send “12345” string to the serial port and will get a response from the machine like “67890”, which will be sent as SMS.

I see that MTXTunnel can be used with the MTX65ULP modem for low consumption applications. What does it allow me to do?

The MTX65ULP is normally switched off completely. This way the power consumption is about 2 uA. The modem is off and cannot do anything. It cannot receive calls, SMSs or communicate at all. Therefore an event needs to happen.

This event is similar to an interruption. A digital input level change or an alarm can wake up the modem. As an example, MTXTunnel will wake up every 24 hours; send the telemetry (all the inputs values, RS232 …) and after 5 minutes of being awake, the terminal will be automatically switched off. You can control or configure the wake up time and the sleep time period.

Is it also possible to define scheduled wake up tasks. For example, MTX65ULP can wake up X minutes every day at 10.00 AM or only on the 1st and 15th days of the current month at 08.00am and 08.00 pm.

If MTXTunnel can be configured to wake up at a specific time, does this mean that it has a clock inside?

MTX65ULP has own Real Time Clock independent to TC65 RTC and is always powered from external power, but it also has own battery source. This RTC allows to the modem wake up at configured-scheduled time/date.

Can this timing be synchronized?

All RTCs have some deviations. So, MTXTunnel can use network timing synchronization via GPRS. This feature is mandatory to use with the MTX65ULP. This way, every time MTXTunnel is connected to GPRS, it is linked to a timing server and can update the internal timing (UTC hour). This also needs to be used in order to use Datalogger which is included in MTXTunnel.

MTXTunnel used on the MTX65ULP wakes up at configured day/hour for some time (x minutes). Will the GPRS-Serial Gateway be active at this time?

During wake-up time, the modem will start and will run all configured services (WebServer, Telnet, Input/output telemetries…) as well as the serial tunnel gateway if it is configured.

What about SSL security, how does that work?

Some applications need some encryption data transmission. SSL is used. This way the data is transmitted and received SSL encrypted, avoiding data recovering sniffer. SSK is only available in TCP client mode. Be sure than your server can support SSL sockets in the following specifications:

Nevertheless, we recommend SSL encryption if it is mandatory due to the bigger amount of data volume and the reduction in data speed transfer.

What is API used for?

API is mainly a way to integrate MTXTunnel in end user application. Basically it’s like a special AT commands end user. It can easily integrate in a web page and for example can also switch a relay (change an Output). API could also be used to remotely access MTX configuration and send AT commands at the same time without knowing all of the configuration parameter syntax.

I would like to connect a modbus device to an MTXTunnel serial port. I also want the MTXTunnel itself to read the PLC’s Modbus memory periodically, saving the data to memory and sending to to my hhtp server. Is this possible?

Yes. MTXTunnel can periodically get information from the modbus device connected to its serial port, storing the data to memory and sending it to the http server via JSON object. If there are problems when sending information due to coverage or whatever, it can store up to 1500 readings.

One last question. Can you order the MTX65IND2 modem with a 868MHz radio Wavecard? Can you give me some examples of use?

Examples of using MTXTunnel installed on a MTX65IND with a 868MHz wavecard:

1.- GPRS / 868MHz communications hub for reading Waveflows (radio pulse counters for water. gas, electricity).

2.- GPRS / 868MHz communications hub for reading Wavetherm devices (868MHz temperature radio probe)

3.- GPRS/868MHz communications hub for reading 4-20mA sensors (via wavesense, 868MHz devices)

4.- GPRS/868MHz communications hub for reading digital inputs (via wavelog, 868MHz devices)

The MTXTunnel is in charge of periodically getting information from radio sensors and sending it to the web server via http JSON.

Is it possible to access the advice via GPRS and GSM at the same time?

Indeed, since MTXTunnelv7.11 is has been possible to establish gateways with both at the same time, but GSM calls have priority. A typical is example is that of an energy operator (Endesa, Iberdrola…). They could want daily access to a meter to take a reading via GSM but you also want to be able to access the meter but via GPRS, MTXTunnel allows you to do this.

MTXTunnel offers a wide range of options, how do you configure a specific scenario?

The new MTXTunnel V7 has a lot of configuration parameters, they are explained in more depth in the FAQ section. Take a look in the configuration section.

Next you can find step-by-step MTXTunnel examples of first configuration scenarios; they are very useful for you for first hand-on.

In the annex there are lots of examples of scenarios with the appropriate configuration to get MTXTunnel working. Try to find the closest scenario to you and review the copy & paste selected configuration, it’s nothing more special than that.

If you have specific questions contact the support line gsmsupport@matrix.es and we will gladly help you.