TinyGPS++

A *NEW* Full-featured GPS/NMEA Parser for Arduino

TinyGPS++ is a new Arduino library for parsing NMEA data streams provided by GPS modules.

Like its predecessor, TinyGPS, this library provides compact and easy-to-use methods for extracting position, date, time, altitude, speed, and course from consumer GPS devices. 

However, TinyGPS++’s programmer interface is considerably simpler to use than TinyGPS, and the new library can extract arbitrary data from any of the myriad NMEA sentences out there, even proprietary ones.

Download and Installation

To install this library, download here, unzip the archive into the Arduino “libraries” folder, and restart Arduino. You should rename the folder “TinyGPSPlus”.
Download

History

TinyGPS++ is the immediate inheritor of TinyGPS, a popular compact parser that is used in Arduino installations around the world.  TinyGPS++ is not quite as ‘tiny’ as its older sibling, but its powerful and extremely easy-to-use new object model and useful new feature set make it an attractive alternative.

Usage

Let’s say you have an Arduino hooked to an off-the-shelf GPS device and you want to display your altitude.  You would simply create a TinyGPS++ instance like this:

#include "TinyGPS++.h"
TinyGPSPlus gps;

Repeatedly feed it characters from your GPS device:

while (ss.available() > 0)
  gps.encode(ss.read());

Then query it for the desired information:

if (gps.altitude.isUpdated())
  Serial.println(gps.altitude.meters());

Differences from TinyGPS

Although TinyGPS++ shares much the same compact parsing engine with TinyGPS, its programmer interface is somewhat more intuitive.  As a simple example, here’s how easy it is to print out the current latitude, longitude, and altitude in TinyGPS++:

Serial.print("LAT=");  Serial.println(gps.location.lat(), 6);
Serial.print("LONG="); Serial.println(gps.location.lng(), 6);
Serial.print("ALT=");  Serial.println(gps.altitude.meters());

Both libraries extract basic position, altitude, course, time, and date, etc. from two common NMEA sentences, $GPGGA and $GPRMC. But there are a number of other interesting sentences out there, both NMEA-defined and vendor-proprietary, just waiting to be harvested.

Consider the obscure $GPRMB, for example, which provides “recommended minimum navigation information” if you have a destination waypoint defined.

$GPRMB,A,4.08,L,EGLL,EGLM,5130.02,N,00046.34,W,004.6,213.9,122.9,A*3D

With TinyGPS++ it is now possible to extract just the “L” in the third field (it means “steer Left!”). It’s easy with the new TinyGPSCustom watcher object:

TinyGPSCustom steerDirection(gps, "GPRMB", 3);
...
Serial.print(steerDirection.value()); // prints "L" or "R"

Naturally, this extra functionality comes at some cost.  TinyGPS++ consumes somewhat more memory than TinyGPS, and it’s interface is incompatible.  So how to decide whether to update?  Here’s a guide:

Consider TinyGPS++ over TinyGPS if:

  • Compatibility with existing code (using TinyGPS) isn’t necessary.
  • Your sketch is not close to reaching RAM or flash resource limits.
  • You are running on Due or processor which can take advantage of the higher precision of 64-bit “double” floating-point.
  • You prefer the more intuitive object model.
  • You need to query for NMEA data beyond the basic location, date, time, altitude, course, speed, satellites or hdop.

Feeding the Hungry Object

To get TinyGPS++ to work, you have to repeatedly funnel the characters to it from the GPS module using the encode() method. For example, if your GPS module is attached to pins 4(RX) and 3(TX), you might write code like this:

SoftwareSerial ss(4, 3);
void loop()
{
  while (ss.available() > 0)
    gps.encode(ss.read);
  ...

After the object has been “fed” you can query it to see if any data fields have been updated:

  if (gps.location.isUpdated())
  {
    Serial.print("LAT="); Serial.print(gps.location.lat(), 6);
    Serial.print("LNG="); Serial.println(gps.location.lng(), 6);
  }
} // end loop()

The TinyGPS++ Object Model

The main TinyGPS++ object contains several core sub-objects:

  • location – the latest position fix
  • date – the latest date fix (UT)
  • time – the latest time fix (UT)
  • speed – current ground speed
  • course – current ground course
  • altitude – latest altitude fix
  • satellites – the number of visible, participating satellites
  • hdop – horizontal diminution of precision

