NMEA Library for Arduino

NMEA 0183 (National Marine Electronics Association) is the communication standard for devices used in marine environments as an aid to navigation. The most common use outside of marine environments is for GPS devices, which use NMEA to broadcast their position.

I wrote this library for Loguino in order to provide global positioning metrics to the logger. For Loguino 2.0 I needed to simplify the build, which means moving non-core libraries into their own packages, a lot of people also use the libraries on their own without Loguino, so it’s about time this was the case.

The code is available on GitHub, under the GPL.


You can download the ZIP file to import into the IDE here, or you can fork your own.


bool addChar(const char c)

Add a character from the gps stream. Returns True when a valid NMEA sentence has been completed. Generally you want to loop through all the data in the serial buffer and call addChar with the output of serial.read() until it returns true. At which point you can interrogate the NMEA object to determine if the fix is valid and then grab the location information if required.

bool validFix()

Returns true when the GPS has a valid fix.

string gps.getCourse()

Returns the course in degrees.

string getSpeed()

Returns the speed in Knots.

string getLatitude()

Returns the latitude.

string getLongitude()

Returns the longitude

string gps.getDate()

Returns the date as a string.

string gps.getTime()

Returns the time as a string.


You can download an example project here.

Leave a Reply

Your email address will not be published. Required fields are marked *