85

When I'm using the arduino GPS module it usually takes a couple of minutes for it to start sending data. And it seems that it's usually the case with all GPS modules since they need to "listen" to the satellites for some time. However whenever I use my phones internal GPS it find its position in a matter of seconds. Why is that?

Mister Mystère
  • 9,477
  • 6
  • 51
  • 82
  • 16
    One word answer: "A-GPS" – Agent_L Aug 07 '17 at 09:56
  • 12
    That's not one word - it's a four word acronym! – Transistor Aug 07 '17 at 13:58
  • 11
    @Transistor Well if you want to get pedantic, A-GPS isn't an acronym, but an initialism. ;) – DavidCAdams Aug 07 '17 at 17:14
  • 9
    @DavidCAdams: You're right! I looked them both up. I had never realised that an acronym is pronounced (or should at least, I presume, be pronounceable) as a word. The things I've learned on EE.SE! – Transistor Aug 07 '17 at 17:19
  • 1
    @DavidCAdams And all these years I've been going the NASA route of pronouncing A-GPS as "aggps", and now you're saying I can't do that any longer? The things you learn on EE.SE! – user Aug 08 '17 at 10:56
  • @MichaelKjörling Me too, until I started getting funny looks in meetings ;) – DavidCAdams Aug 09 '17 at 07:27
  • Additional to what is mentioned below - are both runs from a standing start ... ie from power-up (having been off for 5 minutes) to a) first fix b) 10m fix ? I find my old Garmin Gecko does both faster than my Samsung Galaxy. – MikeW Aug 09 '17 at 09:46

6 Answers6

119