Each provides methods to examine its current value, sometimes in multiple formats and units. Here’s a complete list:

Serial.println(gps.location.lat(), 6); // Latitude in degrees (double)
Serial.println(gps.location.lng(), 6); // Longitude in degrees (double)
Serial.print(gps.location.rawLat().negative ? "-" : "+");
Serial.println(gps.location.rawLat().deg); // Raw latitude in whole degrees
Serial.println(gps.location.rawLat().billionths);// ... and billionths (u16/u32)
Serial.print(gps.location.rawLng().negative ? "-" : "+");
Serial.println(gps.location.rawLng().deg); // Raw longitude in whole degrees
Serial.println(gps.location.rawLng().billionths);// ... and billionths (u16/u32)
Serial.println(gps.date.value()); // Raw date in DDMMYY format (u32)
Serial.println(gps.date.year()); // Year (2000+) (u16)
Serial.println(gps.date.month()); // Month (1-12) (u8)
Serial.println(gps.date.day()); // Day (1-31) (u8)
Serial.println(gps.time.value()); // Raw time in HHMMSSCC format (u32)
Serial.println(gps.time.hour()); // Hour (0-23) (u8)
Serial.println(gps.time.minute()); // Minute (0-59) (u8)
Serial.println(gps.time.second()); // Second (0-59) (u8)
Serial.println(gps.time.centisecond()); // 100ths of a second (0-99) (u8)
Serial.println(gps.speed.value()); // Raw speed in 100ths of a knot (i32)
Serial.println(gps.speed.knots()); // Speed in knots (double)
Serial.println(gps.speed.mph()); // Speed in miles per hour (double)
Serial.println(gps.speed.mps()); // Speed in meters per second (double)
Serial.println(gps.speed.kmph()); // Speed in kilometers per hour (double)
Serial.println(gps.course.value()); // Raw course in 100ths of a degree (i32)
Serial.println(gps.course.deg()); // Course in degrees (double)
Serial.println(gps.altitude.value()); // Raw altitude in centimeters (i32)
Serial.println(gps.altitude.meters()); // Altitude in meters (double)
Serial.println(gps.altitude.miles()); // Altitude in miles (double)
Serial.println(gps.altitude.kilometers()); // Altitude in kilometers (double)
Serial.println(gps.altitude.feet()); // Altitude in feet (double)
Serial.println(gps.satellites.value()); // Number of satellites in use (u32)
Serial.println(gps.hdop.value()); // Horizontal Dim. of Precision (100ths-i32)

Validity, Update status, and Age

You can examine an object’s value at any time, but unless TinyGPS++ has recently been fed from the GPS, it should not be considered valid and up-to-date. The isValid() method will tell you whether the object contains any valid data and is safe to query.

Similarly, isUpdated() indicates whether the object’s value has been updated (not necessarily changed) since the last time you queried it.

Lastly, if you want to know how stale an object’s data is, call its age() method, which returns the number of milliseconds since its last update. If this returns a value greater than 1500 or so, it may be a sign of a problem like a lost fix.

Debugging

When a TinyGPS++ sketch fails, it’s usually because the object received an incomplete NMEA stream, or perhaps none at all.

Fortunately, it’s pretty easy to determine what’s going wrong using some built-in diagnostic methods:

  • charsProcessed() – the total number of characters received by the object
  • sentencesWithFix() – the number of $GPRMC or $GPGGA sentences that had a fix
  • failedChecksum() – the number of sentences of all types that failed the checksum test
  • passedChecksum() – the number of sentences of all types that passed the checksum test

If your sketch has been running a while but charsProcessed() is returning 0, you likely have a problem with your wiring or serial connection. (If data never arrives from the GPS unit, it stands to reason it’s not getting to TinyGPS++.) I often insert a little debug clause into my GPS sketches detects this condition then prints out the incoming stream:

// Debug: if we haven't seen lots of data in 5 seconds, something's wrong.
if (millis() > 5000 && gps.charsProcessed() < 10) // uh oh
{
  Serial.println("ERROR: not getting any GPS data!");
  // dump the stream to Serial
  Serial.println("GPS stream dump:");
  while (true) // infinite loop
    if (ss.available() > 0) // any data coming in?
      Serial.write(ss.read());
}

