Arduino GPS Tutorial Complete Guide


In this tutorial, I will be showing you how to use Arduino, a GPS Arduino shield and a SD card to make a handheld Arduino GPS logger, to record your latitude and longitude over the course of a day.

Addition to this tutorial, check out my latest post about how to use the GPS with Arduino.

I will be taking it step by step:

  1. How does it work?
  2. How to interface this into your robot or other projects

Basic GPS Working Concept

GPS satellites orbit the Earth at an approximate altitude of 20,000 km. For a GPS unit to fix its location it needs to receive signal from at least 3 satellites.

The GPS signal that is transmitted from each satellite contains:

  • Time (accuracy of millisecond) (GMT time).
  • Date
  • Position (accuracy of 2 to 3 meters)
  • Altitude

From these information, it is also possible to work out compass heading and speed.

The Tools

The reason we use Arduino is because it’s very easy to integrate into different projects, and it’s very popular among electronics hobbyists. I also will be paring the Arduino with a GPS Shield which uses a USGlobalSat EM-406A receiver.

Arduino GPS Tutorial

Arduino GPS Work Through

Okay, let’s get our hands dirty. I will break the tutorial into 3 parts.

Part One: Receiving Data from the GPS Unit via Serial Port

Firstly, we set up the system in basic configuration. We will try to talk directly to the GPS via its serial port just by connecting a FTDI cable direct to the GPS shield board, so we can check what kind of data we will be receiving on our computer.

  • Remove the ATmega chip on the Arduino Board as we only need the serial circuit on the Arduino.
  • Place a jumper cable between digital i/o pin 2 and ground (as Shown Below).
  • This switches the GPS Unit on and you can use the Arduino’s serial port to read the data.
  • Then wire the GPS unit so that:

GPS RX to digital pin 0
GPS TX to digital pin 1
GPS PWR to digital pin 2

Arduino GPS Tutorial

The GPS unit can be attached to the Arduino and the USB connected.

Select the Arduino’s Serial Port and adjust the speed to 4800 Baud.

The resulting output stream should look something similar to this:

Lets break it down the last Bold Line

  • $GP —– G eographic P osition
  • RM ——- R eccomended M inimum
  • 150139.000 ——– Time 15:01 and remainder in milliseconds
  • A ——— A ctive (else could be V for V oid)
  • 4725.0892,N —— Position Latitude 47 Deg 25.0892 Minutes N orth
  • 00922.8755,E ——Position Longitude 009 Deg 22.8755 Minutes E ast
  • 190309 ——— Date 19 th march 2009
  • *09 —— Checksum
  • $GPGSA string contain information about quality of signal
  • $GPGGA string contains location – quality of signal – and amazingly Altitute information

Part Two: Process GPS Data In Arduino

Remove the Jumper off the Arduino and Plug the ATMEGA chip back in and install the GPStest_RMC.pde script. Don’t forget to install a AFSoftSerial.h library into the Hardware/Libraries

Then wire the Arduino GPS unit (picture above) :

GPS RX to digital pin 3
GPS TX to digital pin 2
GPS PWR to digital 4

Open up the Arduino’s Serial Port and set to 4800 Baud

The resulting output stream looks a bit like this:

If you notice the Arduino GPS has extracted the data (in Bold) into variables which can be used in your normal programming.

As simple as that.

Part 3: Use 3rd Party Software to Display the Arduino GPS Data

With the Arduino Set up this way you can attach many third party GPS software packages.
Here is a free-ware version called mini GPS.

Arduino GPS Tutorial

If you take a close look the Altitude – Speed – and Track (heading) are also calculated.