Library for Libelium's GPS module
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.
(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.
(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!!]
April 23rd, 2009 at 20:04:25
Hi….
I received today my shield and tried it with Arduino Diecimila. Works great. I only have some doubts with the third example about what means each one of the arguments. Have to read the rest of the specs.
Now I am going to apply it to a robot and to use the gps info to produce some visuals.
Thanks for the great work.
HD
April 24th, 2009 at 05:20:08
[…] Library for Libelium’s GPS module […]
April 24th, 2009 at 18:45:29
Hej Helvis,
the third example is just parsing the GPS data into different arguments as specified in the datasheet to the GPS module. It is actually the standard way GPS data is stored in a string. This means:
– arguments[0] is always the GPS sencence type, e.g. GPGGA, GPRMC, GPVTG …
– arguments[1..12] are each one of the parts coming in the GPS sentence separated by commas. They depend on each one of the strings
If you are just interested in getting the speed, you could call the function GPS.getSpeed() and it will answer with an integer for the speed in Km/h. I think I actually forgot to mention that in the examples. For the location there is GPS.getLocation() and so on.
December 4th, 2009 at 22:09:18
Hi,
I have a Arduino Duemilanove connected to a Libelium GPS (http://www.libelium.com/tienda/catalog/product_info.php?cPath=21&products_id=37).
I am accessing the GPS through the LB_GPS library Version 01a
I am developing a small program (I am quite noob with Arduino) to read the data from the GPS and to show it in a LCD display.
While I am connected to the computer through the USB port everything the GPS seems to work fine, I receive NMEA strings as expected.
The problem comes when I want to power the system through batteries, not through the USB port.
I disconnect the USB cable, reset the Arduino and everything goes running until the program tries to read data from the GPS. Then it is blocked.
The following code shows what happens: working with a USB connection you can see at the display the strings “GETRAW IN” and “GETRAW OUT” swapping every 5 seconds approx.
When the Arduino is powered through batteries the display shows one time “GETRAW IN” and the program hangs.
Any idea on where is the problem?
Thanks in advance
=============
#include
#include
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup()
{
GPS.init();
delay(100);
lcd.begin(16,2);
}
void loop()
{
Visualiza(“GETRAW IN “);
GPS.getRaw(100); // reads the GPS string and stores it in inBuffer
Visualiza(“GETRAW OUT “);
}
void Visualiza(const char *s1)
{
lcd.setCursor(0,0);
lcd.print(buf1);
lcd.setCursor(0,1);
lcd.print(” “);
delay(5000);
}
=============
April 7th, 2010 at 16:45:18
Estoy intentando conectar una duemilanove con el gps. He cambiado los pines 8 y 9 por el 1 y 0 de la librerÃa. Sólo me aparace : setting up gps… done! pero no recibo nada más. Alguien me puede ayudar
April 7th, 2010 at 17:08:50
Ya funciona.
June 19th, 2010 at 18:38:07
Antonio,
A mà me ocurre lo mismo, ¿cómo lo arreglaste?
July 2nd, 2010 at 11:11:30
Es por que no conecta con los satélites. Mete el módulo y el arduino en una fiambrera y lo pones en la calle sin que le haga sombra ningún edificio
December 29th, 2010 at 14:14:04
Pero con qué codigo lo haceis funcionar?
March 1st, 2011 at 13:51:22
Ponte en contacto conmigo porque hay un bug en la función GPSStringExplode() y te paso el fix.
March 1st, 2011 at 22:02:23
Lo dicho en el comentario anterior: ponte en contacto conmigo. He encontrado bastantes más bugs, asà que te paso los fixes.
Borra también mis comentarios. Utilizo este blog para ponerme en contacto contigo porque no he encontrado otra manera.
March 2nd, 2011 at 11:51:08
[…] los datos del GPS se utilizará la liberÃa(descargar) que pone a disposición Libelium, creada por D. Cuartielles, que ya provee las funciones necesarias para la comunicación serie por el puerto 8 y 9. A pesar de […]
April 4th, 2011 at 17:56:28
Hola,
• A mi me ocurre un problema de memoria con la versión Libelium-LB_GPS-01a.zip: el inicio se repite sin fin.
Setting up GPS… done!
GPGGA,175012.000,4853.7617,N,00216.5638,E,1,3,4.91,102.6,M,47.3,M,,
LB_GPS 01a, (c) 2009 Cuartielles for Libelium.com
Setting up GPS… done!
GPGGA,175016.000,4853.7616,N,00216.5641,E,1,3,4.91,102.3,M,47.3,M,,
LB_GPS 01a, (c) 2009 Cuartielles for Libelium.com
• Otro problema, la conexión serie se come bytes. ¿Cómo podrÃa utilizar la librerÃa NewSoftSerial, que funciona de maravilla?
Saludos
April 5th, 2011 at 07:22:10
Hola,
esa libreria – LB_GPS – la cree para Libelium en el 2009, y no esta revisada para la version actual del core de Arduino. En otras palabras, la cree para (hablo de memoria) Arduino 0012 y ahora andamos por Arduino 0022. Si has adquirido un producto de Libelium, te recomiendo que te pongas en contacto con ellos, tienen un buen soporte tecnico y te ayudaran con el tema.
Por otra parte, decirte que este tipo de preguntas debieras preguntarlas en el foro de Arduino, el blog no es el mejor sitio para ellos 😉
Un saludo,
/d
August 7th, 2011 at 19:08:25
[…] los datos del GPS se utilizará la liberÃa de Libelium (descargar la mÃa modificada) creada por D. Cuartielles, que ya provee las funciones necesarias para la comunicación serie por el puerto 8 y 9. A pesar de […]