Blog Home

Library for Libelium’s GPS module

dcuartiellesApril 21st, 2009

I have been a little slow the last two months in reporting about my Xmass presents. Being on parental leave but being forced to arrange the moving of my lab to a new building seem to be two incompatible actions, but they are perfectly possible here in Sweden.

GPS on Mega

(c) 2009 BlushingBoy, GPS Shield on Arduino Mega

Leaving excuses on the side, I got a little jealous about Tom posting how he uses the Mega; therefore I decided to push a little harder for a library I am writing for the guys at Libelium. They sent me their GPS module and I decided to make a simple wrapper for users to plug their Tyco-GPS modules to Arduino Diecimila/Duemilanove/Mega from Arduino’s IDE 13/14/15. This is how much the whole thing has evolved since I started writing this piece of code in January… every time I thought I was done, we would release a new board or a new IDE and I had to debug the thing.

The library is running on a modified version of SoftwareSerial, and uses two functions by M. Hart, who wrote the brilliant tinyGPS library. My goal was to make something where unexperienced users would just have to write something like “GPS.init()” and “Serial.println(GPS.getLongitude())” and the thing would just work. Depending on how much you use the serial communication, this library weights between 4KB and 9KB … but it does everything for you ;-) On the other hand, on the Arduino Mega, 9KB is not even 10% of the available memory space. Download the library directly from this link.

GPS on Duemilanove

(c) 2009 BlushingBoy, GPS Shield on Arduino Duemilanove

I crafted three examples (basic, medium, advanced) featuring the use of different techniques to parse the GPS sentences. If you write something like a data logger, or a GPS toy, post your link here and I will be more than happy to include your code in the next revision of the library. Of course, if you found any errors or made any improvements, do the same thing.

This code compiles for Duemilanove and Mega, without any alterations. It works fine with the processors ATmega168 and up. Uses about 300 Bytes of memory space and is documented inside the code. Ah … there is a README.txt you shouldn’t miss; it explains how NOT to use the library.

[NOTE: If you are a linux user, please remember there is a bug in GCC-AVR that affects the way long ints are multiplied and this library makes an extensive use of that type of numbers. Please, read this note on Arduino’s playground and upgrade!!]

Categories:Reviews