Another common failure is when the sentences sent to TinyGPS++ are incomplete. This usually happens when you retrieve the characters from the GPS so slowly or infrequently that some are lost. The symptom is easy to spot: checksum failure.

Explanation: Every NMEA sentence ends with a numeric field that represents a mathematical summing of all the characters in the sentence. It’s there to ensure data integrity. If this number doesn’t match the actual sum (perhaps because some characters went awry), TinyGPS++ simply discards the entire sentence and increments an internal “checksum failed” counter. You can read this counter with:

Serial.print("Sentences that failed checksum=");
Serial.println(gps.failedChecksum());

// Testing overflow in SoftwareSerial is sometimes useful too.
Serial.print("Soft Serial device overflowed? ");
Serial.println(ss.overflow() ? "YES!" : "No");

If the checksum counter is continually incrementing, you have a problem. (Hint: don’t use delay() in your sketch.)

Custom NMEA Sentence Extraction

One of the great new features of TinyGPS++ is the ability to extract arbitrary data from any NMEA or NMEA-like sentence. Read up on some of the interesting sentences there are out there, then check to make sure that your GPS receiver can generate them.

The idea behind custom extraction is that you tell TinyGPS++ the sentence name and the field number you are interested in, like this:

TinyGPSCustom magneticVariation(gps, "GPRMC", 10)

This instructs TinyGPS++ to keep an eye out for $GPRMC sentences, and extract the 10th comma-separated field each time one flows by. At this point, magneticVariation is a new object just like the built-in ones. You can query it just like the others:

if (magneticVariation.isUpdated())
{
  Serial.print("Magnetic variation is ");
  Serial.println(magneticVariation.value());
}

Establishing a fix

TinyGPS++ objects depend on their host sketch to feed them valid and current NMEA GPS data. To ensure their world-view is continually up-to-date, three things must happen:

  1. You must continually feed the object serial NMEA data with encode().
  2. The NMEA sentences must pass the checksum test.
  3. For built-in (non-custom) objects, the NMEA sentences must self-report themselves as valid. That is, 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 the position and altitude information is discarded (though time and date are retained).

It may take several minutes for a device to establish a fix, especially it has traveled some distance or a long time has elapsed since its last use.

Distance and Course

If your application has some notion of a “waypoint” or destination, it is sometimes useful to be able to calculate the distance to that waypoint and the direction, or “course”, you must travel to get there. TinyGPS++ provides two methods to get this information, and a third (cardinal()) to display the course in friendly, human-readable compass directions.

const double EIFFEL_TOWER_LAT = 48.85826;
const double EIFFEL_TOWER_LNG = 2.294516;
double distanceKm =
  TinyGPSPlus.distanceBetween(
    gps.location.lat(),
    gps.location.lng(),
    EIFFEL_TOWER_LAT,
    EIFFEL_TOWER_LNG) / 1000.0;
double courseTo =
  TinyGPSPlus.courseTo(
    gps.location.lat(),
    gps.location.lng(),
    EIFFEL_TOWER_LAT,
    EIFFEL_TOWER_LNG);
Serial.print("Distance (km) to Eiffel Tower: ");
Serial.println(distanceKm);
Serial.print("Course to Eiffel Tower: ");
Serial.println(courseTo);
Serial.print("Human directions: ");
Serial.println(TinyGPSPlus.cardinal(courseTo));

Library Version

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

Serial.println(TinyGPSPlus::libraryVersion());

Sample Sketches

TinyGPS++ ships with several sample sketch which range from the simple to the more elaborate. Start with BasicExample, which demonstrates library basics without even requiring a GPS device, then move onto FullExample and KitchenSink. Later, see if you can understand how to do custom extractions with some of the other examples.

Acknowledgements

Thanks go out to the many Arduino forum users for outstanding help in testing and popularizing TinyGPS, this library’s predecessor. Thanks especially to Maarten Lamers, who wrote the wiring library that originally gave me the idea of how to organize TinyGPS++.

All input is appreciated.

Mikal Hart

