Do I need to say more about GPS? See here for some background info: Global Positioning System (GPS)
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:
- How does it work?
- 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).
- Position (accuracy of 2 to 3 meters)
From these information, it is also possible to work out compass heading and speed.
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 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
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:
$GPRMC,150135.000,A,4725.0890,N,00922.8760,E,0.06,198.98,190309,,*00 $GPGGA,150136.000,4725.0890,N,00922.8758,E,1,04,3.0,766.6,M,48.0,M,,0000*58 $GPGSA,A,3,13,25,23,20,,,,,,,,,3.2,3.0,1.0*37 $GPRMC,150136.000,A,4725.0890,N,00922.8758,E,0.05,195.81,190309,,*0E $GPGGA,150137.000,4725.0891,N,00922.8757,E,1,04,3.0,766.4,M,48.0,M,,0000*55 $GPGSA,A,3,13,25,23,20,,,,,,,,,3.2,3.0,1.0*37 $GPRMC,150137.000,A,4725.0891,N,00922.8757,E,0.07,208.54,190309,,*0C $GPGGA,150138.000,4725.0892,N,00922.8755,E,1,04,3.0,766.3,M,48.0,M,,0000*5C $GPGSA,A,3,13,25,23,20,,,,,,,,,3.2,3.0,1.0*37 $GPRMC,150138.000,A,4725.0892,N,00922.8755,E,0.04,197.77,190309,,*05 $GPGGA,150139.000,4725.0892,N,00922.8755,E,1,04,3.0,766.2,M,48.0,M,,0000*5C $GPGSA,A,3,13,25,23,20,,,,,,,,,3.2,3.0,1.0*37 $GPRMC,150139.000,A,4725.0892,N,00922.8755,E,0.05,178.49,190309,,*09
Lets break it down the last Bold Line
- $GP —– Geographic Position
- RM ——- Reccomended Minimum
- 150139.000 ——– Time 15:01 and remainder in milliseconds
- A ——— Active (else could be V for Void)
- 4725.0892,N —— Position Latitude 47 Deg 25.0892 Minutes North
- 00922.8755,E ——Position Longitude 009 Deg 22.8755 Minutes East
- 190309 ——— Date 19th 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
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:
read: $GPGGA,152635.000,4725.0900,N,00922.9192,E,1,05,3.9,809.1,M,48.0,M,,0000*5E read: $GPGSA,A,3,13,23,16,25,07,,,,,,,,5.1,3.9,3.4*3F read: $GPGSV,3,1,11,07,69,140,36,25,65,075,43,13,54,059,44,02,42,264,*79 read: $GPGSV,3,2,11,23,24,073,46,16,10,034,30,20,01,128,,08,38,193,21*78 read: $GPGSV,3,3,11,04,34,211,28,10,22,304,15,29,01,332,*48 read: $GPRMC,152635.000,A,4725.0900,N,00922.9192,E,0.21,257.90,190309,,*0A Time: 15:26:35 Date: 3/19/9 Lat: +470 25' 5.40" Long: +90 22' 55.15"
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.
If you take a close look the Altitude – Speed – and Track (heading) are also calculated.