Go Down

Topic: A GPS decoder for NEMA 0183 sentences (Read 1 time) previous topic - next topic


I'm recently making a FPV tank that utilizes a GPS. After some easy search online, I realized that there isn't a good GPS decoder library. The example for GPS i found in Arduino.cc merely deciphers the NEMA sentence by outputting different fields of a NEMA sentence, i.e, it treats the figures(e.g. latitude, longitude, dilution etc) as text without really "understanding" them. What's more, it supports only RMC sentences.

Anyway I decided to write my own GPS library, and here it is.
The library supports GGA,GSA,RMC, and, VTG sentences types defined in NEMA 0183 document, and is hopefully compatible with most GPS in the market.
There are many functions in the GPS class, most of them look like "getLon()",which returns a double which is the latest longitude the GPS returns, to get to know all the funtions, have a glimpse of the header file, the function names are designed to be "human readable", if you have any difficulty understanding or using my library or finds a bug,  feel free to contact me, either by replying here or via zhangzyhack@126.com this is the first time I write a library and publish it, knowing my effort benefits you is a great encouragement.

Here's a simple guideline on how you may use it.

Circuit: connect your GPS serial RX/TX to arduino ports that support Software Serial.(e.g. 10,11 on Mega 2560)


Code: [Select]

//First, make an serial object;
SoftwareSerial gpsSerial(10,11);
//then, make an GPS object with the address of the newly created softeareserial
GPS myGPS(&gpsSerial);
//or, you can make a GPS instance without a softwareserial.
//GPS myGPS;

/*you need to call myGPS.read() periodically in your loop code,frequently I recommend to avoid buffer overflow, for the buffer of SoftwareSerial port has only 64 bytes, which is shorter than a NEMA sentence(approximately 100bytes)*/

void setup() {
    while (!myGPS.isFixed()) {
        Serial.println(F("GPS not fixed"));

void loop() {
    Serial.println(F("GPS fixed"));


Great work, I will look into your code ....

Go Up