Introduction: Intro to GPS With Microcontrollers

Once the purview of strictly military operations, GPS has become a regular part of modern living and in relatively short time! Who wouldn't want want to know when and where they are anywhere on the planet? It's a science fiction dream brought into reality, one now so woven into our lives it seems almost trivial. The demand for precise positional data built into planes, ships, cars, and now nearly every modern cellular phone means a few things for the average hobbyist: smaller, higher quality, lower cost, easier to use, and better documented GPS receivers available for purchase!

In this Instructable, we'll discuss the Global Positioning System as a whole and build a simple circuit for communicating with a receiver with the Intel Edison. This setup will allow us access to positional data, which will open the possibility for more advanced interpretation and enable real-world applications.

Step 1: What Is GPS?

Brief History

The roots of the Global Positioning System go back to the height of the Cold War when advancing space technology was a high priority for the American government. While initially conceived for providing a strategic military advantage for the U.S. war machine and (among other things) the need to precisely guide Intercontinental Ballistic Missiles toward their far off targets, it was eventually opened up to civilian use in the 90s (albeit at an intentionally degraded precision for non-military receivers). Eventually the full accuracy afforded by the satellites was opened to the public in spring of 2000.

The System as we use it today is fairly modern network, with true global coverage only coming online within the middle of the last decade. It is not the only satellite system capable of providing positional data however, the Russian GLONASS also came online within a similar time frame as the GPS. Due to political and financial constraints, adoption of GLONASS receivers has been less prevalent. The EU, China, Japan, and India are also developing similar satellite networks of regional use, although GLONASS is the only comparable network of global coverage.

How Does it Work?

Each satellite has a stable atomic clock on board for broadcasting accurate time data. Each satellite continuously broadcasts its time position data which can then be processed by a receiver. A receiver must have at least four satellites in range to have an accurate "lock" on its location (three points of data for location, and one for time reference). The actual work of the receiver boils down to computing the signal delays of the transmissions and converting this into easy-to-use data for the user. This is, of course, a vast simplification of the system; the reality of the inner workings of GPS are quite complex and very impressive. Thankfully, it is quite easy and of low cost to interface with a basic receiver from an end user's standpoint.

Step 2: GPS Modules

Due to the intense market demand, there are a wide variety of GPS receivers available from many manufactures, often coming as an all-in-one shielded package alongside a basic ceramic antenna. Which module is right for your next electronic project? Here are some things to consider when choosing which to buy:

Choosing the Right Receiver

Power Considerations:

Like most modern electronic components, GPS receiver modules are following the standard of running on ever lower voltages with 3.3V being most common. Most projects will only be receiving data, making 3.3V and acceptable voltage for a logic high bit to your 3.3 or 5V system. Many receivers allow a modest amount of configuration depending on how you'd prefer the module to transmit its packets, so be aware of the system voltage. A single 1K resistor on your 5V processor's Tx line to the module's Rx line should be sufficient. Most receivers are also quite power efficient, usually drawing well below 100 mAh and often in the sub 50 mAh range during steady reception, making them practical for most battery powered designs.


Many common modules and breakout boards often come with a built-in ceramic patch antenna. These tiny beige-ish blocks with a conductive blob in their centers are sufficient for most GPS reception projects, especially if you're wanting compact size. Some modules come with pre-soldered SMA or wee u.fl connectors on board for connection to an external antenna, which is especially useful if you wish to mount your receiver inside a hard case.

Update Rate:

Normally you'll find modules with a 1 Hz update rate, providing a sufficiently steady stream of data for most slow moving projects. Newer modules also offer 5 Hz or 10 Hz+ data rates, but this is really only useful for fast moving projects like quadrotors zipping around a course. An update rate in excess of 1 Hz is also potentially overwhelming for smaller micros with minimal amounts of RAM.

Bonus Features:

Some modules include a built-in super capacitor or battery for backup power during power cycling, allowing for a faster time-to-first-fix. The MTK3339 module I'm using also has a small data-logging capability, which is interesting for a brief recording experiment, but less useful for long term data collection and storage.

Simple Connection Circuit:

I'll be discussing the actual data we're receiving from the GPS module on the following steps. For my own testing purposes, I'll be using Adafruit's Ultimate GPS breakout board and an Intel Edison with the Arduino Breakout. The board will accept either 3.3 or 5 volts as power, and has handy standard 2.54mm pinout for attaching to a breadboard or female jumper wires. As you can see from the simple connection diagram above, I'm only connect three pins on the module: power to 5 volts, ground to ground, and the module's Tx line to the Rx of the Edison's UART, which is broken out to pin 0 on the Arduino board. It's as easy at that! There are other pins broken out for configuring the module, checking the satellite lock, power control, and a steady pulse output, but the single Tx to Rx connection is all you'll need to begin receiving GPS data.

GPS Receiver Links:

Here is the exact module that I'm using from Adafruit. Sparkfun and Seeedstudio also offer a selection of different receivers as well.