Page last updated on September 28, 2014 at 11:35 am
361 Responses → “TinyGPS++”

  1. Brian

    2 years ago

    Silly question perhaps, but I decided to try TinyGPSPlus with a basic Arduino with 328P versus the Mega128 and custom ATmega128A boards I’ve been successfully using, but does TinyGPSPlus allow the use of the 328P hardware serial?

    The GPS data is mirrored to the serial monitor correctly, but the TinyGPS object does not seem to do anything!

    Oddly enough, even with a Mega128, if you feed it using Serial1 (second hardware serial), it works fine, but move it to Serial0 (first serial) you get nothing!

    Any ideas?


  2. Brian

    2 years ago

    Never mind the last question! ;) Stupid pinout diagram for the breakout shield has the RX/TX lines reversed! Doh!

    In any case, before figuring out the RX/TX swap, I optimized the code seeing how having 5(!) bytes of RAM left over is probably not a good thing in an ATmega328! It now has 321 bytes free, and works fine.


  3. MF

    1 year ago

    // Hello, Good day. Thank you so much for sharing this GPS module library.

    // my project aims to warn the driver with a voice message when the speed
    // reached 80 km/hr, and also sends information like latitude and longitude via
    // text message.

    // Initially, I did not put the voice alert function, just the text message
    // function. There was no problem with the GPS module getting a fix information
    // when it was connected to the Arduino UNO and GSM module, I did not use a
    // library for the GSM module. It was working fine by then. The values from the
    // GPS module are updated.

    // But when I wired the mp3 player module and included the DFPlayer_Mini_Mp3.h
    // library and its commands to my sketch, the voice alert was fine, the GSM
    // module sends a message to my phone but is not updated, just zero values from
    // the GPS module. ex. LAT: 000000,
    // LONG: 000000


  4. Paul Rowntree

    1 year ago

    Hi! Great package, it simplified my program quite a bit! Thank you very much!
    I am new to Arduino-land, and c-programming. Why do your examples use

    TinyGPSPlus.courseTo(… // from examples on this web page
    and
    TinyGPSPlus::courseTo(… // from some of the Example sketches

    instead of simply

    gps.courseTo( … // from my program, seems to work fine
    Cheers!


  5. surajit paul

    12 months ago

    hi, I’m using tinygpsplus library.I’m making a project “gps controlled rc car ” using ublox neo 6m gps sensor and hmc5883l compass. my problem is that when I connect the arduino with computer everything works fine and gets gps coordinate and compass heading bt when I disconnected usb and connect with 9v battery to arduino, the car does move. rx signal receiving and tx not indicating.when I connect with usb to arduino, the car moving. I’m also using hmc5883l library. and not using this function “while(!serial). in the loop I’m using “while(ss.available ()>o)”. what’s happening please help me


  6. Ben Mc

    11 months ago

    Hi Mikal,

    Thanks for your code. I have a question in regards to gps data sampling rate. The code outputs the sentences at 1 s increments by default, is it possible to access the data faster? I would like to get altitude data off my gps module at 10-100 hz.

    Thx for any help


  7. Mikal

    11 months ago

    @Ben Mc:

    The rate at which samples are delivered depends entirely on the hardware you choose. The EM-406a and EM-506 that I often use only deliver in 1Hz samples; there is no way to bump up the rate. Other devices can be configured to deliver samples at 10Hz, but this isn’t something that can be done in TinyGPS++.


  8. Mikal

    11 months ago

    @Paul Rowntree,

    When I’m using C++ “static” member functions I like to use the ClassName::MemberName() syntax instead of Object.MemberName() to illustrate that the member function is independent of any particular object.


  9. Mikal

    11 months ago

    @MF: You should probably switch to a Teensy or Mega or something that provides more than 1 Hardware Serial port.


  10. DM Rick

    10 months ago

    Thank you so much sir. I wasn’t sure from the remarks was if you were getting the bearing and distance to London from the GPS unit by sending it a waypoint or if you were doing the calculation in TinyGPS++. My GPS unit (NEO-6M) doesn’t seem to take waypoints or produce RMB so I a super glad to find your TinyGPS++ does that work. What a find. You really have saved me as little sailboat and I were to leave a month ago but wanted to work out at least an auto steering system. Now I will have a much better system where I changed London to WayPoint and feed Lat/Lon to where I want to go. The Cross Track Error I can work out.
    This is amazing. Thank you.


  11. Rick

    9 months ago

    The more I use it the more I like it. Only thing is I still don’t fully understand it and just modified the example to get the info I needed out of the NEO-6M. It seems to run thru the void loop just once per second. I kicked up the data transfer rate of NEO and Uno (Softwareserial) to 57,600 and dropped out all but GGA and RMC from NEO but still loops about once per second. My fix is just adding another Uno for keypad and rudder control. Solves pin count problem too. I should be able to transfer the data I2C. I have plenty of boards but since I also name them (Adam, Eve, Max) I’m running out of names :)
    Thanks for writing this gem


  12. Jeferson

    9 months ago

    What type of licence tinygpsplus is under? Can I use on my drones and wings?


  13. Michele

    9 months ago

    Hi!
    I’m facing a very very strange problem…
    All the TinyGPSPlus examples works ok…
    A sketch of mine that does not use TinyGPSPlus works ok…

    If in my sketch i simply add

    #include
    TinyGPSPlus gps;

    The sketch does not work anymore (cannot find a way to debug this problem).

    My sketch is using the library JTEncode and the function that “hang” is jt65_encode of that library.

    I’ve no idea of what the statement “TinyGPSPlus gps;” does…but if i comment it, everything works ok.

    Any idea?

    PS: I’ve written to the developer of JTEncode, i’m waiting for an answer from him too.

    PLEASE, an help would be really appreciated.

    Michele


  14. Mikal

    9 months ago

    @Michele, if your program breaks when you added only the definition of the gps variable, then my guess is that you have run out of some resource (memory or flash space).


  15. Mikal

    9 months ago

    No problem @Jeferson. It’s licensed under LGPL. Let us know how it works out.


  16. Mikal

    9 months ago

    @Rick, I think one problem might be that SoftwareSerial can get unreliable at speeds greater than 19.2 or 38.4K.

    I think the NEO-6M refreshes at 5Hz. TinyGPS++ itself has no internal limit beyond just the processing power of the underlying CPU. Subject to that it will process characters as fast as the GPS module generates them.


  17. JP_Austin

    9 months ago

    Mikal, great library. I have been using it in an ESP8266 project and experiencing some issues with the distanceBetween function. I have essentially the same LAT and LON values defined as my HOME location and when I exercise the function to determine how far from home it reports an error of about 10KM. Am I doping something odd or is it something with the ESP8266 and how it compiles the code?

    Only thing I could find remotely close to the error is from this Particle post. Similar issue was being reported.

    https://community.particle.io/t/tinygps-distancebetween-calculates-wrong-distance/20557

    I use the function like this:

    unsigned long Distance_To_Home = (unsigned long)TinyGPSPlus::distanceBetween(gps.location.lat(),gps.location.lng(),Home_LAT, Home_LNG);
    display.print(“KM to Home: “); // Have TinyGPS Calculate distance to home and display it
    display.println(Distance_To_Home);


  18. Mikal

    9 months ago

    Hi @JP_Austin.

    I don’t think you’re experiencing the same thing reported on the particle.io site.

    You realize, right, that distanceBetween() returns distance in meters, not in kilometers? Assuming so, can you give me some more detail? What number were you expecting and what number did you get? It would be useful if you could give me (approximate) values for bot lat/long pairs.


  19. JP_Austin

    9 months ago

    Face palm –> Meters and not KM! OK now I do feel stupid. I had loaded an example provided and it was reporting the value as KM. I didn’t scrub the documentation well enough to realize your library was reporting the distance in meters. Lesson learned – don’t pick up examples and report issues unless you really know the said example is clean.


  20. Rick

    9 months ago

    Mikal, Thanks. You are exactly correct. I dropped GPS transfer speed back down in steps from 57600 to 19200 and it became stable again. Of course being as I am I then dropped it to 9600 just to be sure. Still plenty fast enough at 1 Hz samples to drive a sailboat :)

    I’m still a little confused about which is newer, TinyGPS++ or TinyGPS13. I was having trouble with the count of satellites on I2C driven 20×4 LCD so rewrote it all using v.13 library and working ok so far.


  21. JIM_COLORADO

    8 months ago

    Mikal,

    TinyGPS++ is great in most of my Arduino sketches. Thanks for writing it.

    However, I am trying to run your sketch “SatelliteTracker.ino” which I got from GitHub. I’m using an Adafruit GPS Logger shield with an Arduino UNO. I changed the RXPin and TXPin numbers to 8 and 7, respectively, and I changed the GPSBaud statement to “static const uint32_t GPSBaud = 9600;” The sketch compiles OK and runs down through the Serial.println statements in the void setup. I don’t get any output after that. Do you have any suggestions? Thanks.

    Jim


  22. Herve

    8 months ago

    Hi,
    I’m very please using TinyGPS++.
    Just one thing, I want to update the arduino time ONLY if date and time are valid (for datalogger, so I block my sketch waiting for these conditions to be valid) …. but that doesn’t work as expected.

    I’m using: if (gps.date.isValid() && gps.time.isValid()) ….

    even if the GPS replies a “false date” (2000/01/01) TinyGPS++ consider them as valid.

    Is there any solution to change that behaviour ?

    Many thanks in advance
    best regards … and thanks again for the good work !


  23. Mikal

    8 months ago

    @Herve,

    Yes, it’s a little confusing, but the “isValid()” method on date and time is simply the library reporting that at least one NMEA stream that could contain a date or time has been parsed. Would you suggest a different algorithm? I’ll think about this.

    M


  24. Mikal

    8 months ago

    @Jim–It’s easy to get the wiring backwards. Usually (but not always!) you connect TX to RX and RX to TX.


  25. Ron Koval

    5 months ago

    What is the operational difference that I see in the above TinyGPS++ instructions:

    while (ss.available() > 0)
    gps.encode(ss.read());

    and

    library FullExample:

    while (ss.available())
    gps.encode(ss.read());

    ?


  26. Damien

    5 months ago

    Hi!
    First of all, thank you for your libraries. This is really great!
    I am using two ublox neo6m v2, that I manage to talk with with TinyGPS and TinyGPS++, except that I cannot retrieve the date (I get a ’0′ value). While investigating, I found that the case COMBINE(GPS_SENTENCE_GPRMC, 9): // Date (GPRMC) from the library was actually never used (a Serial.println(“test”) gives nothing here, but prints for other cases).
    Has anyone experienced the same, or has a clue of what happens (or does not happen)?
    Many thanks,
    Damien


  27. Thomas Kjeldsen

    4 months ago

    Hi
    im trying to do a read out to a display(nokia 5110) but i only get 0 or strange numbers

    here is my code

    ;
    a = (gps.speed.kmph());
    sprintf(kmt, "%d", a);
    display.setTextSize(1);
    set_text(1,18,"Speed:",BLACK);
    set_text(40,18,kmt,BLACK);

    char retning[8];
    a = (gps.course.deg());
    sprintf(retning, "%d", a);
    display.setTextSize(1);
    set_text(1,27,"Course:",BLACK);
    set_text(40,27,kmt,BLACK);

    char longt[32];
    a = (gps.location.lng());
    sprintf(longt, "%d", a);
    display.setTextSize(1);
    set_text(1,36,longt,BLACK);

    char lati[32];
    a = (gps.location.lat());
    a = (a);
    sprintf(lati, "%d", a);
    display.setTextSize(1);
    set_text(1,45,lati,BLACK);
    Serial.println(a);

    char dato[32];
    d = gps.date.value();
    sprintf(dato, "%d", d);
    display.setTextSize(1);
    set_text(14,0,dato,BLACK);

    char tid[32];
    d = gps.time.value();
    sprintf(tid, "%d", d);
    display.setTextSize(1);
    set_text(20,9,tid,BLACK);

    Serial.print("LAT="); Serial.println(gps.location.lat(), 11);
    Serial.print("LONG="); Serial.println(gps.location.lng(), 11);
    Serial.print("ALT="); Serial.println(gps.altitude.meters());
    smartDelay(1000);

    if (millis() > 5000 && gps.charsProcessed() < 10)
    Serial.println(F("No GPS data received: check wiring"));
    }

    // This custom version of delay() ensures that the gps object
    // is being "fed".
    static void smartDelay(unsigned long ms)
    {
    unsigned long start = millis();
    do
    {
    while (ss.available())
    gps.encode(ss.read());
    } while (millis() – start < ms);
    }
    void set_text(int x,int y,String text,int color){

    display.setTextColor(color); // Textfarbe setzen, also Schwarz oder Weiss
    display.setCursor(x,y); // Startpunkt-Position des Textes
    display.println(text); // Textzeile ausgeben
    display.display(); // Display aktualisieren
    }


  28. Leo Megliola

    4 months ago

    Autonomous kayak using TinyGPS++, see https://youtu.be/9v6JTt4jLEg


  29. Thomas Michalak

    3 months ago

    Hi,

    First of all, it’s a brilliant library, really easy to use, versatile and got me up and running in no time.

    I have one question. I was driving around with my breadboard on the passenger seat (testing my project), everything was fine but, just once, the Lat and Lon jumped to North Africa (I’m in the UK). I looks like the decimal point shifted on the lat from 50.8376420 to 5.0837642 and Lon went from negative to positive.

    Does that sound familiar?

    I’m thinking of writing something to ignore those jumps but I though it might be worth asking first. I haven’t used isValid() so maybe that will do it.

    Cheers


  30. dudu

    3 months ago

    hey Mikal! thank u for the library but I’ve been wondering if in this code there is a way you can add how to give command to arduino due to the coordinates given by GPS???
    for example when GPS reach this coordites….. do this…??

    thank you


  31. Todd

    2 months ago

    Works beautifully! Thanks.


  32. Dirk Jan

    1 month ago

    Very nice lib :-).
    Is there a way (with or while) using TinyGPS to get the GPS in a lower power state? I have the GY-NEO6MV2 connected to a Wemos D1 Mini (ESP8266). I switch the Wemos to a lower power state while idle, but the GPS is still using 80mA. Any idears?

    Thanks, DJ


  33. Garry

    1 month ago

    I am trying to build a GPS true north compass by using two GPS receivers about 40 feet (12 meters) apart. To do this I have to measure the differences in latitude and longitude and solve a triangle. My problem is that the float data type is not precise enough. Is there a way to get latitude and longitude as long (4 byte or 32 bit) integers? I know that the latitude and longitude data are not accurate at the billionth of a degree but the factors that cause errors, like atmospherics, should be the same for two receivers so close together.


  34. Mikal

    1 month ago

    Garry, try the rawLat() and rawLng() methods in gps.location(). See the “Kitchen Sink” example.


  35. Mikal

    1 month ago

    @Dirk Jan, TinyGPS is just a parsing for the NMEA stream. If you want to configure your GPS module, simply Serial.write() the appropriate configurations strings.


  36. Mikal

    1 month ago

    @Thomas Michalak, I have indeed seen something like that exactly once. Honestly, I can’t see any flaw in TinyGPS++ parsing that might explain it!


  37. Tim

    2 weeks ago

    Hi. I have used this lib for couple of projects with grat success, but there is one issue I can’t quite figure out. This is a speedometer in a endurance race car. When the speed is more than 137Kmh, the display stops working.
    When the speed drops, it starts to work again.
    I have a ublocks 7 gps, programmed to 0.2s update w 57k6 baudrate. Board is arduino due. And code is most basic one almost directly from examples, with a difference that it takes 5 samples and calculates average.

    If anyone has been there and done that, any info will be greatly appreciated.

    Although this is not a big issue, because the speedo is mainly used at pit lane as there is a speed limit of 40kmh, it would be nice to know what to suspect.

    But, anyway this is a great lib and thank you very much !

    cheers, Tim


  38. Geo.

    1 week ago

    Mikal:

    Great library!! Thanks!! One question, can I change the time from UTC/GMT to my own timezone(CST -6)??


  39. Giorgos

    1 week ago

    Hi Mikal. great library and easy to use.
    I am using this library with the Feather M0 and the Featherwing Ultimate GPS. ANyone else used this compination with this library?
    I am no getting as accurate results as i was hopping to. Anyone has any ideas on how to improve the accuracy?


  40. vincenzo

    1 week ago

    i modified the tinygps++ to work with new satellites as galileo
    https://github.com/aster94/TinyGPSPlus-GNSS


  41. Mikal

    5 days ago

    @Geo, I think I would take the time supplied by TinyGPS++ and send it to the Time library (Time.h). It’s smarter about doing time manipulation.


  42. Mikal

    21 hours ago

    @Giorgos, the library just extracts the data provided by the module. Can you describe your issue in a little more detail?

