GPS Basics

Pages
Contributors: bitsmashed
Favorited Favorite 33

Reading GPS Data

Most GPS modules have a serial port, which makes them perfect to connect to a microcontroller or computer.

Connecting to a Microcontroller

GPS modules to GPS Breakout connections

Once a GPS module is powered, NMEA data (or another message format) is sent out of a serial transmit pin (TX) at a specific baud rate and update rate, even if there is no lock. To have your microcontroller read the NMEA data, all that is needed is to connect the TX pin of the GPS to the RX (receive) pin on the microcontroller. To configure the GPS module, you will need to also connect the RX pin of the GPS to the TX pin of the microcontroller.

It is common for the microcontroller to parse the NMEA data. Parsing is simply removing the chunks of data from the NMEA sentence so the microcontroller can do something useful with the data.

For example, the microcontroller might need to read only the altitude of your GPS.

language:bash
$GPGGA,235317.000,4003.9039,N,10512.5793,W,1,08,1.6,1577.9,M,-20.7,M,,0000*5F

Instead of dealing with all of this text, the microcontroller can parse the GPGGA sentence and end up with only the altitude (in meters).

language:bash
1577

Once the microcontroller can grab the data needed, the information can be manipulated to create other interactions on the microcontroller.

The Arduino platform can parse NMEA data easily with the help of the Tiny GPS library. Check out the GPS Shield Getting Started Guide for a walk-through example on how to connect an Arduino to a GPS module and parse NMEA sentences.

Connecting to a Computer

A simple way to see the NMEA data directly is to connect the GPS module to a computer. For the connections, all that is needed is to power the GPS with the FTDI basic (in this case 5V and GND), then connect the TX pin of the GPS to the RX pin on the FTDI Basic.

GPS module to FTDI connections

Next, open a serial terminal program at the same baud rate of your GPS module. Even if the GPS does not have a lock, you should see NMEA sentences steaming by.

language:bash
$GPRMC,235316.000,A,4003.9040,N,10512.5792,W,0.09,144.75,141112,,*19
$GPGGA,235317.000,4003.9039,N,10512.5793,W,1,08,1.6,1577.9,M,-20.7,M,,0000*5F
$GPGSA,A,3,22,18,21,06,03,09,24,15,,,,,2.5,1.6,1.9*3E