Getting Started with GPS on the TS-7670

One big draw to the TS-7670 is the GPS receiver feature. When paired with a wireless network, such as through WiFi or cellular, it becomes a powerful tool in asset tracking or geo surveying. In this quick guide, we’re going to go through what it takes to get GPS working and how to read the data.

Introduction

The TS-7670 uses the Telit SL869 Positioning GNSS with an external SMA GPS antenna (CB-ANT-GPS). It communicates through a UART serial port on the TS-7670 located at /dev/ttySP4 and reports standard NMEA statements every second or so. This data can be parsed using a script or, better yet, a third party set of tools such as gpsd. We’ll be verifying our serial connection and then install and use gpsd tools to help make sense of the data. Finally, we’ll look at an example Python script that prints out latitude and longitude as well as a bunch of other helpful data.

Verify Serial Connection

Once the system is powered on, the GPS receiver will be communicating over /dev/ttySP4. We’re going to use picocom to double check that the receiver is working properly before continuing to the next steps. So, open a terminal on the TS-7670 and use picocom to test the connection:

If successful, you’ll see it start spewing out data that looks something like this:

Although it looks like spilled alphabet soup, this is a good sign. You can see why we’d want to let a third party tool do the translation work for us. So, that’s what we’ll do next, install gpsd .

Installing and Starting GPSD

Installation is very straightforward. It’s just a matter of using apt-get  to install the gpsd and gpsd-client programs. While we’re at it, let’s go ahead and grab the python packages as well for later sections.

Once finished, you should now be able to start the daemon using:

Now, we’re all set and ready for the next part! Using the gpsd client utilities to actually see sensible, human-readable data.

Using the GPSD Utilities

There are two main utilities we’ll be looking at here: cgps  and gpsmon . The cgps  utility is a demonstration client. The gpsmon  utility is “a monitor that watches packets coming from a GPS and displays them along with diagnostic information”. gpsmon  displays a lot of data in a table-like output while cgps  displays a respectable amount of data in a less fancy way. Let’s take a look at both:

With, cgps  you’ll see:
With gpsmon , you’ll see:

With each, you can see there is lots of data to read through, including the very important latitude, longitude, and time data.

Let’s now take a look at scraping through this data and creating a simple script to do something with it.

Pro Tip: If your terminal is spitting out question marks and other nonsense in place of the pretty lines you see in the screenshots above, you’ll want to setup the locale to use en_US.UTF-8 and setting your terminal emulator to identify as ‘xterm’. Issuing the command ‘dpkg-reconfigure locales’ will provide you with an option to select en_US.UTF-8 locale and set it as default. Once it has finished running, logout, set up your terminal preferences, and log back in again.

Programming or Scripting with GPS Data

You can program in several languages, including C/C++, using the gpsd library, but we’re going to keep it simple and stick with Python. Here’s an example Python script (source) that will output a bunch of data from the GPS receiver:

When you run it, you’ll see output similar to this:

And, that’s that! Obviously, you’re going to want to modify the code to suite your specific application requirements.

Conclusion

In this getting started guide, we learned about the GPS receiver on the TS-7670 and how to interface with it through a serial port and third party utilities. We explored example scripts and created a Python script which we can use as a jumping off platform for a GPS enabled project.

If you have any questions or comments, please us know in the comments below or let the embeddedARM community know!

Author: Derek Hildreth

eBusiness Manager for Technologic Systems