Let's Make Robots!

GPS - The Complete Guide - Arduino based Global Positioning System

Use an Arduino GPS Shield to Fix position,altitutude,time,date........

GPS:- The Complete Guide to Global Positioning Systems.

Blogged Here :- Guide to Global Positioning Systems.  

Check also:- Fundamentals of a GPS guided vehicle ( patrickmccabe)

How they Work and How to interface them into your Robot.

Does your Robot need to fix its absolute Position - Speed - Heading - Time - Date & Altitude.

Here is a Guide to explain the Process.

GPS satellites (presently totalling 31) orbit the Earth at an approx. altitude of 20,000Km.

For a GPS unit to fix its location it needs to receive at least 3 satellites

The GPS signal that is transmitted from each satellite contains:-

Time.        down to the millisecond range (GMT-referenced).
Position.   accuracy 2 to 3 meters.

From this information it is also possible to work out Compass Heading and Speed.



What follows below is an Arduino based system that i can Highly recommend.

It is very easy to interface into projects.

It is a compact robust system and very reliable.

I will be using a GPS Shield using the USGlobalSat EM-406A receiver

This Shield has also a data logging facility that saves to an SD card .


 This walk through is in three parts :-

 Part 1 :- using a serial port to retrieve data from a GPS unit

Setting up the basic system - (i included the first part because it is possible to talk directly to the GPS via its serial port just by connecting a FTDI cable direct to the GPS sheild board .)


So for the first part we will be using just the serial port of the Arduino as an example.

Remove the ATMEGA chip on the Arduino Board (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 Arduinos serial port to read the data.



Then wire the  GPS unit so:-

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

The GPS unit can be attached to the Arduino and the USB connected.
Select the Arduinos Serial Port and adjust the speed to 4800 Baud.

The resulting output stream looks a bit like this:-

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 2 :- How can we make use of this information by using an Arduino Script.

Remove the Jumper off the Arduino and Plug the ATMEGA chip back in and install the GPStest_RMC.pde script.


Dont forget to install a AFSoftSerial.h library into the Hardware/Libraries


Then wire the  GPS unit so (picture above) :-

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

Open up the Arduinos Serial Port and set to 4800 Baud

The resulting output stream looks a bit like this:-
Time: 15:26:35
Date: 3/19/9
Lat: +470 25' 5.40"
Long: +90 22' 55.15"


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

Its as simple as that.

Part 3:- Third party Software.

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.



 and here is another



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Yes the new format looks fantastic.

And for sure if you wanted to do any serious GPS programming the extra memory is nessesary.

They could have put more into reducing the size a bit though. (i doubt it will fit into My Altoid Mint tin now)

I am glad to see they have put what looks to be an (IDE type) connector on the back end, they should have doubled all the connectors this way and shrunk the size ....anyway .

I attached  IDE connectors (old diskdive cable plugs) to the sides of my ProtoShield ie pointing outwards (it was a pig of a job to do) however super to access the Arduino pins after stacking various other sheilds on top.

If you need even more code space than even the Atmega328/Arduino, check the pre-order information for the new Arduino Mega at this link. You can get 128K (not to mention it has 54 digital I/O - 12 with PWM, and 16 analog inputs). A bit more pricey than a standard Arduino or adding a 328 chip - but appears to be a great option...

Nice post!

This year I will work with GPS with Java. If you like we could exchange informatio to improve our libraries with GPS.


Yes i would be very interested - my knowledge of Java is not so Hot, however i have a "little" experience interfacing Arduino to Java.

One thing to look out for is the base Arduinos 1K memory is pretty full with the GPS programmes above, however you can upgrade to 2K with the  Atmega328  chip.

Nice walkthrough. One thing I might mention is that it would be good to provide links to where to find the GPS chip, GPS sheild, and the mini-GPS software. Some of us might be too lazy or too tired to go type them into a search engine ya know! :-)

My guess is that since you linked to ladyada for the Arduino script, all this stuff is from adafruit industries. They certainly have a shield that looks just like this one...

Whoops forgot to paste links

www.adafruit.com and www.ladyada.net

I just updated the Guide ....thanks

This will be only part one of the Guide i have planned a second to go with this on.

I didnt know you could just take the chip out of the arduino like that. 



Oh yeah. In fact, you don't really need all the arduino stuff, you can get by with just the chip, sometimes.