How to use GPS with Arduino - Parse and Log NMEA Sentences

Aidan just shared a new tutorial: "How to use GPS with Arduino - Parse and Log NMEA Sentences"

Now that you know How GPS Receivers work we can apply that understanding to some real-world application of the idea. To get going, we can use any GPS receiver, an Arduino Uno and some male-to-female Jumper cables. We’ve chosen to go with Adafrui…

Read more

Can you please explain how I would change the update rate. What area the options for going higher or lower? The library documents do not explain much.

Is there a way to stop them GPS communication being echoed to the monitor?

1 Like

Hey David,
Thanks for getting in touch, in regard to your first comment, you can change the update rate by changing the line in the code that reads:
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); //Sets the output to 1/second. If you want you can go higher/lower
The changes you can make to the command within the brackets are listed below:

Finally, the only reason that the updates are echoed to the monitor is so that you may see them as you’re developing. To disable that functionality, you can simply remove the lines that read Serial.Print & Serial.Println

I hope this helps, let us know if you need anything else!

Thank you. This information is very helpful to me and anyone getting started with the Adafruit GPS. Is there such a thing as a guide for using the library or does the user have to delve into the cpp code to understand the parameter options? I am disappointed with the library and examples but I got the device to work without echoes to the serial monitor and regigged the serial monitor output to give comma separated variables. I determined that the GPS is not good for determining changes in elevation. David

1 Like

Great to hear David. And of course, there are guides (such as this one, and other more in depth ones around the interweb).

Perhaps a sensor such as this one might be better for Altitude measurements - (ADA2651)

1 Like

Yes I am exploring the use of the BMP280 for differential barometric pressure to determine elevation. My venture into GPS was just to determine that the barometric pressure method was the best approach for my target of a maximum uncertainty of 0.1 metre.

1 Like

Hi Aidan.
Thanks for this tutorial. Easiest to follow of all GPS examples out there.

A couple of problems:

Serial monitor was showing gibberish until I change the “Serial.begin(115200)” to “Serial.begin(9600”), then it showa the correct data.

But my GPS unit does not achieve a fix. I had it outside for 10 minutes but no fix.

Do I have to wait tlonger than that to achieve the first fix or might something else be not right?


1 Like

Hey John, thanks for letting us know, I’m glad to hear it. The serial monitor issue is likely just a discrepancy between the Baud rate in the sketch and the one selected in the serial monitor.

Which module are you using?

It’s an Adafruit Flora Wearable Ultimate GPS Module ( ).

Are there any queries I can send to the module to get it to return data that does not depend on a fix?


Hey John,
I just saw this on the Adafruit Learning Guide for that module -

In order to get ‘valid’ (not-blank) data you must have the GPS module directly outside, with the square ceramic antenna pointing up with a clear sky view. In ideal conditions, the module can get a fix in under 45 seconds. however depending on your location, satellite configuration, solar flares, tall buildings nearby, RF noise, etc it may take up to half an hour (or more) to get a fix! This does not mean your GPS module is broken, the GPS module will always work as fast as it can to get a fix.

It might be worth double checking your connections and leaving the board outside for a bit longer to see if that helps.

The device is constantly sending NMEA sentences; and if a battery is fitted to the back of the module (an option for the Adafruit Ultimate GPS) then time data would be useful in most instances.

I’ve got my GPS working. Frustrating process cos there’s few cues as to what is not working as you go, but great fun when you finally get it going.

May I offer a few tips for other novice struggling with GPS?

First, use u-blox’s u-center software (free) to prove the GPS receiver rather than an Arduino sketch. Aidan’s sketch will be great when you get a fix and want to make use of the data, but getting a fix is the first challenge.

Don’t load the Arduino with a sketch that communicates with your computer. I think that leads to conflict with u-center. You certainly can’t have the serial monitor connected to the same COM port as u-center at the same time. Load the Bare Minimum sketch and don’t activate the IDE Serial Monitor or Plotter. Best not to have the Arduino IDE running at all once you’ve got the Bare Minimum sketch loaded.

Be certain of the COM port the Arduino is using. Run up Windows’ Device Manager. My UNO appears under Ports (COM & LPT). Plug it in and unplug it to see it appear and disappear.

