How GPS Works (I Think)
One thing for which you may thank the nuclear arms race is GPS. Did you know that? Nuclear missiles to get the ball rolling, then later the Russians, who shot down a Korean passenger jet for joyriding into their airspace (oops), which prompted Ronald Reagan to make GPS available to civilians. Not republican or Russian? I got you covered bro, Bill Clinton ordered that the mechanism that degraded GPS accuracy for civilians be disabled, the first GPS optimization hack.
As you can already tell I just spent some time on Wikipedia, plowing through the entire fifty-paged article on GPS plus a dozen other articles along the way, which is for most people tl;dr, so let me try to dumb it way down for you in case you’re fascinated by how your phone is able to figure out where you are by listening closely to outer space and thinking really hard about timing (I’ll save time for another article, it’s actually pretty complicated if you think about it). This is just to give you the gist of it and note that I don’t really know what I’m talking about, I’m not a physicist, engineer or mathematician, I’m just a guy who’s into phones reading wikipedia to you out loud and sort of summarizing with a little of my signature panache sprinkled on, want to get you thinking. If something within this grabs your attention and you want to know what it is rather than my interpretation of what it might be, look it up on wikipedia (ephemeris, general relativity and trilateration for example). This is just for those of you who sort of wonder what the hell that lock is all about. Here we go buddy:
There are a bunch of satellites cruising around earth continuously firing down chunks of information. The chunk includes the timestamp stamped by the satellite noting the very exact time the chunk was fired, the position of the satellite at that time and the satellite’s opinion on the orbits and positions of the other GPS satellites at that time.
Now your phone’s GPS receiver listens to these chunks flying down from all these satellites and, using what it knows to be the speed of light (the chunks’ velocity) and the current time to calculate the distance between itself and each one of those satellites, and with trilateration, it compares those distances and the positions of the satellites to reveal its own location by imagining spheres surrounding each satellite and overlapping each sphere at its determined distance from the satellite nucleus and wherever all of those spheres intersect (the more satellites and spheres the merrier), once your phone figures that out, voila, it has its position and can tell you all about it, all based on its position relative to each satellite relative to their positions over the earth.
Since we’re dealing with the real world which most consider to be three dimensional, you’d think three satellites would be enough to figure out the location. But the time, since we’re dealing with the speed of light and varying altitudes of GPS receivers, has to be super exact. For example, in order to produce its position within a thousand foot degree of accuracy, it has to nail the time right down to the microsecond (0.000001s) which it can do with less battery power using cell towers instead of satellites. So how does your phone know what time it is?
Once a fourth chunk-flinging satellite is in the mix, for a reason I cannot really dumb down any better than this, that’s enough satellites (and their overlapping, mutually-intersecting spheres, one of the two points of intersection being your phone) your phone needs to overhear arguing about what time it is in order to determine what time it really is down to ten nanoseconds, which is second only to the atomic clock in terms of our means to tell time.
And it is at that point that your phone gets its “lock.”
If this picture is funny to you, then you’re getting the gist of it (or already had the gist but read anyway):
To aid the identification of the point of intersection and to preserve that identification over time and change of distance between you and each individual satellite and their own change in distances relative to everything, and this is called GPS augmentation, if the GPS receiver already has a vague idea of its altitude, either because it’s a ship (and therefore at sea level) or because it’s getting tips by a barometer, that accelerates this process, which is why they put a barometer in some mobile devices including the Galaxy Nexus. A barometer is an instrument that measures atmospheric pressure. Though atmospheric pressure at a given altitude could be a lot stronger or weaker depending on entropy and the weather and whatever else, it does provide enough extra information to make a significant improvement in determining, and being able to continue determining, the time and location. You’ll probably have a barometer in your phone, like me, maybe a couple more phones down the line depending on how high a roller you are.
Other clues your phone has that help get these spheres lined up include cellular tower trilateration, same principles in play as with the satellites except with cell towers. The phone knows the position of the towers and the time they shoot their chunks. Because they are much much closer (I’m totally guessing here) to you than satellites in medium earth orbit, it takes a ridiculously extremely precise measurement of time on the towers and the phone in order to yield 500m accuracy.
What gives your phone a much better edge in determining its rough (say, 20m) location without the aid of the speed of light and spacetime is by being on the lookout for things whose location it can look up because companies like Google drove cars and flew cool airplanes around the world listening for home wifi access points, short-range and unique in what they are constantly transmitting. So Google already knows where the access point named “Newt’s not so bad I suppose” (my current one, I like to have fun with the names), and when your phone comes within range of my network, it asks Google where it is, Google says where it is, baddabing the phone knows where it is down to a practical level of accuracy for many applications without having to think that hard at all. And the less hard it thinks, the less battery juice it chugs. This helps your phone know its rough location all the time, and when you need to know your location down to a level of accuracy needed to know when to exit an actual superhighway, the information wifi location yields, plus the barometer if you’ve got one, gives your GPS receiver a big head start in getting a lock.
That is why collecting those wifi locations with the controversial Street View cars has been so damn valuable.
What about those satellites? Okay I’m going to do something that to my knowledge (probably because I use adblock) has never ever been done on MobilityDigest, I’m going to use an animated gif. Here’s what they sort of look like relative to the earth to try to help you conceptualize this:
Cool, right? My apologies if your little Windows Phone with its single core can’t handle the animated gif. 🙂
What about when you drive through a tunnel, how does your GPS device seem to sort of know where you are even though it can’t hear any satellites or goofily-named wifi access points? You Grateful Deadheads will appreciate this one (it’s my favorite Dead album), by means of dead reckoning. That’s when your phone takes its last known position relative to the previously-last known position to calculate speed and trajectory, then it just assumes (dead) that you’re still moving like that while in the tunnel, which you sort of are give or take most of the time. In addition to being able to offer you a vague location within the tunnel, it serves as yet another clue to figure out that spherical intersection once you exit the tunnel.
Another thing, mixed in with dead reckoning, that could theoretically help your phone navigate is your phone’s G-sensor, or its accelerometer, and either a compass, gyroscope or both which could provide what’s called an inertial navigation system that does not rely on anything other than sensing the change in speed and direction. That can be helpful to the military so that they are not reliant on being able to hear those satellites in enemy territory to determine their location, submarines, aircraft, missiles, subway cars, important things that aren’t bouncing up and down in your pocket all the time that need a redundant mechanism of navigation.
But keeping track of angular velocity at inertial reference frames all the time to yield an accurate relative location is just too damn hard for a phone flopping around, just like it is for you when you get kidnapped, blindfolded, tossed in a trunk and driven to a cave someplace (I hate that). A solid INS onboard, say, a sturdy big oil tanker gets confused by almost a mile and a degree per hour its orientation. So a phone INS, forget about it. German WWII rockets yes, a phone no. On the other hand, our phones do have these accelerometers for some reason, so I guess I’d call it a poor man’s INS as whatever it yields must be the most inaccurate of navigational clues.
I know from writing pseudo-academic articles before that some of you reading this are very super smart, so those among you who fall under that category, also to you decent bullshitters, maybe fill in some of the blanks I left related to navigation and correct all the crap I got wrong. Or hey, why don’t you just spin some total nonsense that sounds right but is completely false, see if you can fool everybody. It’s Saturday, what else are you gonna do. Now what the hell am I gonna use as my article picture…
I’m not physicist but I do remember loading Gifs on my old Pentium II running around 333mHz. Gifs always load like shit, even on my quadcore desktop.
“Cool, right? My apologies if your little Windows Phone with its single core can’t handle the animated gif.” .. It can.. so why bother writing quotes like this?
good article by the way.
Right here fellas is proof that no matter how hard you write your ass off to try to produce something substantive, unless you want your article to fall completely flat, gotta take at least one subtle jab at Microsoft enthusiasts.
Lace it in two thirds down to feel a little better when one or two guys spot it so that you know someone managed to read the whole thing, unless they have some sort of Microsoft fanatic defense mode IE extension.
I am on a 2yr old, single core android, and took offence to that statement. GIF is running fine here.
Don’t have to be a fanboy to be turned off by a stupid statement in an otherwise good article.
Ouch.. and here I was, thinking that chasing it with the smiley face emoticon would sort of smooth things over and soften the offensive force of that line. I am obviously very out of touch with reality.
Someone decided they’d take that a step further with animated PNGs, which gives you the perks of PNG over GIF, and I would be amazed to learn that you are able to see this animation on your Windows Phone by any means, any software from your market:
IE didn’t even support SVG, the go-to vector imaging format of the web, until IE9, so no SVG on IE in XP. What’s up with that?
They do not lead the way with such progress, they wait until these good open standards catch on enough because the competition (which continues to eat their market share) supports it.
The funny thing is, to me at least, that dragon would be animated if you were using a Windows Mobile phone running Opera Mobile. Weird how that’s no longer an option, you know, considering that the version number they went with for Windows Phone was 7 instead of something like 1.
I don’t know, maybe you can see the dragon doing his thing, I can’t look up the answer because no one seems to bother including Windows Phone in the table of supporting software for such things. If you can, and you’ve got a little time to kill still, maybe edit the wikipedia page accordingly.
No, the dragon is not animated on my android 🙁
No time to solve it right now, if I even can.
Thanks for another, Over My Head Reply.
Well, it would be if you installed Firefox or Opera… which is I guess a more important thing you can do on Android than watch the dragon move in more than 256 colors.
OK I will try it when I get home, though I tried Opera I never enjoyed it, uninstalled it. I was using Dolphin for when the stock browser couldn’t open a page, but I uninstalled it cause I wasn’t calling on it anymore, the stock browser seems to have caught up in functionality. But I will take your word for it and give Opera another try.
Hah; google fails at animated png; Simmons succeeds at bringing life into this site.
Opera mini failed! It did not animate either image. Uninstalled again. Not going to pay to upgade it.
I also tried a Dell Streak 7 running Honeycomb, stock and Chrome browsers. I tried a Dell Laptop running Win 7, and a PC running XP. None of those animated your dragon.
The only device I have not tried yet is my wife’s new Kindle Fire. I doubt it will work, but I will report back if it does. As a side note, She bought the Nook Tablet Saturday, and returned it Sunday, We both Hated it! (I told her to buy the Samsung Tab 7.0 Plus, she chose not to.)
Sorry to highjack your comments section with this wild goose chase.
Good article Doug…as a professional hydrographic surveyor who works with GPS data on a daily basis, I’d say you did a pretty good job of cutting it down to the basics and making GPS positioning easier to understand…
The animated dragon…. so far works for me in Firefox on a Win7 64bit Lenovo laptop and a generic WinXp desktop….but not so much in Dolphin on my DINC2
Well now that there’s actually interest in this animated png stuff gaining traction, which I think is awesome by the way, what I wasn’t that specific about is that apng support on Chrome requires an extension, though those are not hard to get and are fairly plentiful as there is a lil’ bit more developer interest in Chrome than in IE even though IE has a much higher share (at the time of my posting this comment).
The two browsers that can’t do it at all are IE and Safari according to Wikipedia. Firefox and its cousins, yes, Opera yes, Android with Opera Mobile or Firefox and maybe others, yes, iPhone yes but with extra software, but yes. Windows Phone? I’m guessing not with or without supplemental software.
The reason this is almost important is A) bragging rights and B) animated PNGs, were it more aggressively adopted (as in with Microsoft’s help), could have served as a poor man’s flash for many purposes that animated gifs are used (but need things alpha transparency and 24-bit color versus 8-bit). But as only, pretty much, Mozilla saw it as something worthwhile,
On the other hand, animation does not have a reputation for enhancing the typical web surfer’s overall experience, more like the opposite (hence not looping animations being an early feature of browsers), so never mind.
I appreciate your efforts to beautify your work, and your attempts at educating me. Keep up the good work.