TinyGPS

A Compact Arduino GPS/NMEA Parser

TinyGPS is designed to provide most of the NMEA GPS functionality I imagine an Arduino user would want – position, date, time, altitude, speed and course – without the large size that seems to accompany similar bodies of code.  To keep resource consumption low, the library avoids any mandatory floating point dependency and ignores all but a few key GPS fields.

Usage

To use, simply create an instance of an object like this:

#include "TinyGPS.h"
TinyGPS gps;

Feed the object serial NMEA data one character at a time using the encode() method. (TinyGPS does not handle retrieving serial data from a GPS unit.) When encode() returns “true”, a valid sentence has just changed the TinyGPS object’s internal state. For example:

#define RXPIN 3
#define TXPIN 2
SoftwareSerial nss(RXPIN, TXPIN);
void loop()
{
  while (nss.available())
  {
    int c = nss.read();
    if (gps.encode(c))
    {
      // process new gps info here
    }
  }
}

You can then query the object to get various tidbits of data. To test whether the data returned is stale, examine the (optional) parameter “fix_age” which returns the number of milliseconds since the data was encoded.

long lat, lon;
unsigned long fix_age, time, date, speed, course;
unsigned long chars;
unsigned short sentences, failed_checksum;

// retrieves +/- lat/long in 100000ths of a degree
gps.get_position(&lat, &lon, &fix_age);

// time in hhmmsscc, date in ddmmyy
gps.get_datetime(&date, &time, &fix_age);

// returns speed in 100ths of a knot
speed = gps.speed();

// course in 100ths of a degree
course = gps.course();

Statistics

The stats method provides a clue whether you are getting good data or not. It provides statistics that help with troubleshooting.

// statistics
gps.stats(&chars, &sentences, &failed_checksum);
  • chars – the number of characters fed to the object
  • sentences – the number of valid $GPGGA and $GPRMC sentences processed
  • failed_checksum – the number of sentences that failed the checksum test

Integral values

Values returned by the core TinyGPS methods are integral. Angular latitude and longitude measurements, for example, are provided in units of millionths of a degree, so instead of 90°30’00″, get_position() returns a longitude value of 90,500,000, or 90.5 degrees. But…

Using Floating Point

…for applications which are not resource constrained, it may be more convenient to use floating-point numbers. For these, TinyGPS offers several inline functions that return more easily-managed data. Don’t use these unless you can afford to link the floating-point libraries. Doing so may add 2000 or more bytes to the size of your application.

float flat, flon;

// returns +/- latitude/longitude in degrees
gps.f_get_position(&flat, &flon, &fix_age);
float falt = gps.f_altitude(); // +/- altitude in meters
float fc = gps.f_course(); // course in degrees
float fk = gps.f_speed_knots(); // speed in knots
float fmph = gps.f_speed_mph(); // speed in miles/hr
float fmps = gps.f_speed_mps(); // speed in m/sec
float fkmph = gps.f_speed_kmph(); // speed in km/hr

Date/time cracking

For more convenient access to date/time use this:

int year;
byte month, day, hour, minutes, second, hundredths;
unsigned long fix_age;

gps.crack_datetime(&year, &month, &day,
  &hour, &minute, &second, &hundredths, &fix_age);

Establishing a fix

TinyGPS objects depend on an external source, i.e. its host program, to feed valid and up-to-date NMEA GPS data. This is the only way to make sure that TinyGPS’s notion of the “fix” is current. Three things must happen to get valid position and time/date:

  1. You must feed the object serial NMEA data.
  2. The NMEA sentences must pass the checksum test.
  3. The NMEA sentences must report valid data. If the $GPRMC sentence reports a validity of “V” (void) instead of “A” (active), or if the $GPGGA sentence reports fix type “0″ (no fix) then those sentences are discarded.

To test whether the TinyGPS object contains valid fix data, pass the address of an unsigned long variable for the “fix_age” parameter in the methods that support it. If the returned value is TinyGPS::GPS_INVALID_AGE, then you know the object has never received a valid fix. If not, then fix_age is the number of milliseconds since the last valid fix. If you are “feeding” the object regularly, fix_age should probably never get much over 1000. If fix_age starts getting large, that may be a sign that you once had a fix, but have lost it.

float flat, flon;
unsigned long fix_age; // returns +- latitude/longitude in degrees
gps.f_get_position(&flat, &flon, &fix_age);
if (fix_age == TinyGPS::GPS_INVALID_AGE)
  Serial.println("No fix detected");
else if (fix_age > 5000)
  Serial.println("Warning: possible stale data!");
else
  Serial.println("Data is current.");

Interfacing with Serial GPS

To get valid and timely GPS fixes, you must provide a reliable NMEA sentence feed. If your NMEA data is coming from a serial GPS unit, connect it to Arduino’s hardware serial port, or, if using a “soft” serial port, make sure that you are using a reliable SoftSerial library. As of this writing (Arduino 0013), the SoftwareSerial library provided with the IDE is inadequate. It’s best to use my NewSoftSerial library, which builds upon the fine work ladyada did with the AFSoftSerial library.

Library Version

You can retrieve the version of the TinyGPS library by calling the static member library_version().

int ver = TinyGPS::library_version();

Resource Consumption

Linking the TinyGPS library to your application adds approximately 2500 bytes to its size, unless you are invoking any of the f_* methods. These require the floating point libraries, which might add another 600+ bytes.

Download

The latest version of TinyGPS is available here: TinyGPS13.zip

Change Log

  1. initial version
  2. << streaming, supports $GPGGA for altitude, floating point inline functions
  3. also extract lat/long/time from $GPGGA for compatibility with devices with no $GPRMC
  4. bug fixes
  5. API re-org, attach separate fix_age’s to date/time and position.
  6. Prefer encode() over operator<<. Encode() returns boolean indicating whether TinyGPS object has changed state.
  7. Changed examples to use NewSoftSerial in lieu of AFSoftSerial; rearranged the distribution package.
  8. Greater precision in latitude and longitude.  Angles measured in 10-5 degrees instead of 10-4 as previously.  Some constants redefined.
  9. Minor bug fix release: the fix_age parameter of get_datetime() was not being set correctly.
  10. Added Maarten Lamers’ distance_to() as a static function.
  11. Arduino 1.0 compatibility
  12. Added satellites(), hdop(), course_to(), and cardinal()
  13. Improved precision in latitude and longitude rendering. get_position() now returns angles in millionths of a degree.