Now get power to the GPS module. On mine, a u-blox NEO-6M, it’s VCC to 3.3v and GND to GND. There are warnings about connecting to 5v for this unit. If the LED on the GPS glows steadily, then it’s working and listening for satellite signals. When it gets a fix the LED flashes at 1Hz. It took me two days to get there!

Even tho it hasn’t got a fix, it is still emitting messages that can be read by u-center (or the IDE Serial Monitor, but not both simultaneously).

Next post I’ll show how to understand the bare minimum of u-centre.


Setting up u-center:

Download & install u-center. This has extensive capabilities but we only need a few to introduce ourselves to our GPS unit.

Before connecting the GPS to u-centre, look at two views – the Text Console & the Messages View.

The Text Console displays messages, aka NMEA sentences, coming from the GPS. Since there’s no GPS connected nothing will appear.

Messages View gives info about all the messages that the GPS can send. Worth exploring. Read the blurb shown about NMEA messages. Open the tree under NMEA. This shows the categories of messages. Three categories are of interest: GxGGA, GxRMC & GxVTG. Open each one to see the individual messages available when the GPS is connected. They are all greyed out at this point as there is no GPS connected, but click on the messages of type “GP…” to see the data they provides.

Now set up these views which will show useful info when you connect the GPS and try to get a fix:

“View”>“Docking Windows”>“Satellite Position”, “Satellite Level” & “Data”.

Now. “View”>“Text Console” & “Messages View”.

That sets up u-center to monitor the GPS & allow you to see the GPS acquire satellite signals & data.

Next post: connecting the GPS to u-center.


Connecting GPS to u-center.

So, GPS is connected to Arduino thru VCC & GND, It’s working but not transmitting to Arduino.

Connect the TX pin of the GPS to TX>1 pin of the Arduino (digital pin 1). Most guides say TX goes to RX & vice versa. The “grammar” is ambiguous. “TX>1” means an external device is to transmit to the Arduino pin 1. So TX to TX>1 makes sense. Anyway, it’s the only way it works on my UNO. No harm in playing around with the connections.

When connected the RX LED on the Arduino flahes at 1Hz. That indicates the GPS is sending data & the Arduino is receiving. Out of curiosity, connect the TX pin of the GPS to the “RX<O” pin of the Arduino. The Arduino’s TX LED flashes. Put the connection back to the “TX>1” pin.

You don’t get a flashing LED when using Aiden’s sketch as that uses Soft Serial. The flashing LED is helpful as it tells us that data is coming from the GPS to the Arduino. You need these cues to tell you things are working as you proceed.

Now to u-center.

Connect u-center to the Arduino:

Two ways: the Window option or the symbol at the left of the second tool bar.

Select the COM port the Arduino is connected to. Baud shud be 9600 but I think this is automatic.

Messages shud start appearing in the Text Console.

The messages are readable but the series of commas tell you there is no data.

Now to get a fix.

I did this at night as the screen is readable. In daylight I can’t read the laptop screen.

Go somewhere there is a unobstructed view of the sky. Be patient. At first I got blue signals. Just a few and not persisting. Blue means the signal is received but not good enuf for navigation. You need green and you need at least four satellites.

Be patient,

After 90 minutes I started to get green signals. Then it all came together. Four, five, six eight satellites picked up. And my lat & long appeared in the data view. From then on I could move to other places with a less open view of the sky.

Problem to solve: why does it take so long to acquire the first fix and subsequent fixes after shutting down. Vehicle GPSs start up instantly, don’t they?


Great walkthrough John!

Thanks for sharing! I hadn’t heard of u-center before, it sounds like a great tool!

1 Like

Thanks Stephen.

u-centre can be downloaded from here:



I’ve improved my reception greatly by a long length of hookup wire (20m) strung over the roof of the house. The wire is connected to the GPS external antenna socket (centre connection).

I can now get green signals from the sats with the GPS unit inside the house.

Now I can start exploring Aidan’s sketch and use the data rather than just view it.


hello can you help with this I able to connect the GPS module but I’m getting these values

how to resolve this issue

Looks like you’ve set the wrong baud rate on your serial monitor - it’s surprising it sent back anything clear at the beginning (though maybe you edited the sketch).

Try setting your baud rate to 115200 (look more closely at the sketch in the tutorial).