The Global Positioning System (GPS) is attractive for robots, but has disadvantages.

More expensive GPS receivers can be more accurate. The GPS satellite system network is currently being upgraded, and performance of low cost units should increase substantially in a few years.

The Elcano design uses GPS as a secondary navigation system that removes drift from the other sensors.

Basic GPS

The GPS hardware is Adafruit Ultimate GPS+Logging shield. Tutorial is on

Plug the shield into a Duemillenove, Mega, or Uno; the Leonardo will not work. Upload a simple program such as “blink” from examples. Set the switch to “Direct”. From Arduino IDE, select serial monitor, and set it to 9600 baud. You should then see the messages from the GPS receiver. If you are outdoors, or close to a window, these messages will give your location. If you have no access to the sky, the message content will be blank. The GPS uses its own serial input and output lines, which are distinct from the Arduino Rx and Tx. Setting the switch to “Direct” routes GPS output directly to the PC via USB, bypassing the Arduino. Example messages:










To understand the messages, see NMEA Output Sentences in

The example has messages for RMC (Recommended Minimum Navigation Information), VTG (Velocity Relative To Ground), GGA (System Fixed Data), GSA (Satellites Active and Dilution of Precision), and GSV (GNSS Satellites in View).

The first RMC message gives the location as (47° 40.2972′ N, 122° 18.6698′ W) and time as 17:00:50.000 (10:00 AM PDT). UTC date is 10 June 2014, which matches the local date. GPS time is more accurate than most other time sources, though you need to compensate for the lag of transmitting the message. The 70 character (700 bits) $GPRMC message requires 73 ms at 9600 baud. The time at which the data are valid may not be the present time; note that the GGA and RMC messages have the same time tag.

Note that the example gives several different estimates of position, even though nothing has moved.

Serial Connection

The Duemilenove, Uno and Leonardo have only a single hardware serial port, and we like to use it for the monitor. We can get a second serial port by using “soft serial” port. The shield uses software to create a serial port on digital pins 7 and 8. The Mega does not support soft serial on these pins. However, the Mega has four hardware serial ports on digital pins (0,1), (14,15), (16,17) and (18,19). For the Mega, connect the GPS serial lines to one of the Arduino serial pairs. The GPS serial pins are in a row of six pins that do not connect to the Arduino. Wire GPS Rx to a Mega Tx and GPS Tx to a Mega Rx. For instance black wire from GPS Rx to Arduino D14 Tx3, gray wire from GPS Tx to Arduino D15 Tx3.

Go to and click on “Download ZIP”. Rename the folder to Adafruit_GPS and move to your sketchbook/libraries folder. Select Sketch | Import Library … | Add Library … Then upload File | Examples | Adafruit_GPS | leo_echo.

For Mega only, modify leo_echo to comment out //SoftwareSerial mySerial(8, 7);. Uncomment hardwareSerial mySerial = Serial3;

For all processors, set the switch to “Soft Serial”, open the monitor, and set baud rate to 57600. You should see GPS data similar to that in the example above.

Exercise: Modify the code to display only the RMC and GSA messages. Be sure to compute the checksum correctly. See

Micro-SD Card

Insert a micro-SD card connector side down into the slot on the shield. For an Uno or Duemillenove, you are good to go. For Mega or Leonardo, update the SD card library. See

For all processors, find the SD folder in your library, create a new folder called SD_Backup, and move the SD folder here. Download ZIP from, rename it to SD, and copy to the old SD directory location. That location may be:

Windows: Program Files (x86) \ Arduino \ arduino-1.0.5 \ libraries \ SD

On Mac the directory is /Applications/, which you can manipulate with the Unix shell.

Start the Arduino IDE, and open Adafruit_GPS | shield_sdlog.

For Uno or Duemilenove, comment and uncomment code so that you have:

// if (!SD.begin(chipSelect, 11, 12, 13)) {

if (!SD.begin(chipSelect)) { // if you’re using an UNO, you can use this line instead

For the Mega, you will want the Adafruit version of SD that supports SD.begin(chipSelect, 11, 12, 13).

// SoftSerial …

#define mySerial Serial3

// see if the card is present and can be initialized:

if (!SD.begin(10, 11, 12, 13)) {

Alternatively, plug the Mega into a MegaShieldTrio board. The board wires lines 11, 12, and 13 to 50, 51 and 52 so that the standard lines work with the Mega.

Upload the code, and open the serial monitor at 115200 baud. You should see something like:

Ultimate GPSlogger Shield

Writing to GPSLOG03.TXT








Remove the USB Cable and take the SD card out of the shield. Put the SD card into an adapter so that you can read it from a PC. Change the file extension from .TXT to .CSV and open with a spreadsheet. You should see something like:


Portable GPS

Put the SD card back into the shield. Take the Arduino with GPS shield and a 9.6 V battery and cable outside. When you plug it in, you have a portable GPS system. When the red LED goes out, you have a satellite fix and are acquiring valid data. Walk around the block (or drive) and it will trace your path. When you are done, unplug the device. Transfer the SD card to your computer. Open your trip file in a spreadsheet and sort it to isolate the $GPRMC items in chronological order. You may wind up with several files as you lose and reacquire GPS. Use the template GPS_UWB to produce a graphic of your path. Replace columns A through L of the template with your data, and use columns M though P to convert positions to meters. You may want to change the origin to something appropriate.


Software from Adafruit can be used with minor modifications.


Adafruit Ultimate GPS+Logging shield plus an Arduino.


(6/12/14): GPS Shield has been tested on Duemilenove, and on Mega with and without MegaShieldTrio. GPS and logging to SD card works.