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?
There are several things which affect the time to first fix (TTFX).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.