Hackaday Dictionary: The Global Positioning System (GPS)

One of the fundamental technologies of modern gadgets is the Global Positioning System (GPS). Using signals from satellites orbiting the earth, a GPS receiver can pin down its location with remarkable accuracy: the latest generation of Civilian Navigation Signals (CNAV) sent by the US GPS system has an accuracy of less than half a meter (about 3 feet). These signals also contain the time, accurate to within milliseconds, which makes it perfect for off-line dataloggers and systems that require very accurate timing. That’s a powerful combination that has made GPS one of the main technologies behind the mobile revolution, because it lets gadgets know where (and when) they are.

The Origin of GPS

Transit 2A being readied for launch

The idea of GPS dates back a long way. The very first GPS system went live in 1964: using five satellites, the TRANSIT system was created by the US Navy to help Polaris missile subs navigate. The modern GPS system was developed starting in 1973, and went live with the first satellites in 1978. Although the military built and ran these systems (the US Air Force now runs the GPS system) they were designed to be used by civilians as well as the military. The first civilian handheld GPS receiver was the Magellan NAV 1000, sold in 1989 for a cool $3000. Initially, the civilian signals were encrypted using a system called Selective Availability (SA) that restricted their accuracy for civilian users, but this was removed in 2000 after a Korean airliner wandered into Russian airspace thanks to a faulty navigation system and was shot down.

Over the years since, the GPS system has been upgraded repeatedly to replace old satellites and add new signals and technologies. Now, the GPS system is composed of 24 active satellites (and a few spares), 11 of which are the latest generation models (called Block IIF). The next generation of them is due to be launched starting in 2016.

The US is no longer the only game in town, though: the Russians have created their own system (called GLONASS) which has 24 satellites. The Chinese are also rolling out their own navigation system called BeiDou, which currently has 10 satellites in orbit. The European Union is also building another system called Galileo, which will offer a similar location service.

This is a bonus for users: by using multiple GPS systems, you can pin down the location even more accurately, or still navigate if one is not available. Many modern GPS receivers can use both the GPS and GLONASS networks, and ones that use the other networks will be coming out soon, because they all work in much the same way: by measuring the time the signal takes to reach the receiver.

How GPS Works

The constellation of GPS satellites in orbit. From Wikipedia

The modern GPS system sends out a number of signals on different frequencies for different users and redundancy, but they all work on the same basic principle. The original signals were on two frequencies (L1 at 1575.42MHz, and L2, at 1227.6MHz) but other frequencies (L3 at 1381.05MHz, L4 at 1379.913MHz and L5 at 1176.45MHz) have been added since. These newer ones are used for things like analyzing the atmosphere to see how that affects the signal, further increasing the accuracy on devices that can receive them. Most single-chip systems only use the L1 signal.

Each satellite encodes streams of data into these signals, created from an onboard atomic clock and an individual code number for each satellite. This encoding creates a pseudo-random stream of data: it looks random, unless you know the code numbers for each satellite (called the gold code). With this, you can decode the various streams of data, which include the Coarse/Acquisition (C/A) stream, the L1 Civilian (L1C) and the Military (M) stream. Each of these streams of data contains about 50 bits per second of data. As the name suggests, the C/A stream is a short, frequently repeated batch of data for coarse navigation. The other streams contain more detailed data that allows for more precise location, but which takes longer to receive. These streams contain a lot of data, but the most useful part is the time, taken from the very accurate atomic clock onboard the satellite. The GPS receiver uses this precise time data to determine the location by looking at the difference between the signals of several satellites.

If you know the distance to 3 GPS satellites, you can calculate your location. from Wikipedia

Imagine this scenario: one GPS satellite is overhead, about 12,000 miles above you. Another is lower on the horizon from your point of view, meaning it is in another orbit and is further away: it could be up to 30,000 miles away. The signal from the horizon satellite will have further to travel, so it will take longer to reach you. If you know that both satellites have clocks that are set at the same time, you can determine the distance between the two satellites by measuring the difference between the time signals the two send. The difference will be small (less than 90 milliseconds), but it is measurable. Add in a third satellite in another location, and you’ve got another distance, forming a triangle. The receiver also knows the orbit of the satellites (called the ephemeris), so by combining the time and the distance between at least three satellites, it can work out its location. Add in a fourth satellite to provide more data and it can also calculate its altitude.

