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.
Altitute.
Date.

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:-
------------------------------------------------------------------------------------------------
$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 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:-
-------------------------------------------------------------------------------------------------
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 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.

cheers

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.