empowering creative people

How GPS Receivers work

GPS is accurate and handy to use, so much so that we rely on it more and more every day. It's not often we take the time to learn how it works. The idea of GPS refers to a Global Positioning System; a collection of satellites in orbit above the Earth that transmit location data down to our devices. As hobbyists, we can get GPS modules that will read and interpret this data for us! They're known as GPS receivers, and they are used everywhere, like your phone, tablet, and other electronic devices. GPS receivers will relay a satellite's location data directly to a microcontroller in the form of serial data strings, which we can break down into relevant bite-sized chunks of data about where we are and how we are moving!

A diagram showing how the interection of GPS satellite coverage enables us to get a lock.Satellites everywhere!

There are currently hundreds of satellites orbiting the Earth, with more and more launched every year. GPS satellites are only a small portion of these, usually working together in groups of at least 12, each satellite is on one of 6 orbital planes around the Earth (Note: We call a group of satellites a constellation). There are a bunch of GPS constellations available nowadays; with China, Europe, and Russia all having their dedicated systems. They work together to transmit location data over the radio frequencies around 1.5 GHz. There is a maximum of 12 active satellites in the sky above your head right now! Luckily, our GPS receiver only needs to see 4 of them to find an accurate position. We call the process of receiving location data from 4 satellites and determining an accurate position getting a lock or fix.

Timing is crucial!

Onboard every GPS Satellite is an extremely accurate Atomic Clock. The clock is critical to the entire system, allowing the constellation to share synchronized time information. These synchronized atomic clocks are used to send a timestamp along with location data. The four satellites each relay one accurate measurement to our device, and we cross-reference these to get a precise location. The four measures we use are Latitude, Longitude, Altitude and Time. Along with the speed of light and some information about ionospheric interference we extrapolate location data to an accuracy of fewer than 10 meters! If it were plausible to have atomic clocks onboard all of our receivers, we would only need three satellites to get a fix on our position as the time data would be synchronized!

To cross reference this information and get our location, we use a mathematical process known as trilateration, not to be confused with triangulation. It's an entirely different (and cooler) method of locating a device. If you're into those calculations (circles, square roots and letters) check them out here. Trilateration uses the four strings of information from each of the satellites (we call these NMEA sentences). NMEA stands for National Marine Electronics Association, which is the USA based organization that sets the standards for the umbrella term that is marine communication. Trilateration is how we get an accurate position from our four measurements (seriously take a look at the link above, it's nifty!).

NMEA Sentences

There are a variety of different 'languages' of NMEA sentences; we'll be able to tell what we see by the first five letters of the sentence. The regular ones we look out for are GPGGA and GPRMC. Most modules will allow you to filter out what you will receive, making it a lot easier to understand the data you get. They are both delivered and read as comma separated values from the receiver.

Let's take a look at a breakdown of a GPGGA NMEA Sentence:

A diagram showing a GPGGA packet broken down into each section and a definition of each section

You can see more parsing information on the different NMEA sentence types here.

The Almanac

There are two essential datasets that the GPS system relies upon, the Almanac data and Ephemeris data. The Almanac is the entire set of data shared amongst all the GPS satellites. It contains orbit and status information about each satellite in the constellation as well as Ionospheric models and GPS to UTC conversion that allows for the position based data corrections. That's getting a little deep into the details of the system, though, all you need to know is that it takes 12.5 minutes for your GPS receiver to obtain the entire Almanac from a constellation of satellites. Ephemeris data is a subset of the Almanac and is as crucial, but takes far less time to be relayed to the device. This information is only the Orbital/position information of a group of satellites and can be transferred in just on 30 seconds.

Start Times

Have you heard of start times of a GPS receiver? Well, some GPS modules use a battery or capacitor to maintain enough power to the module to retain the almanac so they can easily know where they are whenever they need to. If that information becomes invalid (i.e. you move too far without the GPS knowing, or the battery runs out), the entire almanac might need to be replaced! There are three modes (seen on datasheets of GPS receivers), and they are Cold, Warm and Hot starts. They are a measure of the TTFF or Time to first fix of the module. As you'd imagine, it's how long the module takes to retrieve a lock from a dead start. For a cold start, manufacturers typically state a 15 minute cold start time (Remember it takes 12.5 minutes to relay the entire Almanac). A warm start will usually take around 30 seconds, (as the module only needs to download ephemeris data). For a hot start, the TTFF is equal to the TTSF or time to subsequent fix, as all of the data is valid and nothing is required to get a fix other than the NMEA sentences.

A table showing the start types (Cold, Warm, Hot) for GPS modules and their approximate time requirement

GPS that we use every day can also leverage ground-based networks to provide increased accuracy to your receiver. It's commonly known as assisted GPS, and as the ground-based systems entirely circumvent the ionospheric corrections that satellite GPS requires, the accuracy is greatly increased!

The Adafruit Ultimate GPS Breakout ModuleWhere to now?

What does all of this information mean for us? Well, now we understand what our receivers need to do, and we know what data we can get from NMEA sentences. We've got a whole bunch of GPS receivers available that allow you to interface your project with a receiver and receive real-time location data. Each has it's own update rate (measured in Hz, or cycles per second), antenna sensitivity and data logging capabilities. Take a look at the selection here, all of the relevant datasheets are available in the product information!

We're going to take a closer look at using Adafruit's GPS Library alongside their Ultimate GPS Breakout. It's got a 10Hz receiver, 16 hours worth of onboard logging data storage and has an onboard antenna that has a -165bBi sensitivity. It's a pretty impressive module, and Adafruit's support is extremely comprehensive. For this detailed guide on setting up GPS on an Arduino based project stay posted! We hope this article has cleared up any questions you had about GPS behind the scenes! Let us know in the comments how you liked it!

GPS is accurate and handy to use, so much so that we rely on it more and more every day. It's not often we take the time to l...

Have a question? Ask the Author of this guide today!