The signals from the GPS satellites also contain lots of other data, such as the updated ephemeris for all of the satellites, and information on how the atmosphere is affecting the signals. The GPS receiver receives and stores this data, using it to update its list of satellites. That’s why a GPS receiver that hasn’t been used for some time often takes a long time to fix the location (called a cold fix): if there have been new satellites launches or other changes it doesn’t know about, it can take some time to spot the signals and capture the new info.

These days, all of this complex signal processing and mathematics is usually wrapped up into a single chip: a GPS receiver that receives the signals, processes them and runs the numbers. How many satellites they can keep track of at any one time depends on the type, but a receiver that can keep track of a lot will be better placed to keep figuring out the location as satellites drop below the horizon, and new ones come into view. The motion of the satellites also changes the frequency (because of the doppler effect), so a receiver may need to listen on multiple frequencies to pick up satellites that are moving towards and away from the receiver. The ability to track an individual signal is called a channel, and most modern receivers have lots of these: the Mediatek MTK3339 GPS chip on the Adafruit Ultimate GPS Breakout board, for instance, has 66 channels, so it can track multiple satellites on multiple frequencies.

The end result of all of this is that the GPS receiver finds the location, and then feeds this out to the device. For most GPS chips, this is sent in the form of a serial output that sends the data in a format called NMEA 0183 (NMEA means the National Marine Electronics Association, who set standards for electronic systems on ships). This data can contain the current time, location, speed and other information, sent in plain text. Information on the signal strength of the various satellites is also sent, so the device processing the data can display it.

How To Use GPS

The Adafruit Ultimate GPS Breakout Board

The easiest way to add GPS to a device you are building is to add in a GPS package. These include the antenna, the receiver and enough smarts to do the calculations. You simply power the chip, give it a view of the sky, and it outputs the time, location and other information. Thanks to the years of development on GPS and mobile devices, these are cheap: Adafruit offers a breakout board that includes the Mediatek MTK3339 GPS chip for less than $40. Other similar devices are available from Sparkfun, who also have a good guide to the different types. These devices have a built-in antenna, but they are small and may not receive the signals well. For better performance, add an external antenna that can receive more of these weak signals.

The particularly masochistic among you might want to try building your own GPS receiver. It is possible, although it does require some expensive equipment. You will need a Software Defined Radio (SDR) that can receive the 1.5GHz frequency, and some software to decode the signals. In the video below, [Taroz] is using a BladeRF SDR and the GNSS-SDRLIB software that he wrote.

64 thoughts on “Hackaday Dictionary: The Global Positioning System (GPS)”

Great article! However the title is misleading. GPS is A positioning system hence the sentence ‘ by using multiple GPS systems’ doesn’t make sense. rather one would say GNSS or Global Navigation Satellite System, which will cover GPS, GLONASS BeiDou and Galileo.
In short – GPS is a GNSS.. It just happens to be the most well-known of them

‘GPS system’ also says ‘system,’ twice, Global Positioning System System. And that’s frowned upon by purists.

Also, saying ” has an accuracy of less than half a meter (about 3 feet).” make people think 3 feet is half a meter, when in fact 3 feet is 1 (in reality 0.91) meter, half a meter would be near to 1.6 feet.

And this brings me to something I’m wondering about, how come nobody says yards anymore? It’s all feet then the next step is mile or something, and it’s especially odd since so many people are into sports where they have yard lines. And yet whenever people on the net or the news speak of length/distance it’s feet and miles, and not yards.
Did somebody copyright the word yard?

Many of the people into sports with yard lines, like other people NOT into those sports, have little need to know what a yard actually is, and little feel for what it is. I deal with many educated people in technical fields that would be hard pressed to estimate even an inch, a foot, a meter, or a millimeter and be within 50%, much less a yard, and I would imagine that they are typical of the general population. I have known several that didn’t even know that a yard is three feet (ok, really 36 inches), much less that an inch is defined in terms of metric length (25.4mm by definition).

The yard isn’t in most people daily life like the foot is, so it isn’t the word that would come to mind first.

