TinyGPS++: A New View of Global Positioning

Posted on September 7th, 2013 at 9:44 pm by


The New TinyGPS++ Object Model

Announcing TinyGPS++

Today we’re happy to announce TinyGPS++, a completely new rethinking of TinyGPS, our popular Arduino NMEA (GPS) parsing library.

NMEA defines how most GPS receivers talk. When GPS is properly connected to a host controller like Arduino, it sends a never-ending stream of characters, grouped into human-readable clumps called “sentences”:


Obviously, when I say “human readable”, I mean only in the loosest sense. It takes a bit of skill and parsing savvy to identify the stream above as fix taken in a parking lot in Austin, Texas, USA on the evening of 2 September. That’s where TinyGPS and TinyGPS++ come in.

Both libraries help the Arduino programmer decode NMEA into readily usable position, date, time, speed, and course information–the basics of GPS. TinyGPS is a very resource-stingy library that has been on the scene for over four years now. TinyGPS++ has a larger footprint than its venerable sibling, but improves on it in two key ways:

Convenient new object model

As illustrated at the top of this page, TinyGPS++ gives your sketch instant access to a number of built-in GPS data points, using an intuitive and easy-to-use syntax. Want to know your altitude? That’s gps.altitude.value(). Latitude? Try gps.location.lat(). Speed in knots? That’s just gps.speed.knots().

TinyGPS extracts data from just two of the many NMEA-defined sentence types: $GPRMC and $GPGGA. TinyGPS++ does the same, but in the more convenient format.

Custom sentence extraction with TinyGPSCustom

But unlike its sibling, TinyGPS++ can also extract arbitrary data from any of the myriad other NMEA sentence types out there–even proprietary ones. Interested in how many GPS satellites are in view? Just create a TinyGPSCustom object that extracts the 3rd field (“11″) of the $GPGSV sentence:

TinyGPSCustom sats(gps, "GPGSV", 3);

Magnetic variation? That’s the 10th field of a $GPRMC sentence (020.3 degrees):

TinyGPSCustom sats(gps, "GPRMC", 10);

TinyGPS++ is in late pre-release now. Try it out. We could use the feedback.