Looking for something else?
Titan – AN33: How to Get GPS NMEA Data via Serial Port, TCP Client Socket, or TCP Server Socket
Table of Contents
Some models from the Titan router family (MTX-Router-Titan-mini-3G-GPS, MTX-Router-Titan-mini-4GGPS, etc.) have an internal GPS. This means that besides 3G router conventional tasks (giving Internet connectivity to connected devices), they can also perform additional tasks with the GPS location.
There are several application notes like the AN24 where it is explained in detail how to implement a small fleet control with router Titan, or the AN29 where it is explained how to access the GPS location via TCP or RTU Modbus.
In this application note it will be detailed how to access directly the router’s internal GPS NMEA data. Said access will happen via a serial port, a TCP Client socket or a TCP Server socket (or all of them). Different methods for different applications.
Titan Router Configuration to Access GPS NMEA Data via RS232
First we will configure sending NMEA data via an RS232 port. Let’s say we have PLC connected to the COM RS232 number 2 of the Titan router, and the configuration of the serial port RS232 of the PLC is 9600,8,n,1. We need to click on the menu “Serial Settings” > “Serial Port2 – 232” and we configure it as shown below:
After saving the configuration, we click on the menu “External Devices” > “GPS Receiver”. We configure the menu as shown below, activating the GPS, selecting the GPS we are going to use (normally the internal GPS) and selecting the serial port where the GPS locations will be redirected to. We save the changes and restart the router to be able to user the new configuration.
Sending NMEA Data to an IP Address and TCP Port in Real Time
If we want to send NMEA data to the address 126.96.36.199 and TCP port 20010, the configuration would be the following:
Note we have established a value “5” in the “TCP Client timeout” parameter. This means that once the TCP Client socket opened by Titan router closes, the router will try to reopen it in 5 seconds. It is possible to enter value “0” so the retry is immediate, but it can generate a high data consumption in case your server is down.
Sending NMEA Data to Enter TCP Sockets Connecting to a Router Port
We may need the Titan router to have a socket server prepared to the event of an external socket connecting, so the GPS NMEA data is sent through it. For this configuration it will be enough to specify the listening TCP port:
Once the router is restarted, if we open a socket against the router IP (LAN or WAN IP) we will get the NMEA data in real time, 1 data per second. Note: access to the TCP Server socket via WAN is posible only with firmware versions 4.02.4.06 and up.