But there was a time where the use of yard was much more common though. But perhaps it is because watching sports on TV isn’t the same as actually seeing yards on a field. And perhaps at one time people walked more and were more used to using it too, and it was used for measuring various items sold too, like rope and fabric and whatnot, and that seems less in use today too, people buy stuff ready-made.

But I’m just throwing a wild guess out there of course.For all I know it’s more about fads.

While we are on unused units of measurement, why is the kip only used by engineers. it seems more convent to use a unit that is defined as 1000 pounds (kip) for measuring heavy things instead of using a unit defined as 2000 pounds (ton).

We use yards in the UK. When we’re not using metric. Imperial still persists, despite nobody official using it for anything, and it not being taught in schools.

Generally we’d use inches if something is on the scale of inches, or centimetres if we’re being more exact, or something’s small. A yard is 3 feet. A metre is “a yard, three inch, and a quarter”, according to my Granddad. I realise the ISO doesn’t define it like that.

Also we all know our weight in stones, which is 14 lbs. And over here the “pound sign” is called a “hash”, probably because the actual pound sign is £, as in currency.

GPS is not A system. The american GPS initiative do have a name; NAVSTAR (Navigation System Using Timing and Ranging)
It’s just commonly referred to as “GPS” since it was the first one.
(I guess the FORD model-T also were just referred to as “The Car” back in the days)

I’d just like to add my 0.02: GPS is awesome! But what happens when you have no electricity or batteries or the satellites are blocked with something?

I was born in the early 80s and actually remember going long trips with nothing but a major road map, occasionally getting more detailed ‘local’ maps when going off major roads. Most of the maps also had landmarks, terrain maps, and latitude/longitude grids.

Phones aren’t really valuabe or liquid.. They couldn’t get another phone with what they’d make selling their current and what they originally paid probably had no potential for any real investment or food-stock.. GPS and communications was probably strategically smarter given the economic disproportion with that level of capital..

I was taking the piss out of the standard, ludicrous Daily Mail line “they all seem to have smartphones”. As if that means anything. Particularly when it’s not poverty you’re fleeing from, but the complete destruction of your home by bombs, and the likelihood of your family being killed. They don’t live in improvised tents cos they couldn’t afford a home in the country they fled from!

The timing accuracy of a GPS receiver is (and has to be!) in the nanoseconds range, not milliseconds which would be 6 orders of magnitude worse! Since the speed of light is about a foot/ns, a sub-meter positional accuracy implies a sub-3ns timing accuracy.

I’ve worked on the Network Time Protocol for about 20 years, almost all of the current Stratum 1 servers use GPS timing receivers as their local reference.

You can buy a Sure GPS evaluation board for something like $40, it has been measured to provide around 10-20 ns timing accuracy:

“This is a bonus for users: by using multiple GPS systems, you can pin down the location even more accurately, or still navigate if one is not available. Many modern GPS receivers can use both the GPS and GLONASS networks, and ones that use the other networks will be coming out soon, because they all work in much the same way: by measuring the time the signal takes to reach the receiver. ”

Can these receivers do both at the same time to provide two separate positions to create a blended solution? I doubt you can intermix other than what I asked because the clocks and reference would be different between types of satellites.

I think them not being communist is why the country is so attractive to shady capitalist strategists and as of late US IT and STEM.. Spiking taxes and regulations to the point most of your national industry high-steps to foreign soil within a twenty-year span is suggest communism, though..

You could average the positions of multiple receivers. Not sure if that average would be better if one of the receivers happened to be dead on though. You would probably want to throw in some sort of calibrated reference math that would factor in past positions and their accuracy and ignore any large, unexpected deviations.
Filters, math, science words and stuff.