19 Trackbacks For This Post
  1. TinyGPS++ to the Rescue | Stainless Steelhead

    [...] to the brains behind Arduiniana, Mikal Hart, Poolbot has moved to the brand-new GPS library set, TinyGPS++.  This saved enormous time in developing custom code to process and check the validity of NMEA [...]

  2. Antenna tracker, first steps | kolin's

    [...] or none, I made simple arduino program for parsing NMEA crap and encoding it in LTM packets. I used TinyGPS++ library for parsing NMEA and few lines from TauLabs [...]

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

    [...] Descarcati biblioteca tinyGPS sau tinyGPS++. [...]

  4. GPS-Logger | Pascal's Königreich

    [...] Card Breakout Board gibt’s bei Adafruit, um mit dem GPS Modul zu sprechen wurde die Library TinyGPS++ [...]

  5. GPS Distance Calculator (for golf) -Use Arduino for Projects

    [...] Tiny GPS++ [...]

  6. Arduino GPS with OLED Display | Home of Benty

    [...] OLED from Adafruit. It’s still a work in progress just squishing together code from the TinyGPS++ library and using the Adafruit GFX [...]

  7. SpainLabs - Mantener tus proyectos en hora

    [...] Con Arduino puedes usar la librería tyniGPS++. [...]

  8. Prototype 1 – GPS Module | A Mean Center

    [...] something useful with it. This isn’t due to any competence on my part, but because of  the TinyGPS++ library by Mikal Hart which is just amazing. There are many examples included with the library, so it is [...]

  9. Unexpected behavior of sprintf with i32/u32 | CL-UAT

    [...] trying to build a string of characters from several elements given by the TinyGPS++ library with the use of [...]

  10. Connecting u-blox NEO-6M GPS to Arduino | Big Dan the Blogging Man

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

  11. LatLong to XY | Rocket Project

    [...] the same. latlon2xy is the doc with the Arduino code. Since I last looked at GPS, Mikal Hart has an updated GPS library that computes distanceBetween() and courseTo(). It might be worth pursuing. Share [...]

  12. با برد آردوینو و شیلد GPRS دستگاه ردیاب کوچک و کارآمد بسازید | رایانش نیوز

    [...] این کتابخانه را برای استفاده از برد GPS دانلود کنید. سپس کدهای [...]

  13. Shield GPS Ublox NEO-6M – Programación con Arduino MEGA 2560 – Tecno-fly C.A

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

  14. Leyendo datos del GPS – OCEANO ABIERTO

    [...] Arduino que nos permite convertir esas cadenas de caracteres en valores fácilmente interpretables: TinyGPSplus. Tendremos que descargar el archivo .zip de la última versión e instalarlo manualmente en nuestro [...]

  15. Lightweight Module for Collecting Stratospheric Microbes | HENRY-1 HAB MISSION

    [...] RBBB was programmed with Arduino’s IDE and includes both the TinyGPS++ and Arduino Servo libraries. The TinyGPS library is very effective at parsing NMEA GPS data [...]

  16. How to make a GPS Speedometer? – DFRobot

    [...] following library ‘s in your Arduino Library Folder. U8glib – For the oled display. TinyGps++ – For the GPS. The code is “printing” the speed, course, number of satellites, [...]

  17. IoT WiFi Boat Monitor | Mechinations

    [...] Next, grab the starting source code. You will also need to install the TinyGPS++ library. [...]

  18. Adding Location to Microcontroller Projects: GPS Tutorial | Teach Me Micro

    [...] levels hence a voltage divider is needed to step down the voltage from the Arduino.You can use the TinyGPS++ library for easier Arduino GPS interfacing. Here's an example sketch from the library (modified to fit [...]

  19. Using Seeeduino LoRaWAN with GPS and Loriot.io – Squix – TechBlog

    [...] temperature and humidity we have to install two libraries. Download the TinyGpsPlus library from http://arduiniana.org/libraries/tinygpsplus/ Then install also the DHT library from Adafruit from the library manager in the Sketch > [...]

Leave a Reply