There are several things which affect the time to first fix (TTFX).

  1. Getting the almanac and ephemeris. These two things are technically a little different from each other, but for our purposes we'll treat them as the same. They are the locations of the satellites, and you need a to know where they are in order to work out your own position. Each satellite transmits the whole lot roughly once every 12 minutes. So from a completely cold start with a one-channel receiver and a decent signal, TTFX will be at least 12 minutes. You can speed things up by:

    • Downloading from the internet instead - generally a good choice for phones. Downloading the almanac and ephemreris this way is known as MSB Assisted GPS.
    • Remembering the almanac from last time (it's good for many weeks) and only downloading the ephemeris.
    • Having more than one receiving channel in the device so you can listen to more than one satellite at once. The transmissions are staggered to make this work, and with some care you can use the ephemeris without an almanac which saves a lot of time. The vast majority of modules on the market these days have multiple channels, so it would be rare to find one which still needs 12 minutes.
  2. Identifying satellites. You need to listen to at least three satellites, preferably more, to get a good fix, but each receiver (known as correlators) can only be tuned to one at a time. If you know roughly where you are, what time it is, and have an almanac already, then you can guess which satellites you can see. Phones tend to know roughly where they are from recognising wifi or bluetooth signals, knowing which cell tower they are using, and other sources. They regularly get very accurate time updates too, so they can usually go straight for the correct satellite. Both phones and larger modules can also remember when and where they were last used, and use that to start from.

  3. Number of correlators. Due to the very low signal-to-noise of GPS signals, you need a special bit of hardware to receive them. Some receivers only have one, and need to rotate 'round the satellites. Others have more, and can listen to more at once. So even if you already have the almanac/ephemeris and know roughly where you are, then more correlators will still help you fix quicker. You might think more is always better, but more does increase cost and power consumption. Some phones and modules have more than others.

  4. Signal and antennas. The correlators will do their job faster if you have a good signal-to-noise going into them. Very poor signals might not work at all. A good antenna design, amplifier, sky view, and good PCB layout can make all the difference. Some modules may work OK out of the box, and much better with an antenna plugged in.

  5. Number of usable satellites. There are actually two large constellations of satellites up there, GPS (run by the USA) and GLONASS (run by Russia). There are also more under construction: Galileo (EU) and BeiDou-2 (China) and some with local coverage like India's NAVIC or BeiDou-1. A receiver which can work with satellites from more than one constellation has more satellites to chose from, and will get a quicker and more accurate fix.

  6. Quality of correlators. New hardware designs are better than old ones, and will be able to pick out fragments of the GPS message in a noisy signal better. Another trick phones can do is to capture fragments of signal and pass them over the internet to a server with a very good software correlator, and complete almanac/ephemeris to examine. This is known as MSA Assisted GPS.

  7. Some phones (and even a few modules) might also use some slightly sneaky tricks to avoid or hide a long TTFX. Since they are on all the time, they might briefly switch on the GPS without telling the user in order to keep the location and ephemeris roughly up to date. Others might display a recent position while still waiting for a real fix - which looks like a good TTFX most of the time, but looks bad if it turns out the position is very wrong.

Point 1 above is the thing that makes the most difference, and is usually the key thing that is different between basic modules, more advanced modules, and phones. The others usually make a smaller difference, but it can actually become a very complicated thing. If you want to read more, then "GPS time to first fix" is the term to search for.

Jack B
  • 12,167
  • 1
  • 27
  • 46
  • 33
    On point 2: In addition to WiFi, the phone may also get an approximate location based on the cellular base station(s) it is in contact with. – alphabetter Aug 06 '17 at 16:22
  • 4
    A device might also "cache" the last known position data, use that immediately, and adjust it as real data comes in. My cellphone does this with it's GPS. – rdtsc Aug 06 '17 at 17:19
  • 18
    In addition to the cell network, a number of providers (including Google) have built up databases of the physical locations of WiFi access points, which allows them to pinpoint a device's location surprisingly accurately. My cheap Android tablet has neither GPS nor cell access, yet Google Maps always seems to know exactly where I am, as long as I'm connected to a WAP. I suspect that they get the locations of the WAPs through an inverse process -- inferring it from the locations of connected phones and other devices that do have GPS. – Dave Tweed Aug 06 '17 at 17:21
  • @rdtsc: Sports watches with GNSS seem to do that too. – Michael Aug 06 '17 at 17:31
  • @rdtsc: The Arduino module probably does the same thing (assuming it has a backup power source -- supercap or battery), so that doesn't explain the difference. – Dave Tweed Aug 06 '17 at 17:45
  • 2
    Modern cellphones also have a tendency to run the GPS all the time at a slow update interval, and when apps start requesting location it increases that frequency - which gives the appearance of a faster start without it actually being a fast start. – fluffy Aug 06 '17 at 20:27
  • 2
    A lot of phones these days even have a barometer to speed up that time it takes to get a location fix. http://www.popsci.com/gadgets/article/2011-10/so-um-why-does-new-google-phone-have-barometer-it Something about knowing your altitude allows for a more accurate fix with fewer satellites. – Brad Aug 07 '17 at 03:32
  • 2
    @Brad: Yes, that's part of the "know roughly where you are" from Jack's point #2. GPS basically locates you in 4D space-time; the phone generally knows time rather precisely (from the cell network and/or NTP over the Internet) and it can estimate its position 2D position (using triangulation of cell towers, nearby networks, etc.). A barometer would give the missing 4th dimension. – Jörg W Mittag Aug 07 '17 at 05:13
  • 3
    @DaveTweed: reportedly, Google is even starting to build Bluetooth databases now. It makes sense, really: e.g. my Bluetooth connection to my home stereo system has a useful range of about 10m, it can probably be detected for another 10m. That gives a much higher resolution than WiFi. The trick is then to filter out the truly stationary ones … but "filter out" is basically Google's core competency anyway. – Jörg W Mittag Aug 07 '17 at 05:16
  • Your claim that the minimum TTFF with no prior information is 12 minutes is wrong. It's 35 seconds in the best case, 1 minute 10 seconds in the worst, assuming good signal. The minimum data need for a fix is broadcast every 35 seconds. – user Aug 07 '17 at 09:46
  • 1
    @fluffy I've never known that barometer can be used to assist GPS fix. I've always used it for weather forecast or sometimes getting the altitude – phuclv Aug 07 '17 at 09:53
  • 5
    @ゼーロ Each frame is 35 seconds, but the complete almanac is split over 25 frames, and will take 12-13 minutes to transmit. It is true that you can obtain a fix from ephemeris data without the almanac, but you will need the almanac for 1) very old hardware, 2) accurate correction from GPS time to UTC and 3) ionospheric delay correction on some hardware. – Jack B Aug 07 '17 at 09:53
  • 1
    @ゼーロ Also, I think the 35 seconds from cold option needs one channel per satellite, as you need ephemeris for each one and it takes 35 seconds to get a complete navigation message. And I explicitly said a single channel receiver. – Jack B Aug 07 '17 at 10:03
  • @alphabetter, rdtsc, & fluffy, Good points all, I've edited them into the answer in case this now-quite-long comment thread ever disappears. – Jack B Aug 07 '17 at 10:22
  • 1
    @JörgWMittag Knowing time "rather precisely" is not good enough. If you are off by one millisecond, that's as good as being off by 300 km (or more) – Hagen von Eitzen Aug 07 '17 at 11:26
  • @JackB Check the datasheets of some GPS receivers. Most can track multiple channels simultaneously (i.e. multiple satellites), and state their minimum TTFF from cold as 35 seconds because that's all they need to establish position. Believe me, I've build multiple products with GPS receivers and no permanent backup power, and there is no way they take 12 minutes to get the first fix. In fact our test spec says longer than 3 minutes is a failure. – user Aug 07 '17 at 13:22
  • 4
    @ゼーロ Ummm. I was very clear that 12 minutes was for a single channel receiver. I also said that multi-channel receivers are faster. Most modern receivers are multi-channel, but I certainly have some older single channel ones - and they do take the full 12 minutes. And if you have a single channel and you want ionospheric delay correction, then there's no way to get it faster than the full almanac can be obtained. The fact that you use multi-channel modules and require a 3 minute TTFX doesn't mean that the other type doesn't exist. But I will update the answer to say the old type is rare. – Jack B Aug 07 '17 at 14:00
  • 1
    In addition: smartphones nowadays usually not only use GPS but GLONASS as well, which can also help as there's more satellites to get data from – SztupY Aug 08 '17 at 09:36
  • @SztupY Good point, I'll edit that in too. – Jack B Aug 08 '17 at 09:43
  • @alphabetter Isn't this an integral part of 3G, that each base station will broadcast it's own position for this very purpose, or am I misinformed? – winny Aug 08 '17 at 14:01
  • @fluffy I often turn off my GPS (all location data) manually and can't say it makes much difference to the TTFF. But it's possible that I use it often enough that it always has an up-to-date ephemeris and/or a data signal – Chris H Aug 08 '17 at 15:54
  • @JackB Entry-level handheld Garmins were multichannel years ago (my old etrex supports 12). This helped a lot if the ephemeris had to be downloaded, seemingly much less so if it hadn't been used for months and needed the almanac – Chris H Aug 08 '17 at 15:56
  • About point 2: If I'm not mistaken it takes at least *four* satellites to solve the location equation, since time is an unknown variable as well. Very good summary otherwise! – theDmi Aug 09 '17 at 11:40