I believe they can. Paul McWhorter (https://www.youtube.com/user/mcwhorpj) has a series of videos on youtube working with Arduino and GPS and in one of the earlier videos in the series he goes into trimming down what systems his project responds to.

Find the ‘Build a GPS tracker’ project series and it should be in one of the earlier videos in the series.

However the question is if it will ever be finished… Unlike Russia, China or the US, EU is not one nation, different interests of different countries makes deciding about spending big bucks on useful stuff pretty difficult…
Funny how easy it is to decide to pay for bullshit nobody really needs :P

Just watched a special on TV about this, the Russians had found the black boxes about a month after the crash, but kept them secret until the early 90s. Once the investigation team was able to get the flight data, they determined that the pilots forgot to set the autopilot to use the Ins, and it was set on constant heading the whole time.

As I have understood it it was mainly two things that influenced removing the SA interference in 2000. One was that it had already been temporarily lessened during the Gulf War to allow civilian GPS receivers to be used by the coalition forces. The other one of course that it practically was turned useless due to the practically complete DGPS coverage over USA. An adversary simply would get even better precision that GPS would have had even without SA.

I say interference rather encryption as it is a pseudo random noise with parameters known only to receivers with keys (and yes, I see I contradict myself a bit).

i was going to comment the same thing… SA was basically a clock jitter error signal added to the GPS signal in order to cause it to be less accurate, thus decreasing the apparent accuracy of the location calculations. At least that’s how I understood how it worked…

If you look at the data stream coming out of a GPS, there is “Fix Type” field. A fix with only 3 visible sats result in a 2D fix, while 4 or more sats result in a 3D fix. Some receivers will not transition out of initial acquisition mode to report the first fix until more than 3 sats have been found.
One of the old GPS units had a bug where on power up with 3 sats, it would occasionally give a fix on the wrong one of the two intersections. The customer was really unhappy because their service trucks were showing up 750 miles away from reality, often in the middle of a large body of water.

True, third sphere is needed. The solution is WGS-84 spheroid. In laymans terms assuming, you are receiving at the surface of sea (or predetermined height of GPS antenna). That was a standard setting to use on a common GPS receiver on a ship (probably from start on, for sure some 15 years ago).

Having done surveying work with an N-RTK rover (networked real time kinematic), I must say I am really impressed with the level of absolute precision that can be achieved with systems mainly based on GNSS.

Here in Sweden a lot (most?) of the surveying previously done with total stations (and before that theodolites and steel tape) are now done with with L1+L2 GPS+GLONASS. The receivers get position corrections over 3G broadband or in a pinch GSM/GPRS. The corrections comes from from a server using a network of reference stations to calculate corrections for a virtual reference station, positioned right where you connected (for better or worse, there are not too many providers). I have seen that these systems are rather common today.

In addition you often feed the instrument not only with an ellipsoid, geoid, projection and reference system, but also a residual error model, as you often work with a local reference system. Those often have deformations due to historical reasons. Before GNSS practically all measurements was relative, so large scale deformations in local systems usually went unnoticed. Absolute measurements required astronomical observation and was practically only done when establishing high order control networks.

The accuracy? Usually well within the centimeter when you visit a point the next day to verify your measurement (surveyors hate undetected errors), provided you know what you are doing. In fact in many cases an unadjusted bubble level on the GNSS pole would be a larger error.

There is a downside though: Vulnerability. What would happen if the satellites somehow became unavailable? Or the cell phone network? Or the servers? Or if you have really bad space weather? (I have experienced the last two ones.)

I had just spent the summer working with a surveyor. most of the work we did was taking measurements to try to make sense of the mess left by the older surveying measurements. I remember in one area there was a 16″ overlap between two property’s, because one was measured from one road and the other was measured from another road. a good part of the rest of the time was spent getting the GPS unit set up or waiting for a good signal. Any less than 12 satellites, and the tolerances were to bad for the system to work accurately.

Been there done that. But then again it is the difference of relative and absolute measurements. Now when it is so easy to do absolute measurements one will find a host of old errors.

Here is a true story from Sweden:

A municipality was going to migrate to the new national vertical reference system, for better compatibility with neighboring municipalities but probably also to be able to use GNSS receivers (and a geoid model) instead of levels for some less demanding vertical measurements (leveling still is far better when you need accuracy though).

The preparatory work included leveling a large number of benchmarks, usually along roads. Unfortunately they seemed to end up with a number of areas with small internal deformations but that simply did not fit with each other. Glacial re-bound differences between benchmarks of different age could be ruled out as the differences were way too large (even though the glacial rebound can be as large as about half a centimeter per year in parts of Sweden).

After a lot of looking through the data the finally decided to have a looked at the archived survey protocols (some of them being from early 1900’s). It turned out the original leveling traverses had started from the surface level of a lake. Space those traverses a few months or years apart and you get the idea.

My experience with the GPS though is about 5 minutes wait for a rough fix, connect to the server, wait another minute or two for the final fix and then go. The big issue here seemed to be PDOP (Dilution of Precision, Position, kind of an index of how well spread the satellites are on the sky) rather than number of satellites, it seem PDOP > 4 should be avoided. I understand this differ between receivers though. Another interesting thing is how much harder it get at higher latitudes and how much easier it is to get good accuracy in the morning. I kind of have the idea that the ionosphere would get progressively more “disturbed” during the day as it is exposed to the sun.

There is one annoying thing with L1+L2 surveying receivers though. As you do not have keys for the encrypted channel, you will have to get the accuracy through the black magic of phase measurements. That is the reason for the wait for the rough fix. However, if you would lose one or both of the signals for only a fraction of a second, the receiver have to start all over. This quickly gets annoying in high coniferous forest, in particular on windy days and/or if the trees are wet or snow covered. Heavy enough snowfall though will make it near impossible to get a fix at all though.

With regards to your work on the Rover, you mentioned the GNSS but you didn’t mention the S Band. Currently, studying S Band communication systems, and see potential for two way communication back door that could be used to transmit data and receive data, but unknown to what degree it would work here on earth as a practical tool. Motorola, being the prime contract holder, held the primary research in this area. Query: Is it possible to mod a satellite phone or a Garmin (or something of the like) to operate on a S-Band frequency then act as a two way communication device allowing for say a really slow internet connection or a quick text message device? Theory: S Band communication could be utilized by piggy backing on currently used signals, regardless of carrier and origin or destination to target end receiver based on directed coordinates in the programming. Problems: Convincing a Garmin to exist in more than one place at one time? Maybe convincing a SAT phone it is in many places at one time? For a company, this would solve world communication issues in a nutshell for internal secure communication because the odds of having a signal looked at as a back ground carrier signal would be like white noise to the non sequenced receiver. The security would actually be pretty good! And if signals were intercepted, they would be naturally encrypted leaving the data scrambled anyway because the garmin or sat phone would be self encrypting the signal receiver and sending signal. So it would be like having two crystals communicating with each other without anyone else eaves dropping. Trying to research S Band communications used on original moon rover because the configuration didn’t work very well. The lunar module had to communicate to earth, while the lunar rover communicated to the module with the module only having video due to sound lag time. Interesting dilemma. Further confounding the matter, the time delays between earth and the moon, but more importantly, the live video streams NASA produces show real time imagery. Imagery that they sometimes cut. The live feed often shows things that could be fake, but I’d be more curious, if not fake, why hide or deny it? Just waiting to get my telescope up and looking because video feeds show some erratic strange live imagery that requires visual confirmation. Seeking S Band as a base starting point because GNSS was founded on Motorola’s base research into S Band. Curious: If the Mars Rover is supposed to be defunct after three years due to dust covering it, who is cleaning it? The Canadian Space Agency could not answer this question. It is SPOTLESS. It shines like someone is maintaining it lovingly. If the Mars rover is to be believed as a credible witness, there are structures and statues on Mars! There are people living up there! So again, are our communications being scrambled? Are we being manipulated by fake imagery and nonsense? Or are we looking at a deliberate designed manipulation to just mess with us? Arthur C Clarke saw something up there, he must have. Something that freaked him out to want to write 2001 a Space Odyssey. Arthur C. Clarke is the Great Grandfather of our modern satellite tech age. Motorola is the Grandfather of the modern communication systems. Ma Bell and Baby Bell didn’t really contribute too much to this discussion but the TELEX systems were and are marvelous tools left over for a reductionist tech movement. All I’m saying is that there are more questions than answers on the frequencies and to fact check them, we need stable open communication systems with little to no filters. If we hope to learn anything, we need to see as clearly as possible going forward. Mr. Magoo doesn’t see very clearly, we shouldn’t follow Mr. Magoo.

As I understand it GPS works because the satellites are in space and kept in a very accurate and known location (not fixed location). I have understood they use ground stations to adjust their positions in space.
Is this true?
If the ground stations stopped doing their work (maybe loss of power though global doomsday occurrence) how long would it be before the GPS started drifting and no longer could be depended on?
OK I confess I am writing a fiction book where this is part of it.