Step 3: Deciphering NMEA Protocols

How Are We Receiving Data?

Most receivers you come across will transmit informal over a simple serial data connection. Often it is encoded in plain ASCII characters, but there are other compact binary formats available from some modules for higher data rates. We'll be looking at a regular ASCII feed since it is much easier to interpret.The data we're receiving from the GPS module is formatted according to NMEA 0183 standard.

The NMEA Protocol

The National Marine Electronics Association has a standard for many different ship-board electrical devices. The NMEA 0183 standard is useful for GPS receivers to output since it is a clear, and relatively slow (typically 4800 or 9600 baud) protocol that is palatable for any modern microcontroller with a UART to handle. Let's look at a sample block of four string output by the MTK3339 module. I've spaced out the string above to make it clearer to read, but the raw stream has no spaces after commas and a single set of carriage return and line feed characters at the end of each string (strings begin with a "$" character).


Global Positioning Active Satellites - This string will tell us the number of satellites that are currently in range of the module, the type of fix (2D or 3D) and the precision of the signal.


Global Positioning Recommended Minimum Coordinates - This is the meat of the data strings, containing the time of fix, if the receiver is ok, latitude, longitude, speed (in knots), fix type.


Global Positioning Course Over Ground (Track Good) - This contains more data regarding ground speed in knots and kilometers per hour.


Global Positioning System Fix Data - full coordinate data containing everything in the RMC string, in addition to extra accuracy data as well as altitude. We'll break this string down more thoroughly on the next step.

Step 4: Manually Parsing GPS Data

Let's spill the guts of this GPGGA string:

Sentence ID:$GPGGA (fix data)

UTC Time:formatted as hhmmss.sss (hours, minutes, seconds, and milliseconds)

Latitude:formatted ddmm.mmmm (degrees, minutes)

N/S Indicator:N = North, S = South

Longitude: dddmm.mmmm

E/W Indicator:E = East, W = West

Position Fix:0 = Invalid, 1 = Valid SPS, 2 = Valid DGPS, 3 = Valid PPS

Satellites Used:satellites being used (0-12)


the horizontal dilution of precision (lower numbers are better; values greater than 10 suggest poor accuracy)

Altitude: atitude in meters according to WGS-84 ellipsoid

Altitude is kind of a funny thing when you get to down to specifying to what you're referencing the height of something. The "true" shape of the Earth is an ellipsoid shape (like a slightly squished sphere) bulging out at the equator. The ellipsoid is used in Geodesy at a mathmatical point of reference for the mean sea level accross the planet. Things are even more complicated if you want higher precision, which is where the Geoid comes into play, which accounts for the uneven gravitational effects the Earth has on it's surface.

Altitude Units: M = Meters

Geoid Seperation: (Geoid seperation in meters according to WGS-84 ellipsoid)

Seperation Units:M = Meters

DGPS Age:age of DGPS data in seconds

DGPS Station ID:basic identification number

Differential GPS was created as to improve the purposefully degraded civilian GPS signal that was broadcast publicly in the 1990s. The ground based network of radio transmitters proved very useful in aiding navigation for non military users, even after the non-degraded signal was released to the public in 2000, allowing accuracy down to <1 meter.

Checksum:used forlow level error handling

Let's talk about how we can easily extract all this data on the following step.

Step 5: GPS Libraries

There's no need to fret about muddling about with strings and trying to convert all this data into neat individual variables! The good open source citizens of the internet have provided libraries for doing just that. Here are two that I recommend:


Adafruit provides an awesome library for playing around with GPS data. By default, their code relies on AVR specific registers for calling an interrupt routine function for gathering data from the GPS, so if you're using an Edison board, you'll need to remove this and poll it manually. Additionally, it's important to note that the UART on the Arduino Edison BoB is Serial1 (Serial is the direct COM link to your computer).


A wonderfully lightweight library that takes a serial stream (connected to a GPS of course) as an object, and then converts it into nice little packages. Getting your latitude is as simple as asking for gps.location.rawLat().deg, or your speed withgps.speed.mph(). You can check out the full feature list through the link above.


Although it's not a library, check out this breakdown the Haversine Formula (a means of calculating the distance between two geodetic coordinates!)

Step 6: DIY GPS Applications

I hope you've found this a pleasant and practical introduction to the world of GPS. Here are some GPS related projects to put these wondrous radio receivers to use!

Explore the out doors with your own DIY GPS handheld and discover the world of geocaching.

Build an inverse treasure chest that unlocks when you bring it to the right coordinates with your own reverse geocache.

Why not add a GPS to a rover and throw your hat into the Sparkfun Autonomous Vehicle Competition?

You could use a regular RTC for your next clock project, but why not use the time data from the GPS to sync local time. Your clock will be virtually bound to a hyperaccurate atomic clock orbiting the planet at thousands of miles per hour, wouldn't that make your project, well, objectively better? The answer is yes.


