Arduino GPS System

A fully functional GPS receiver with the ability to display the current location, heading, speed, average speed and maximum speed, the distance traveled, the bearing, distance and ETA to a way-point or coordinates, and the date and time.

Description

This is a sketch to interface an Arduino, SparkFun GPS Shield, digital compass (optional), and Nuelectronics LCD Keypad Shield together in a useful way, providing all the functionality of older commercial GPS receivers.

The sketch provides four modes of operation: current location, heading and speed; distance traveled, average and maximum speed; bearing, distance and ETA to a set of coordinates or a way-point; and the date and time. In addition, up to 20 way-points can be saved with names, so you can build a library of locations you have visited or plan to visit later. All settings can be configured on the fly from a configuration menu, and the settings and saved way-points are saved in EEPROM so they are persistent between power cycles.

The sketch uses Mikal Hart's excellent TinyGPS library and includes code from the ArduPilot Project for navigation.

The source code for the sketch is available for download below.

Hardware

Two hardware configurations are supported by the sketch. Version 2 supports a GPS receiver, while version 3 supports a GPS receiver and a digital compass.

GPS Receiver Only

In this basic configuration, the Arduino, SparkFun GPS Shield, and Nuelectronics LCD Keypad Shield are all stacked together using extra long stacking headers.

The only assembly required is attaching the GPS module to the GPS shield, soldering the stacking headers on to the GPS shield, and setting the toggle switch on the GPS shield to DLINE mode. After that, just attach the shields to the Arduino.

GPS Receiver and Digital Compass

Coming soon

Modes of Operation and Configuration Options

Current Location, Heading and Speed
The heading can be shown either as cardinal directions or in degrees.

Distance Traveled, Average and Maximum Speed
No configuration options.
Bearing, Distance and ETA to a Way-point or Coordinates
The bearing can be shown either as cardinal directions or in degrees, and can be shown as relative or absolute in respect to true north.
The ETA can be based on either the current or the average speed of travel.

Date and Time
The time can be adjusted for different timezones and daylight savings time.

Demonstration

More Information

AttachmentSize
2011-05-01 gpsSystem2.pde (GPS only)34.65 KB

Comments

Reference

I've just made a reference to your project at my page.
http://arduitter.blogspot.com/2010/09/off-topic-arduino-gps-system.html

Hi, which GPS module did you

Hi,
which GPS module did you use?.
I can't see it in the photo. And I'm wondering how it receives a GPS signal while sandwiched between the Arduino & the LCD Keypad Shield.

Btw, it's a very interesting project.

GPS Module and Reception

Hi Paul;

I used a EM-406A GPS module for this project.

The GPS receiver acquires a signal after a few minutes outdoors and intermittently when indoors. The determining factor in whether or not you will receive a signal is largely what the lcd shield is made of.

I've made my own shields using lead based solder and they cut down the signal far more than the Nuelectronics shield which I believe is RoHS compliant. Since there is very little lead content in the shield I am using, reception isn't too great a problem.

Many thanks

Hello -

Thanks for this project page! I was in the planning stages of a near-identical project, stumbled upon your Flickr pics, and voila ... I made some modifications to the code, and used a different GPS Shield and LCD keypad, but it works great.

I suspect my LCD shield contains a good bit of lead, as I'm unable to get a clear signal with the GPS directly underneath.

Anyway, just wanted to pass along my thanks for posting your code and pics.

Shrinkage

Hi, I'm trying to run this on a atmega168 but its too big! :O
Is there a cut down version of the code that only displays the position / speed?

thanks

De-biggening the Code

You can try to reduce the size of the code by eliminating the additional functions such as calc_distance and calc_bearing, and by dropping the variables and code for the unused displays.

The best way to go is by looking at the test_with_gps_device example sketch that comes with the TinyGPS library and adding in a display routine which interfaces with your display. Starting with the example sketch is probably easier than eliminating all the redundant code in my sketch.

Very interesting project

Very interesting project. I plan to build it too. Thanks for sharing the module info, sketch and library links.

WiFi

Hi all -

I'll add my kudos to the rest...This is a great project! Well done! I'm wondering if anyone has taken this to the next level... specifically, adding WiFi communication and a mobile-device front-end, which would turn this into a very cool, open-source tracking device. Integrate with Android My Tracks or iPhone i-blah-de-blah-track or Google Tracking or whatever?

Thanks,

Chris

GSM & GPS

Hi Chris,

To my knowledge (and a really quick search online), no one has tried doing this yet.

I have thought about adding a GSM module so the device could report it's location using short message service, but that has only been a thought so far. GSM might be something that I will pursue later, I'm not sure yet.

Thinking more about this, I do have a couple XBees lying around so I could make a short range tracker which would transmit to a dedicated receiver, but I might need to purchase more powerful XBees to make it useful.

What about just for direction (heading) with a digital compass?

I see that heading was included in this good work. I am not experienced with Arduino and new to it. Can someone suggest a digital compass capability I can use with ArduinoBT board?

Compass

Basically any digital compass can be used with an Arduino. Be sure to check the datasheet for the compass to learn how to interface it with the Arduino.

A pile of compasses can be found at: http://www.sparkfun.com/search/results?term=compass&what=products

Never Acquiring Signal

Sean,

I am attempting to recreate your project here and I am having some trouble. How did you connect your shields? i am just plugging directly in, do I need to connect TX,RX or power to the GPS in any way? Or jumper the TX?

I have been sitting at the Acuiring Signal screen for several minutes and my GPS has had a lock the entire time. Any idea why?

GPS Shields

Hi Sam;

I'm assuming you are using the Sparkfun GPS shield, and the GPS module is connected to the shield using the small surface mount connector;

On the shield there is a switch labeled UART / DLINE, this switch sets whether the GPS module communicates using pins 0 and 1 of the shield or pins 2 and 3 of the shield.

In the sketch I've uploaded, I chose to use pins 2 and 3 for communication so your shield needs to be set to DLINE mode to interface with the GPS module.

Assuming this is the issue, to fix it you can either change the communication pins in the sketch to 0 and 1, or you can toggle the switch to DLINE mode.

Hi. I was looking for

Hi. I was looking for something more or less exactly like this! But I am completely new to arduino and don't seem to find a list of items used. Could you tell me what you used in the project? Thanks!

GPS Reciever Parts

I used an Arduino, SparkFun GPS Shield, a EM-406A GPS module, and a Nuelectronics LCD Keypad Shield.

Couple Prog. questions for the author.

After seeing on Instructables.com someone coupling a gps receiver with a servo to move some dials ( http://www.instructables.com/id/Steampunk-Geocaching/ ) I've decided to incorporate the LCD into the box and make a little novelty device ( I think this has been done before ... several times .. somewhere.)

I'm an amateur C++ programmer, and what I'm looking to do is incorporate the code for the GPS/servo device with this LCD screen.

To be specific to what I need: I need the variable name for the user-defined coordinates from the screen to port to the new function for the servo.

By any chance could you remember what the variable name was? I've been looking but haven't found them. Imagine I will sometime but just looking for a shortcut by asking you. (while I can read C++ the arduino pin-type language I'm completely unfamiliar with. ... )

Thanks

Target Coordinates

The target coordinates are held in the targetFlat and targetFlon variables. These are set/modified by the setTargetCoords function.

Arduino GPS Acuiring Signal

Hi, I also don't get a position on the LCD, it is set to Dline but the gps tells me Acuiring Signal.
What could be the case?
I'm using your version 2

Regards Ko.

GPS Module LED

Most GPS modules have a LED which indicates whether or not the module has acquired the signal. The LED is solid red when the module is acquiring the signal and flashing red when it has found the signal.

Check to see what the LED on the GPS module is doing. If it is solid red, move the project outside where you can get better reception and try again. It can take a few minutes for the GPS module to acquire a fix so be patient. If the LED is blinking, then you know you have a software problem.

Arduino GPS

Hi, the LED on the gps is blinking nicely but still no position on the lcd, it keeps saying aquiring signal.
When i look with the serial monitor for the data generated by the gps i see strange characters.

I took 2 printscreens, you can see it @ http://86.87.115.186/printscreen.jpg and http://86.87.115.186/printscreen2.jpg

Regards, Ko.

57600 baud

You need to set the baud rate in the serial monitor to match the one defined in the sketch. Change your baud rate to 57600 and that should get rid of the gibberish.

Invert Data?

I realise this is an old post but it may help somebody. If I understand the original posters question the examples were straight from the GPS

It would appear to be inverted, as was my old GPS receiver. I had to change the serial settings to take account of this eg:

NewSoftSerial nss(2, 3,true);

Great Project BTW.

gpsSystem2 compilation error

Hello Sean,

I'm almost newbie in Arduino world. When I'm trying to compile your scetch I get some errors (tried with Arduino 0.23 and 1.00)- many *.h files are reported as missing. What libraries should be included into "Library" folder to make compilation process succesfull. Thank you in advance!

As stated above, you need

As stated above, you need Mikal Hart's TinyGPS library.

gpsSystem2 compilation error

Hello Sean,

thanks for response! Everything is clear now. I succesfully compiled sketch (with Arduino 0.23) and got coordinates read from my serial GPS device connected to my Arduino Mega (used hardware Serial ports instead of Software Serial library and DI). Another question: do you plan to adopt your sketch to be compatible with Arduino 1.0 in the future?

Regards, Sergejus.

I'll probably port the sketch

I'll probably port the sketch to Arduino 1.0 the next time I see need to work on it. I'm pretty happy with everything as is so I wouldn't hold your breath on this, but I would like to incorporate a digital compass at some point in the future.

Cant enter Waypoint Coordinates

Great device, everything works for me except entering way point coordinates. The lat and lon is default 0.0000 etc but when i position the cursor over it they wont change when i hit the up and down arrows.
I can do this in the "go to coordinate" window but not the edit waypoints window. Otherwise fantastic code. :D

I have noticed this happening

I have noticed this happening myself, you can usually fix it by formatting the EEPROM (in the options menu). I think this arises since in some cases the existing data in the EEPROM is incompatible with the sketch.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.