23

The cell phone operating system downloads the GPS almanac data (satellite ephemeris and status information) over the internet via the cell network and loads it into the GPS module much faster than the it would take to download that from the GPS satellites directly at 50 bps (yes, that's 50 bits per second, GPS is rather old tech optimized for operation at very low SNR), significantly expediting the time to first fix. This is called Assisted GPS. It also likely has a very accurate initial time reference from the cell modem (the cell towers are usually time synced via GPS) as well as possibly a coarse location estimate from the cell modem. All of this combined drastically reduces the amount of searching that the receiver has to do - it knows what satellites it should be able to see, so it only looks for those, and it doesn't need to wait around to for the satellites to transmit the entire message.

alex.forencich
  • 40,694
  • 1
  • 68
  • 109
  • So it basically takes out the "synchronization" out of the process. The GPS module searches for the satellite using data sent by satellite itself right? – Anthropomorphous Dodecahedron Aug 06 '17 at 14:58
  • 3
    It doesn't take it out of the process, it accelerates it by giving the GPS receiver a good estimate to start from. – alex.forencich Aug 06 '17 at 15:00
  • 29
    The 50 bps isn't just because GPS is old. It is an integral part of how GPS receivers can detect the extremely weak signal, and how all the GPS satellites can transmit on a single frequency but still be received independently. Lots of complicated stuff goes on in a GPS receiver. – JRE Aug 06 '17 at 15:58
  • It is also because at time of planning, GPS was assumed to be so secret the signal was not allowed to be visible. Transmit too much data and it is a lot harder to hide in noise. – TomTom Aug 06 '17 at 21:18
  • 6
    @TomTom: No, the secrecy of GPS was never achieved by obscurity. You might be thinking of Selective Availability (SA), but that was an intentional positioning error. – MSalters Aug 07 '17 at 07:47
  • 1
    @TomTom: The spread spectrum of GPS wasn't intended to hide the signals. It does have that effect for simple RF receivers, but that wasn't the point. The spread spectrum technique gives you two things: operation with extremely low signal to noise ratios, and a degree of immunity to jamming. Pretty much everybody and his brother knows (and knew way back when) which frequency GPS uses. No point in hiding what is already known. Not being (easily) jammed was a big plus, though. There are GPS jammers (now) but back then it was much more difficult to do. – JRE Aug 08 '17 at 16:39
  • The spread spectrum technique also allows for CDMA - all the satellites transmit on the same frequency, but with different codes. The codes from the individual satellites are then separated with correlators. – alex.forencich Aug 08 '17 at 18:59
11

The other answers have already explained the "how" and "why", so all that's left for me is the "what": it's called A-GPS (assisted GPS, sometimes also called accelerated or augmented GPS).

In other words: the reason why a phone's GPS works faster than a "GPS's GPS" is that the phone isn't using "GPS", it's using aGPS.

Jörg W Mittag
  • 740
  • 7
  • 10
8

Part of the answer here is that cell phone GPS isn't just GPS. Cell also use other information for geolocation, such as triangulation of cell phone towers and the visibility of wifi networks. For example, the non-cellular version of the iPad Air doesn't have actual GPS but still knows where you are in built-up areas using these techniques.

  • 4
    The question was specifically about how GPS operates. Cell phones can not triangulate from cell phone towers as there is no location information available from them. – Transistor Aug 06 '17 at 17:17
  • 6
    @Transistor The question compares stand-alone GPS to cellphone GPS and the question title specifically asks how cellphones do GPS faster than stand-alone GPS units. And Wikipedia says that [cellphones _do_ use tower triangulation](https://en.wikipedia.org/wiki/Mobile_phone_tracking#Handset-based) to determine location. I'm not sure why you say there's no location information available: sure, the tower doesn't announce its location but roads don't announce their location either: your phone has a map stored in a database. – David Richerby Aug 06 '17 at 17:42
  • 3
    @Transistor: the cellphone doesn't perform the triangulation. The network provider does. – Jörg W Mittag Aug 07 '17 at 05:09
  • 2
    @JörgWMittag: Depends on the network AFAICT. Modern networks provide localization services as part of Enhanced 911 / E112. – MSalters Aug 07 '17 at 07:48
  • @DavidRicherby: Thanks for the link. I read through it twice but all I can see is that the location of the phone is known to the *network* - not to the phone. What have I missed? – Transistor Aug 07 '17 at 07:50
  • @Transistor The first sentence says it can be done by software on the phone. But then it talks about that software continuously sending data to the carrier so I'm no longer sure exactly what it's talking about. [Jörg's answer](https://electronics.stackexchange.com/a/322679/46719) seems to say what I was trying to say, but using the correct terminology – David Richerby Aug 07 '17 at 08:34
  • I read up on that too. Again, that's on the network side. I have no expertise on this - just curious. Obviously the networks need to monitor relative signal strengths to optimise switching from one tower to another but that doesn't specifically require location knowledge. I can understand that emergency services could make use of location knowledge once it's added. The missing bit might be that this info is available to other ground-based information servers which can, by WiFi or GSM data, transmit that to the phone. – Transistor Aug 07 '17 at 08:43
6

Just wanted to put a little more detail in what is happening when the older receivers are waiting for data. In other words, why is that almanac (and remembered position) so useful?

The GPS signals are very weak. Given the distance, the signal is well below the noise floor when it reaches the earth. You'd never directly detect the satellite if you were simply watching a scope scan by the correct frequency.

The way the receiver gets information is by comparing the incoming signal with a specific pattern (via an FFT correlation). If the correct pattern is used, then the correlation lines up and the data can be seen.

For a simple, old-style receiver getting to this point requires two things from the device's correlator: the frequency of the message from the satellite, and the phase of the message (lining up the patterns). If either of these is incorrect, then the correlation is unsuccessful and nothing is detected. The motions of the satellites mean that the received signal is subject to relatively large Doppler shifts.

With an almanac in place and a good idea of the current location and time, the receiver can estimate the relative motions of satellite and receiver to remove most of the Doppler shift and come somewhat close to the frequency. That means the correlator can usually come up with a hit just by trying different phases for the signal pattern. This phase-space search can be done in a few seconds.

If the almanac is missing, or if there is no estimate of current location and time, the system has to try different phases and different frequencies to get data from each satellite. Now having to search in two different dimensions, it can take a few minutes for even a multi-channel system to "find" 3 satellites by brute force.

Modern chipsets can make use of additional signals and lots of parallel comparators to speed the search up, even without A-GPS being present. I suspect the chipset you get on an Arduino shield is probably older/cheaper and won't use these newer features.

BowlOfRed
  • 265
  • 2
  • 9
3

In the US the FCC required cellular phone operators to be able to identify a caller's location when dialing emergency services to within 300 meters within 6 minutes of the initial phone call by September 11, 2012.

This was phased in gradually over the preceding years, and the requirement has been tightened in both distance and time to location report in the later years.

The cellular phone companies couldn't guarantee this in remote areas where only one or two cellular towers were within contact of the mobile phone, nor in urban environments where reflections and building density prevented location even when the phone had several towers it could receive. GPS chips couldn't provide this within the time frame required at a low enough power that the cell phone would still be commercially viable (at the time the requirement was introduced. chipsets are now much more power efficient and faster, partially due to the requirement that every phone include some or all of a GPS chipset). Further, GPS chipsets were very expensive relative to the other phone components.

So they created a few different competing systems which all fall under the moniker "AGPS" for Assisted GPS.

The technology that runs behind these various AGPS systems differs, sometimes greatly.

The cheapest cellular AGPS systems record several milliseconds of the GPS RF signal, send it to the AGPS server which then, knowing the phone's approximate location, can use that GPS RF snippet to determine a much more accurate position. These phones cannot obtain GPS coordinates without a good cellular connection.

Some have full GPS chipsets, but allow the phone to provide them with the almanac and ephemeris - two pieces of information which allow the chipset to then get a fix within seconds - after which it uses its normal methods to produce position results. Given time, these phones can obtain position independent of their network.

Most GPS chipsets allow you to load ephemeris and almanac information into them, so if your arduino device has an internet connection and you have access to an AGPS server you can speed up your GPS fix in a similar manner. However, for most projects simply adding a lithium coin cell battery to the right pin on the GPS receiver allows it to keep the last almanac and ephemeris update, and since the changes are small over short periods of time this greatly speeds up the first fix as long as the device hasn't moved thousands of miles, and is powered on every few days.

Adam Davis
  • 20,339
  • 7
  • 59
  • 95