Acknowledgements

Many thanks to Arduino forum users mem and Brad Burleson for outstanding help in alpha testing this code. Thanks also to Maarten Lamers, who wrote the wiring library that originally gave me the idea of how to organize TinyGPS.  Thanks also to Dan P. for suggesting that I increase the lat/long precision in version 8.  Thanks to many people who suggested new useful features for TinyGPS, especially Matt Monson, who wrote some nice sample code to do so.

All input is appreciated.

Mikal Hart

Page last updated on August 31, 2013 at 7:00 pm
701 Responses → “TinyGPS”

  1. Mikal

    12 years ago

    A Siefert,
    Are you using [New]SoftSerial to communicate with the GPS? If so, check nss.overflow() to see if you are losing characters. I bet that’s the case. I bet you are not processing the data as fast as it’s arriving.


  2. Mikal

    12 years ago

    Amaynard,

    Love the Fio cat tracker idea. We want to build one of those too. Make sure you get the latest versions of Arduino and all the libraries and they should work together ok.


  3. ADRIANA

    12 years ago

    hola disculpa TinyGPS ES COMPATIBLE CON ARDUINO NG Atmega8 estoy haciendo un dataloger y esto utilizando el GPS FV-M8 y me gustaria saber si es compatible o hay una libreria para la version 0022 de arduino esque no me corre el ejemplo de la libreria llamado static_test me dice que es el sketch es demaciado grande gracias


  4. Mikal

    12 years ago

    Does anyone know if TinyGPS is small enough to work with Atmega8? I imagine it should work fin.


  5. D

    12 years ago

    Mikal,
    Sorry if my question was unclear. I’m trying to get date and time regardless of satellites in view. GPRMC sentences have good time data available via real time clock on the module. This is the sentence that the datetime crack seems to not like. “$GPRMC,184104.706,V,,,,,,,020512,,,N*40″
    As soon as I move within view of a satellite the datetime crack works as expected.
    Any thoughts?

    Thanks,
    D


  6. Germano Freitas

    11 years ago

    hello. It is not clear for me if HDOP is returning an absulte value or a value multiplied by a constant such as 10^1 or 10^2, in the same way angles are returned as integers. I have read HDOP values in the order of 80-100 which I found high. Could anyone help? Thanks, Germano


  7. D

    11 years ago

    FYI for anyone else who is looking to do the same thing as me..
    In TinyGPS.cpp included in the download change
    _gps_data_good(false) to _gps_data_good(true) everywhere its called.
    -d


  8. Eight

    11 years ago

    When I run…

    gps.get_datetime(&date, &time, &fix_age);

    … is the date and time returned the last data received from the GPS, or has it been adjusted to the current time? If it has not been adjusted, I assume I should be able to add the fix_age to the returned time to get the current time. It would just be sweeter if it IS adjusted.


  9. Mikal

    11 years ago

    @Germano,

    You are right. The HDOP value returned is multiplied by 100 before it is returned, just like the angles are. Sorry about the unclear documentation!


  10. Mikal

    11 years ago

    @Eight,

    The value returned by get_datetime is the very latest value that was seen in the NMEA stream. If you’re getting a healthy fix, this should always be accurate close to within 1 second, because every device I’ve seen updates the value at least once a second. If you want to be even closer to true time, you might add the “fix_age” value in, but even then you’d be a bit behind because there will be some lag between the time TinyGPS samples the data and the time you actually obtain it.


  11. Jan

    11 years ago

    Mikal,
    do you have a version available which only supports
    latitude and longitude
    distance_to()
    course_to()
    - so to say a “tinybasicGPS”
    Thanks Jan


  12. AndyDandy

    11 years ago

    Hello,

    can you pleae help me out how to find the right Rx and Tx pins for an antrax gps module communicating via SPI (4-wire) interface? http://www.antrax.de/site/Onlineshop/Home/Arduino-Komponenten:::370_386_378.html

    Thanks a lot!


  13. Mikal

    11 years ago

    Sorry, no, Jan. Are you having space problems with TinyGPS? That’s a little unusual.


  14. Jochen

    11 years ago

    Hello,

    with the GPS emulator, my code works nearly faultless inclusive Course, speed, course_to.

    But when I test the code with the “real” GPS Module if problems with Course, Speed, course to. In the other way with the emulator the number of sattelites are not correct.

    If I compare the two nmea strings i see that there are values missing on the “real GPS” string.

    MTK3339 Globaltop PA6C
    $GPRMC,194849.000,A,xxxx.xxxx,N,0xxxx.xxxx,E,0.31,247.57,070612,,,A*6A
    $GPGGA,194849.500,xxxx.xxxx,N,0xxxx.xxxx,E,1,7,1.19,361.3,M,47.6,M,,*52

    Emulator
    $GPRMC,195101.609,A,xxxx.xxxx,N,0xxxx.xxxx,E,0.0,0,060712,003.1,E*76
    $GPGGA,195101.609,xxxx.xxxx,N,0xxxx.xxxx,E,1,08,0,9,300,M,0,M,,*6C

    Anyone an idea??


  15. berm

    11 years ago

    Mikal,
    Thank you very much for good lessons and examples.I’ve just study in arduino for 2 weeks.I will try my best to finish my project.

    just want to say Thanks.


  16. Ari

    11 years ago

    Hi Mikal,
    I implemented your test_with_gps_device code. It compiles, and prints out the headers – long, lat,& etc. But the data is all *****
    The 3.3v pin from Arduino UNO board goes to 3.3v pin on the GPS.
    UNO ground to GPS ground.
    UNO 3 pin to GPS tx.
    It seems that the GPS receiver is not locking on to the GPS Satellites.

    What should I do?


  17. Ari

    11 years ago

    Hello Mikal,

    When I run your code, the column headers (longitude, latitude, and etc.) are printed out. However, the entries are all *****

    I used the connections based on
    http://www.doctormonk.com/2012/05/sparkfun-venus-gps-and-arduino.html

    which says to:

    Make the following connections

    The red lead goes from 3.3V Arduino to 3.3V GPS Module
    The blue lead, GND to GND
    The yellow lead Arduino Pin 10 to TX0 on the GPS Module

    However, since it says in your code that RX should be on Pin 3,
    I connected the wire from GPS pin TX0 to Arduino UNO Pin 3.

    What should I do? I am using the “newest” version of Arduino obtained via Ubuntu 12.04.


  18. dan z

    11 years ago

    Hi,

    Im having a problem trying to run this code. gps.encode(c) never validates or returns a true value even when it get 2D or 3D fix . I could use some help.

    Thank you!


  19. dan z

    11 years ago

    And i forgot to say, I’m using a haicom HI-204III gps receiver.


  20. andrew m

    11 years ago

    Do we have docs as to the parameters , variables that TinyGPS can give us ?
    or do I have to understand the code ?

    Sorry, but not a native C++ programmer, trying to be, but not having docs on place is a pain.


  21. Mikal

    11 years ago

    berm,

    :)


  22. Mikal

    11 years ago

    @Ari,

    The first thing you should do when debugging issues like this is print out the raw NMEA data from the device. Will the 3.3V device even work with the 5V Uno?


  23. Mikal

    11 years ago

    @Ari, does Dr. Monk’s sample code work?


  24. Mikal

    11 years ago

    @dan z,

    Make sure you print out the raw NMEA data being retrieved from the device.


  25. Mikal

    11 years ago

    @andrew m,

    Someday… someday.


  26. dan z

    11 years ago

    @Mikal

    I get something like this:
    2031938230179785810399154166230100133155785426147423021116620415438230211166230243230204230211381021315524913720115357147230147230211166230211166204154230204154381025614738230230179102230243166204154382301791022302041541021022051531662141102262302115711510223010210211523010238381021021471662041532308357243102243230230179…

    nothing like :

    $GPRMC,212352.000,A,4646.9834,N,02338.3160,E,0.00,297.18,080612,,,A*6B
    $GPGGA,212353.000,4646.9834,N,02338.3160,E,1,11,0.9,330.4,M,37.5,M,798.8,0000*7C

    how can i make sure this is good data?

    could it be the faulty gps receiver?

    any thoughts?


  27. dan z

    11 years ago

    And for some reason

    SoftwareSerial nss(RXPIN, TXPIN);
    void loop()
    {
    while (nss.available())
    {
    int c = nss.read();

    wont work for me.
    i Have to use Serial.read() instead and use the default Rx Tx pins (0 & 1) to get some data that looks like one written above (I’m not sure but i think i get different sets of numbers for different baud rates).

    PS: I’m using an Arduino Duemilanove ATmega328P


  28. thisoldgee

    11 years ago

    Mikal-

    I’m puzzled on my output. On arduino 1.0.1, an Uno and an EM-406A GPS under Ubuntu 10.04, I get the following output in the serial monitor, good at first then garbage characters:

    Simple TinyGPS library v. 12
    by Mikal Hart

    CHARS=264 SENTENCES=0 CSUM ERR=0
    CHARS=303 SENTENCES=0 CSUM ERR=0
    CHARS=342 SENTENCES=0 CSUM ERR=0
    LAT=37.961231 LON=-122.088027 SAT=0 PREC=0 CHARS=1530 SENTENCES=17 CSUM ERR=0
    LAT=37.961231 LON=-122.088027 SAT=0 PREC=0 CHARS=1600 SENTENCES=18 CSUM ERR=0
    LAT=37.961231 LON=-122.088027 SAT=0 PREC=0 CHARS=1670 SENTENCES=19 CSUM ERR=0
    LAT=37.961231 LON=-122.088027 SAT=0 PREC=0 CHARS=1740 SENTENCES=20 CSUM ERR=0
    ÿÿÿýþüþýÿøþûÿÿýøü7

    (Note: some good response lines were deleted to save space here).

    Any ideas as to what might be happening?

    Thanks…


  29. Syzygy

    11 years ago

    @dan z
    A common mistake (and one I make myself from time to time). You’re printing out the integer value of the characters instead of the characters themselves. It’s easy to do because the read() function returns an int, not a char.

    So instead of this:
    while (gps.available()) Serial.print(gps.read());

    Do this instead:
    while (gps.available()) Serial.print((char)gps.read());

    That said, was your example string intentionally gibberish? Because I can’t seem to decode it to anything interesting. You should at the least be seeing strings of 367180, which decodes to $GP.


  30. Mikal

    11 years ago

    @thisoldgee,

    Hmmm, no I can’t begin to guess. The umlauted y (ÿ) is ASCII code 0xFF, but that doesn’t explain why it’s being printed.


  31. Gustav

    11 years ago

    Dear Mikal,

    I get these compiling errors,when compiling GPS Toy
    what is wrong?
    I use Arduino IDE 1.0.1

    TinyGPS\TinyGPS.cpp.o: In function `TinyGPS’:
    C:\Users\Gustav\Documents\Arduino\libraries\TinyGPS/TinyGPS.cpp:28: multiple definition of `TinyGPS::TinyGPS()’
    TinyGPS.cpp.o:C:\Users\Gustav\AppData\Local\Temp\build5547417453074466164.tmp/TinyGPS.cpp:28: first defined here
    TinyGPS\TinyGPS.cpp.o: In function `TinyGPS’:
    C:\Users\Gustav\Documents\Arduino\libraries\TinyGPS/TinyGPS.cpp:28: multiple definition of `TinyGPS::TinyGPS()’
    TinyGPS.cpp.o:C:\Users\Gustav\AppData\Local\Temp\build5547417453074466164.tmp/TinyGPS.cpp:28: first defined here

    Best regards,

    Gustav


  32. Dan

    11 years ago

    Mikal,
    Is there a way to change km to feet?


  33. Jan-Albert van Ree

    11 years ago

    Have you considered adding decoding for other sentences? My Rockwell Jupiter module doesn’t output $GPRMC but $GPVTG, which basically contains the same info…

    Or would you accept patches to the code to add decoding the GPVTG string?


  34. Kyron

    11 years ago

    I’m using the library to try and receive signal from my parallax RXM-SG GPS Module, but I receive no signal. When using the USB method of getting GPS data I receive data after at most 2-3 mins and I can tell when the 2nd LED is blinking red having satellites in range. When cod to the Arduino Mega AT Mega 1280 I ONLY see the green LED flashing indicating that it is on.


  35. dr john smith

    11 years ago

    the data ,umlart question,

    can you check your serial data with a scope ?
    I think it might be up side down,

    I have been experimenting with a few different manufacturers NMEA equipment over the past month,

    And they can not seem to decide on the polarity.
    so if data is once per second, the level in between the data in some systems is high, and in others is low,

    seems the NMEA spec was ambiguous in the use of differential signals, which most companies only receive one side off,

    that’s excusable, but the company that sends its NMEA data back to front should be shot………

    now if only the hardware uarts on the pic could be turned to accept active high or low serial data…

    luckily, the soft serial implementation does allow this,

  36. Hello, It can return the raw nmea?
    Just sentences GPRMC and GPGGA…


  37. Tom

    11 years ago

    Hi Mikal,

    Thank you for writing this library.

    I am having a bit of a problem that I hope you can help with. I am using an arduino uno and a venus gps module. I seem to get valid NMEA sentences and I get good readouts for Lat, Long, altitude, time, and (sometimes) date (they change as I walk around with the gps and the lat/long resolves to my current location). I cannot get readouts for course or speed no matter what I do. If I send the value to the serial monitor it shows 1000.0 for course and -1 for speed.

    Could you offer some advice as to what might be the problem? Thanks.


  38. Mikal

    11 years ago

    @Gustav, it looks like the library is being linked twice. Do you have multiple files or multiple #include’s or something?


  39. Mikal

    11 years ago

    @Dan,

    Yep.

    float feet = 3280.84 * km;


  40. Mikal

    11 years ago

    @Jan-Albert,

    Yes, I’m working on a new TinyGPS design that would support arbitrary sentences. (When I get time!)


  41. Mikal

    11 years ago

    @Luiz,

    Since the library accepts raw NMEA as input, just print that out (or do whatever you want with it) before you send it to gps.encode().


  42. Mikal

    11 years ago

    @Tom,

    I’m guessing that your Venus GPS doesn’t support certain values. Can you capture 10 seconds worth of NMEA data and post it?


  43. Keve

    11 years ago

    Hi!

    I just want to let you know about a possible precision issue.
    I read it here: https://sites.google.com/site/wayneholder/self-driving-rc-car/getting-the-most-from-gps
    The last part “Precison loss in Tinygps”
    What do you think?


  44. Tom

    11 years ago

    Hi Mikal,

    The gps module does provide the values. If I test it with your test_with_gps_device example I get the correct information so it is working. I have done some experiments and think I know where the problem is coming from but not why. I am using a Nokia 6100 color lcd from sparkfun and the gLCD library created by Tom Carpenter. If I don’t use gLCD and just display the data via serial (to the computer) it seems to work, but if I include the gLCD library I get the invalid data.

    Do you know of or suspect some kind of conflict between the two libraries? Or could it be a timing issue of some kind (i.e. writing to the lcd takes to much time)?

    I can get the gps and gLCD to work together if I parse the data by hand (write my own parsing code) and that may be the way I have to go. But your library provides some data that I would rather not have to code myself.

    So, if you are familiar with the gLCD library by Tom Carpenter (https://github.com/TCWORLD/gLCD-Library) could there be a conflict between it and TinyGPS? Or would the problem lie elsewhere?

    I realize without the code it is hard to tell and I can post it if necessary.

    Thanks


  45. Tom

    11 years ago

    Here is 10 seconds of output from your example sketch:

    Testing TinyGPS library v. 12
    by Mikal Hart

    Sizeof(gpsobject) = 115

    Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum
    (deg) (deg) Age Age (m) — from GPS —- —- to London —- RX RX Fail
    ————————————————————————————————————————————–
    8 120 46.74856 -116.99318173 07/25/2012 14:52:43 209 808.50 342.10 0.00 NNW 7544 36.84 NE 595 2 1
    8 120 46.74856 -116.99318270 07/25/2012 14:52:44 306 808.50 342.10 0.00 NNW 7544 36.84 NE 1132 4 1
    8 120 46.74856 -116.99318373 07/25/2012 14:52:45 415 808.50 342.10 0.00 NNW 7544 36.84 NE 1682 7 1
    8 120 46.74856 -116.99318104 07/25/2012 14:52:46 123 808.50 342.10 0.00 NNW 7544 36.84 NE 2133 9 1
    8 120 46.74856 -116.99318174 07/25/2012 14:52:47 191 808.50 342.10 0.00 NNW 7544 36.84 NE 2584 11 1
    8 120 46.74856 -116.99318245 07/25/2012 14:52:48 264 808.50 342.10 0.00 NNW 7544 36.84 NE 3035 13 1
    8 120 46.74856 -116.99318318 07/25/2012 14:52:49 335 808.50 342.10 0.00 NNW 7544 36.84 NE 3486 15 1
    8 120 46.74856 -116.99318394 07/25/2012 14:52:50 412 808.50 342.10 0.00 NNW 7544 36.84 NE 3935 17 1
    8 120 46.74856 -116.99318457 07/25/2012 14:52:51 474 808.50 342.10 0.00 NNW 7544 36.84 NE 4386 19 1
    8 120 46.74856 -116.99318536 07/25/2012 14:52:52 554 808.50 342.10 0.00 NNW 7544 36.84 NE 4851 21 1
    8 120 46.74856 -116.99318623 07/25/2012 14:52:53 664 808.50 342.10 0.00 NNW 7544 36.84 NE 5411 24 1


  46. Dorothee

    11 years ago

    Hi Mikal,

    Although the test program seems to work for anyone else, I am running into problems, and I would greatly appreciate your help or advice!

    I am using Arduino Rev 3 board with the sparkfun gps shield and the EM406A gps module.
    I downloaded the libraries, TinyGPS, and I started with the “simple test” example, and I also tried “test with gps device”
    When mounted together and plugged into the computer (mac), aA red LED light is shining on the shield as well as on the module)

    The first test:
    (just to make sure, you know which code I am using)

    What I receive is:

    by Mikal Hart

    CHARS=0 SENTENCES=0 CSUM ERR=0
    CHARS=0 SENTENCES=0 CSUM ERR=0
    CHARS=0 SENTENCES=0 CSUM ERR=0
    which is ongoing.

    Trying the other example: "test with gps device"
    I obtain:

    by Mikal Hart

    Sizeof(gpsobject) = 115

    Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum
    (deg) (deg) Age Age (m) — from GPS —- —- to London —- RX RX Fail
    ————————————————————————————————————————————–
    **** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 0 0 0
    **** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 0 0 0
    **** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 0 0 0
    **** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 0 0 0
    **** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 0 0 0
    **** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 0 0 0
    **** **** ******* ******* **** ******* ******* **** ******* ****** ***** *** 0 0.00 *** 0 0 0


  47. Tom

    11 years ago

    Hi Mikal,

    As a followup here is some raw data from the Venus GPS unit:

    $GPGGA,044912.327,4644.8437,N,11659.5572,W,1,10,0.8,506.1,M,-14.1,M,,0000*65
    $GPGSA,A,3,30,05,21,29,26,15,25,18,16,06,,,1.6,0.8,1.4*39
    $GPGSV,3,1,10,21,64,287,33,29,58,145,42,18,37,212,26,30,30,281,26*71
    $GPGSV,3,2,10,26,30,086,21,15,29,129,27,05,25,051,27,16,23,313,39*7D
    $GPGSV,3,3,10,25,08,194,23,06,08,312,26*70
    $GPRMC,044912.327,A,4644.8437,N,11659.5572,W,000.0,183.4,270712,,,A*7A
    $GPVTG,183.4,T,,M,000.0,N,000.0,K,A*03
    $GPGGA,044913.327,4644.8437,N,11659.5572,W,1,10,0.8,506.1,M,-14.1,M,,0000*64
    $GPGSA,A,3,30,05,21,29,26,15,25,18,16,06,,,1.6,0.8,1.4*39
    $GPGSV,3,1,10,21,64,287,34,29,58,145,43,18,37,212,25,30,30,281,27*75
    $GPGSV,3,2,10,26,30,086,20,15,29,129,25,05,25,051,26,16,23,313,39*7F
    $GPGSV,3,3,10,25,08,194,23,06,08,312,29*7F
    $GPRMC,044913.327,A,4644.8437,N,11659.5572,W,000.0,183.4,270712,,,A*7B
    $GPVTG,183.4,T,,M,000.0,N,000.0,K,A*03
    $GPGGA,044914.327,4644.8437,N,11659.5572,W,1,10,0.8,506.1,M,-14.1,M,,0000*63
    $GPGSA,A,3,30,05,21,29,26,15,25,18,16,06,,,1.6,0.8,1.4*39
    $GPGSV,3,1,10,21,64,287,32,29,58,145,42,18,37,213,25,30,30,281,27*73
    $GPGSV,3,2,10,26,30,086,20,15,29,129,25,05,25,051,25,16,23,313,38*7D
    $GPGSV,3,3,10,25,08,194,23,06,08,312,28*7E
    $GPRMC,044914.327,A,4644.8437,N,11659.5572,W,000.0,183.4,270712,,,A*7C
    $GPVTG,183.4,T,,M,000.0,N,000.0,K,A*03
    $GPGGA,044915.327,4644.8437,N,11659.5572,W,1,10,0.8,506.1,M,-14.1,M,,0000*62
    $GPGSA,A,3,30,05,21,29,26,15,25,18,16,06,,,1.6,0.8,1.4*39
    $GPGSV,3,1,10,21,64,287,32,29,58,145,43,18,37,213,26,30,30,281,28*7E
    $GPGSV,3,2,10,26,30,086,20,15,29,129,25,05,25,051,26,16,23,313,38*7E
    $GPGSV,3,3,10,25,08,194,23,06,08,312,29*7F
    $GPRMC,044915.327,A,4644.8437,N,11659.5572,W,000.0,183.4,270712,,,A*7D
    $GPVTG,183.4,T,,M,000.0,N,000.0,K,A*03
    $GPGGA,044916.327,4644.8437,N,11659.5572,W,1,10,0.8,506.1,M,-14.1,M,,0000*61
    $GPGSA,A,3,30,05,21,29,26,15,25,18,16,06,,,1.6,0.8,1.4*39
    $GPGSV,3,1,10,21,64,287,32,29,58,145,43,18,37,213,26,30,30,281,28*7E
    $GPGSV,3,2,10,26,30,086,20,15,29,129,25,05,25,051,26,16,23,313,38*7E
    $GPGSV,3,3,10,25,08,194,23,06,08,312,29*7F
    $GPRMC,044916.327,A,4644.8437,N,11659.5572,W,000.0,183.4,270712,,,A*7E
    $GPVTG,183.4,T,,M,000.0,N,000.0,K,A*03


  48. Dorothee

    11 years ago

    Hi Mikal,

    in Addition to what I posted yesterday I should say that I placed the module outside, and it is blinking.
    But still, I obtain the same result of zero and stars.


  49. Mikal

    11 years ago

    @Keve,

    Yes, Wayne informed me about that. It won’t matter for most applications, but I intend to fix it in the next iteration of TinyGPS. Thanks!


  50. Mikal

    11 years ago

    Tom, the best way to debug this is to examine the internal statistics counters of TinyGPS and [New]SoftSerial. In particular, does software serial report any “overflow” error? That would indicate that you are not processing the incoming data stream fast enough. Alternately, if TinyGPS reports checksum error, then you may be experiencing some corruption caused by interference with the other device.

82 Trackbacks For This Post
  1. เริ่มต้นสร้าง GPS จอสีกับอาดูอี้โน่ | Ayarafun Factory

    [...] http://www.sundial.org/arduino/?page_id=3 [...]

  2. 10

    [...] won’t. I answer a few questions on the Arduino microcontroller forum and post an update to a library I [...]

  3. The Hired Gun » GPS project: show me something

    [...] this journey I also looked into using the TinyGPS library. While it does a nice job of handling the core GPS parsing, I still had the primary desire to log [...]

  4. GPS mit Arduino - Webmeister Blog

    [...] serielle Verbindung werden die  Daten ans Display geschickt. Verwendet werden die Bibliotheken TinyGPS und [...]

  5. The Frustromantic Box, Part 4: Software « New Bright Idea

    [...] Arduino developers for the great librarires, and to Mikal Hart in particular for his work on the TinyGPS and NewSoftSerial [...]

  6. Transmission success - Projects

    [...] and sending the bits of “Hello World” in 7N1 format.  I spent some time with the TinyGPS and NewSoftSerial libraries from Mikal Hart, and got the parsing working nicely and building an [...]

  7. GPS testing with LCD Character Display

    [...] can have the LCD output latitude, longitude, or whatever. You’ll need the TinyGPS library from Arduiniana downloaded and installed for it to work. They suggest using NewSoftSerial, but I couldn’t get [...]

  8. Arduino GPS — not exactly pocket-sized, but cool! « Arduino Projects FTW

    [...] EEPROM so they are persistent between power cycles. The sketch uses Mikal Hart's excellent TinyGPS library and includes code from the ArduPilot Projectfor [...]

  9. A fully functional Arduino GPS receiver | Embedded projects from around the web

    [...] uses a TinyGPS library for easier GPS shield access. So device can be used as normal GPS tracking device the only [...]

  10. Moving Forward with Arduino – Chapter 17 – GPS « t r o n i x s t u f f

    [...] point you will need to install two libraries into the Arduino software – NewSoftSerial and TinyGPS. Extract the folders into the libraries folder within your arduino-001x [...]

  11. Shield Driven Arduino GPS

    [...] sketch uses Mikal Hart’s excellent TinyGPS library and includes code from the ArduPilot Project for [...]

  12. GPS bővítés « Nikon D5000 DSLR

    [...] 2 [...]

  13. The Maritime Geocaching Association » Build Your Own Steampunk GPS

    [...] attached code should pretty much speak for itself. Using the TinyGPS library, your current position is taken and the direction to the final location is calculated. [...]

  14. Moving Forward with Arduino – Chapter 19 – GPS part II « t r o n i x s t u f f

    [...] pull-down resistor). You will need to install the SdFAT library, NewSoftSerial library, TinyGPS library and the SdFat library if not already [...]

  15. Arduinoによる放射線データ収集(3) « stastaka's Blog

    [...] http://arduiniana.org/libraries/tinygps/ USBシリアルを使っているとTX,RXが使えませんが、 [...]

  16. reptile-addict.nl | My Arduino Blog

    [...] Mikal Hart’s tinyGPS library; [...]

  17. Communicating to GPS Receiver using USB Host Shield « Circuits@Home

    [...] how to send raw GPS output to a NMEA 0183 message parser. For the following code example I used Mikal Hart’s TinyGps library. Since the library itself is not handling serial input, it was only necessary to make changes in [...]

  18. GpsBee and Seeeduino Stalker v2 « Wireless Building Automation

    [...] easy developing of the necessary Arduino application I used an existent dedicated library: TinyGPS (http://arduiniana.org/libraries/tinygps/), which help us to parse all the packets received on the serial port from the GpsBee module. Ok, so [...]

  19. SheekGeek » Blog Archive » Weather Balloon Payload Testing on a Model Rocket (Pt.1)

    [...] and gyroscope package and slapped together a simple SD card interface. The libraries I used were TinyGPS and fat16lib (for SD card use). Weather_Balloon_Code and schematic in case you’d like to [...]

  20. Moving Forward with Arduino – Chapter 19 – GPS part II « t r o n i x s t u f f

    [...] forget the 10k ohm pull-down resistor). You will need to install NewSoftSerial library, TinyGPS library and the SdFat library if not already [...]

  21. Anonymous

    [...] [...]

  22. Jacket Positioning System: JPS « Titles are Strange Things

    [...] it’s pretty simple. It only does those functions, but with the help of the truly fantastic TinyGPS library, I have a destination function in the [...]

  23. Testing MTK3329 10Hz GPS module and making an Arduino GPS logger | Develop with Arduino

    [...] TinyGPS for Arduino [...]

  24. Arduino + GPS Shield + LCD 16x2 | We Are The Electric Brothers

    [...] tinygps [...]

  25. TinyGPS Libraryを使ってGPSデータを取得

    [...] ちなみに、データ処理部分は、TinyGPS Libraryなる便利なものがあったので、それを使ってみた。 [...]

  26. GPS приемник на базе модуля Quectel L30 | Arduino Market

    [...] Библиотека для работы с GPS/NMEA для Arduino (TinyGPS) [...]

  27. Using SKYLAB SKM53 GPS with Arduino

    [...] Download TinyGPS her [...]

  28. Arduino GPS module test sketch - Develop with Arduino

    [...] Working with Arduino and TinyGPS [...]

  29. Distance measuring with Arduino - Develop with Arduino

    [...] Working with Arduino and TinyGPS [...]

  30. Tutorial 15 for Arduino: GPS Tracking | JeremyBlum.com

    [...] used the tinyGPS library to decode the NMEA GPS Data. Cooking-Hacks generously supplied both the GPS shield and SD Card [...]

  31. Early Sailing Sensor designs | Andrew Hodel

    [...] the TinyGPS library: http://arduiniana.org/libraries/tinygps/ Share this: Written by andrewhodel Posted in Engineering, [...]

  32. When thinking o… | pa2dy

    [...] “TinyGPS is designed to provide most of the NMEA GPS functionality I imagine an Arduino user would want ñ position, date, time, altitude, speed and course ñ without the large size that seems to accompany similar bodies of code.  To keep resource consumption low, the library avoids any floating point dependency and ignores all but a few key GPS fields.” – TinyGPS website [...]

  33. GPS Box | pa2dy

    [...] “TinyGPS is designed to provide most of the NMEA GPS functionality I imagine an Arduino user would want ñ position, date, time, altitude, speed and course ñ without the large size that seems to accompany similar bodies of code.  To keep resource consumption low, the library avoids any floating point dependency and ignores all but a few key GPS fields.” – TinyGPS website [...]

  34. GPS Box « Sketching with Hardware

    [...] “TinyGPS is designed to provide most of the NMEA GPS functionality I imagine an Arduino user would want ñ position, date, time, altitude, speed and course ñ without the large size that seems to accompany similar bodies of code.  To keep resource consumption low, the library avoids any floating point dependency and ignores all but a few key GPS fields.” – TinyGPS website [...]

  35. Telemetría y data logger with Arduino Part IIÁlvaro López | Álvaro López

    [...] a Base y testear el alcance de las antenas, el proceso lo he ejecutado en el Base. He utilizado la librería TinyGPS que aparentemente funciona bastante bien, y los programas usados han sido los [...]

  36. Updated – WISMO228 Library for Arduino | Rocket Scream

    [...] (while adding more functionality) as we also need use the SD library for logging and also the TinyGPS library for GPS NMEA output [...]

  37. GPS Speed Display | Open Source Software Development

    [...] project makes use of the TinyGPS library. It provides a useful parsing library with easy access to the data returned by the Serial [...]

  38. Arduino + HMC6343 + u-blox MAX-6 | cjdavies.org

    [...] not hard to parse it yourself, but why go to the effort when there are libraries like TinyGPS that can do it for [...]

  39. EECS Sr Design » Blog Archive » 7. Team Bravo Squad – Prototype I Final Report: Emergency GPS Locator

    [...] the next while tweaking things. During that time, we rewrote the code (attached below) to use the TinyGPS library and wired the switch up. For the switch, it was simply a matter of connecting the common pin on the [...]

  40. Interfaceando com modulo GPS EM-411 | Alan Carvalho de Assis

    [...] Estava procurando uma biblioteca para interfacear com o modulo EM-411 mas não queria algo muito complexo, apenas algo que retornasse a distancia entre duas lat/long e o angulo entre elas. Então encontrei o projeto TinyGPS. [...]

  41. Montando o GPS | Heliostat Brasil

    [...] to interpret the information the GPS sends out ourselves as there’s a really helpful libraryTinyGPS that will do the hard work for [...]

  42. Fastrax UP501 GPS Module - Babelduck Cybernetics

    [...] Works with Arduino TinyGPS Library http://arduiniana.org/libraries/tinygps/ [...]

  43. Sketching with Hardware 2012 6/6 – GPS Box | Blog

    [...] “TinyGPS is designed to provide most of the NMEA GPS functionality I imagine an Arduino user would want ñ position, date, time, altitude, speed and course ñ without the large size that seems to accompany similar bodies of code.  To keep resource consumption low, the library avoids any floating point dependency and ignores all but a few key GPS fields.” – TinyGPS website [...]

  44. Slow progress, but progress non-the-less! | Decibear

    [...] tutorial video from Jeremy Blum to help us work out the GPS module, in which he referred us to the TinyGPS arduino library which we found lovely to use. With the help of Jeremy, and the example sketches with the library, [...]

  45. Pre-Race Telemetry Snippets | TechWeasel

    [...] TinyGPS Arduino library makes it very simple to make your GPS do something useful, much thanks… Hope [...]

  46. GPS modules for sale! | Rock 7 - RockBLOCK

    [...] is standard 9600 baud serial NMEA sentences.  There’s an excellent GPS NMEA decoder library for Arduino here which works with this [...]

  47. Data geo-tagging primer | biodesign for the real world

    [...] TinyGPS is a library for Arduino that allows to use a GPS module relatively painlessly. [...]

  48. Arduino GPS Tracking System -Arduino for Projects

    [...] used the tinyGPS library to decode the NMEA GPS Data. Cooking-Hacks generously supplied both the GPS shield and SD Card [...]

  49. Arduino GPS Datalogger -Arduino for Projects

    [...] using two really awesome libraries written by Mikal Hart, so make sure you have downloaded them! (TinyGPS and NewSoftSerial ) TinyGPS basically makes it easier for us to extract data like longitude and [...]

  50. nmea gpgga | GPS検索

    [...] TinyGPS | Arduiniana sentences – the number of valid $GPGGA and $GPRMC sentences processed; failed_checksum …. I am trying to input some proper NMEA commands but the response goes just like that. CHARS=0 …. 46 Trackbacks For This Post. เริ่มต้น สร้าง … [...]

  51. gpgga format | GPS検索

    [...] TinyGPS | Arduiniana sentences – the number of valid $GPGGA and $GPRMC sentences ….. 46 Trackbacks For This Post … and sending the bits of “Hello World” in 7N1 format. I spent … [...]

  52. My Proposal Box, Part 3: Software

    [...] click here to download it. You will also need to download the PWMServo library (version 2) and the TinyGPS library written by Mikal Hart. While you are at his site, thank him for his amazing work. If you [...]

  53. Xronos Clock Home – Time via GPS

    [...] for what I needed, and used interrupts, and other complex stuff Fortunately Time library used TinyGPS library, which is indeed very lightweight and straightforward. It also “requires” [...]

  54. Arduino en GPS | Pieters fijne blog

    [...] TinyGPS library [...]

  55. Greater Accuracy with TinyGPS 13 | Arduiniana

    [...] TinyGPS [...]

  56. GPS Bee Kit (Part 2) | Zx Lee

    [...] the next part, I am going to use one of the library available for Arduino, which is TinyGPS. You can download TinyGPS library here. This library ease your job to get all the information from [...]

  57. The Frustromantic Box, Part 4: Software | New Bright Idea

    [...] the Arduino developers for the great libraries, and to Mikal Hart in particular for his work on the TinyGPS and NewSoftSerial [...]

  58. Playing around with GPS: ATtiny GPS LongLat Logger « insideGadgets

    [...] recently purchased one of those U-blox GPS modules from Ebay for $20 and after downloading the TinyGPS library for the Arduino, it works well once it has valid GPS data (I had to have mine close to the window) [...]

  59. Módulo GPS Skylab SKM53 | AUTOMALABS

    [...] a biblioteca TinyGPS (documentação e download da v13). Requer [...]

  60. My 15$ GPS module | Bajdi.com

    [...] to the module and hooked it up to an ATmega328 running at 3.3V / 8MHz. I installed the Arduino tinygps library and uploaded one of the example sketches to the ATmega. I put my laptop, micro controller and GPS [...]

  61. 86duino

    [...] This requires the TinyGPS and NewSoftSerial libraries from Mikal Hart: http://arduiniana.org/libraries/TinyGPS and http://arduiniana.org/libraries/newsoftserial/ [...]

  62. GPS Ublox Neo-6M cu Arduino Uno | ArduHobby

    [...] biblioteca tinyGPS sau [...]

  63. Arduino Development Journal/May 2014 | Surfing Satellites

    [...] one extra sentence that is discarded by TinyGPS (a very cool library – check it out at http://arduiniana.org/libraries/tinygps/).  I corrected that and believe the GPS delivers the optimum number of sentences at 19200 baud to [...]

  64. Tutorial – Arduino and MediaTek 3329 GPS » Geko Geek

    [...] fly, so thankfully there is an Arduino library to do this for us - TinyGPS. So head over to the library website, download and install the library before [...]

  65. Tutorial – Arduino and MediaTek 3329 GPS

    [...] fly, so thankfully there is an Arduino library to do this for us - TinyGPS. So head over to the library website, download and install the library before [...]

  66. GPS und Arduino | wer bastelt mit?

    [...] Eine recht praktische und kompakte Library zum Parsen von GPS/NMEA Daten: TinyGPS [...]

  67. Interfacing a USB GPS with an Arduino | Bayesian Adventures

    [...] Library to connect to the shield and I modified the code a little to stream incoming data into Mikal Hart’s GPS Parser Library, TinyGPS. Here is the crux of the [...]

  68. Freematics Blog – Users Guide for Arduino Telematics Kits

    [...] TinyGPS Library [...]

  69. Freematics Blog – Freematics OBD-II Adapter Programming Guide

    [...] TinyGPS Library [...]

  70. Spark Core and TinyGPS Library | devlper

    [...] comes a sample application using Spark Core and TinyGPS library. TinyGPS is a very powerful and fast NMEA GPS parser for Arduino and compatible. In this [...]

  71. Arduino UNO with GPS module(GY-GPS/NEO6MV2) - TFP

    [...] the Arduino IDE, I shall directly skip on the coding part then. Our arduino sketch will require Tiny GPS library, which you can download it from here. Import the downloaded library to your Arduino IDE. [...]

  72. GPS logging on SD card using TinyGPS | CL-UAT

    [...] tutorials are either too complex (i.e. include extra stuff like displays) or they don’t use TinyGPS or TinyGPS++ library. In the first step I’ve managed to get GPS working and displaying the [...]

  73. A cheap, functioning GPS | Denial Media

    [...] first thing I had to do software wise was install the TinyGps library. This was hard to do as the creator’s website was iffy at the time. I ended up downloading it from github and renaming it to get rid of the dash [...]

  74. GPS Tracker на ардуино своими руками | FNIT.RU

    [...] TinyGPS (ссылка на скачивание в середине страницы) [...]

  75. Arduino Time Library learning notes | tlfong01

    [...] requires the TinyGPS and NewSoftSerial libraries from Mikal Hart: http://arduiniana.org/libraries/TinyGPS and http://arduiniana.org/libraries/newsoftserial/ Example [...]

  76. Arduino (IoT): Simple Tutorial GPS Top Titan 3 Glonass: Parte 1 – Santiapps – Arduino (IoT), iOS, Android & Glass

    [...] ser parsed a datos de ubicación, velocidad etc.  Esto lo logramos usando la TinyGPS library (http://arduiniana.org/libraries/tinygps/) que veremos en la Parte [...]

  77. The SX1276 Modules Shootout – HopeRF’s RFM95W vs NiceRF’s LORA1276-C1 vs HPDTEK’s HPD13 – Rocket Scream

    [...] the base station. If a valid acknowledgement packet is received, the current GPS information (using TinyGPS library)  is retrieved from L80 GPS module and stored. Some of you might have argue why not use the full [...]

  78. Shield o Módulo GPS con Arduino Introducción - Geek Factory

    [...] http://arduiniana.org/libraries/tinygps/ [...]

  79. Módulo GPS Skylab SKM53 | Diário de Nilton Felipe

    [...] a biblioteca TinyGPS (documentação e download da v13). Requer [...]

  80. Tutorial Arduino: monta un GPS con reloj con Arduino - Arduino, Genuino, Raspberry Pi. Noticias y proyectos.

    [...] LCDUn módulo GPS en este caso el EM-411Breadboard, jumperwires y un potenciometro.Biblioteca TinyGPS.Enlace al tutorial completo.Califique esto Sample rating [...]

  81. Living by Numbers | nr's blog

    [...] photo you can see the GPS shield, which has now turned up. A quick bit of poking with the lovely TinyGPS library has shown that it’s giving me location data, and as a bonus, there’s a function [...]

  82. Tutorial : Reading GPS data via Arduino – DISTRIBUTOR ALAT PENGUSIR TIKUS

    [...] Library Used : http://arduiniana.org/libraries/tinygps/ [...]

Leave a Reply