David_Dragino (author)2016-06-19

hi all,there is a LoRa/GPS HAT,it applies to projects related to GPS, Lora, and RaspberryPi,you can find it here:

SameerD3 (author)2016-04-04

hi,can i use mini breakout board for this?

Mr. E (author)2016-01-17

Excellent information clear and well presented !

Fadhil35 (author)2015-10-27

How much money you spend for this project ?

achamberlain3 (author)Fadhil352015-12-29

I'm a little late to this but it seems to me while you can get some really cheap GPS modules, $40 is about the sweet spot. For example adafruit sells a $40 module and another one I used for the RaspBerry Pi that connects over USB:

nmitchell (author)2015-10-20

For the update rate, what rough range of speeds would you define for "slow moving" vs "fast moving"?

Aleator777 (author)nmitchell2015-10-20

It really depends on your application, but assuming a GPS accuracy of 15 feet, you'll probably want an update rate that can stay ahead of your object's velocity. Let's say you had a mini autonomous car that drove 15 miles per hour and the update rate was only 1Hz, the car could travel up to 22 feet in that second and its navigation would be choppy since it would have old data. With a GPS of the same accuracy at 5Hz, the car could go up to 50MPH without outpacing the update rate of the GPS. I hope that helps!

taifur (author)2015-09-17

Excellent instructables

Aleator777 (author)taifur2015-10-08

Thank you!

Samuel Raumin (author)2015-07-12

Which is better...

Intel Galileo


Intel Edison?

I have a Galileo and I like it.... it is a powerful version of the Arduino.

Aleator777 (author)Samuel Raumin2015-10-08

The Galileo is better for real-time control solutions like an Arduino. The Edison is much more powerful x86 system that has built-in Bluetooth and WiFi radios for connectivity in a small package. The Edison is more suitable for when you need a tiny Linux computer. The Galileo is more suitable for when you need a supercharged microcontroller.

taifur (author)Samuel Raumin2015-09-17

I think Edison is better

d7oome (author)2015-07-09

yaaaah ,I'll try to make it

moisoiu (author)2015-05-18

Hello, can you please give me more details how can I use adaFruit library for arduino edison for parsing the info ? More exactly what should I do or what reffers here here? =>>> if you're using an Edison board, you'll need to remove this and poll it manually

Thanks and best regards

einyaa (author)2015-05-05

A great instructable with an in-depth string explanation. Thanks.

Aleator777 (author)einyaa2015-05-09


nooneheretoday (author)2015-05-05

awsome job and very interesting. . thanks


Thank you!

jakobro (author)2015-05-05

lol so hard but interesting

Aleator777 (author)jakobro2015-05-09

I'm glad you enjoyed. It's easy to get started!

Blue Hawaii (author)2015-05-07

Wow, thanks for all that info! I just created several more wrinkles in my brain!

Aleator777 (author)Blue Hawaii2015-05-09

Thank you. Great to hear!

mjanich (author)2015-05-07

Another Intel ad?

Raitis (author)mjanich2015-05-08

I really see no issue here - these are decent basics for a person new to this and can surely answer some questions and lessen frustration.

ptkrf (author)mjanich2015-05-07

don't act surprised. Judging from the not-so-new "intel loT" category, they are one of major sponsors of this site. and "sponsored ad" banner in top right corner only furthers my belief in that...

rien.brand (author)2015-05-07

Hi, I have made a application that use GPS speed to control the speed of a potato planting machine, but i have some problems with the accuracy by very low speed (700 mtr/hour), can I receive help on this place?



MarcoM6 (author)rien.brand2015-05-08

By using a traditional GPS receiver, you wouldn't get a better precision than ~2 to 3 meters (under best conditions). You have to combine the GPS with a reference station (D-GPS). There are commercial products available (e.g. "piksi") - or you could even build a D-GPS solution by yourself (that's a bit more complicated...)

Raitis (author)MarcoM62015-05-08

There's also RTK-GPS which apparently is doable with Arduino GPS modules.

arduino_boy13 (author)2015-05-08

Did you know you can use this with the rasp. Pi? I use it for coordinates and speed. This is a good idea and I will be trying it later?

pallc (author)2015-05-07

Thanks for the overview and references. I just purchased the LinkSprite GPS Shield with SD Slot for Arduino V3 and have a Arduino Uno. I wanted the external antenna since I want to be able to custom make the antennas if needed for external vehicle mounting. Awesome timing! Pleasant to see in my email this morning. Thanks Aleator777!

Raitis (author)2015-05-06

Do you by chance have any experience with RTK-GPS?

About This Instructable




Bio: My name is DJ and I previously made electronic whatsits, 3D-printed thingamabobs, and laser-cut kajiggers for the Instructables Design Studio; now I build and repair ... More »
More by Aleator777:MiniSub ROVBasics of Thermal ImagingMiniature Autonomous Blimp
Add instructable to: