How To Improve Android GPS Accuracy By Keeping Time
Especially Helpful Tip For Turn-By-Turn Navigation App Users
The Global Positioning System is a highly sophisticated, and yet taken for granted, navigation system based on data you receive from satellites. This, most people know. For the uninitiated you turn on your iPhone, Android phone, handheld GPS receiver or your car’s navigation system and the satellite tells you where you are on the Earth. The United States invented and launched (satellite pun!) the system as a military application to guide aircraft, missiles, track foreign objects in space and help US Naval captains know where their ships were at sea without using a compass, a map and so forth (let the computer do the work so you can focus on shooting stuff).
Though, the above is not an accurate description of how GPS actually works. The satellite doesn’t send you a signal and say “Oh, I see you at 37.2350° N, 115.8111° W“.
In fact GPS works on a few principles. The first is that a GPS receiver, like the one in mobile phones such as the iPhone and Android phones, receive signals from the satellites (though do not transmit as this would be a more costly chip) and by combining the data received from multiple satellites the receiver can deduce where on Earth the receiver is. This is known as trilateration – not the more common term, triangulation. The receiver only is told where the satellites are – as explained by the Smithsonian Air & Space Museum in a very simple manner;
A GPS receiver “knows” the location of the satellites, because that information is included in satellite transmissions. By estimating how far away a satellite is, the receiver also “knows” it is located somewhere on the surface of an imaginary sphere centered at the satellite. It then determines the sizes of several spheres, one for each satellite. The receiver is located where these spheres intersect.
The Air & Space museum has a page, with diagrams, that explain in much greater detail how GPS receivers determine where on Earth they happen to be – with this notable gem;
In this diagram (above), the solid lines indicate where the GPS receiver “thinks” the spheres are located. Because of errors in the receiver’s internal clock, these spheres do not intersect at one point.
Notice the emphasis, because of the clock your receiver has – your cell phone – your location isn’t always precise. Now it should also be pointed out that most GPS receivers are only going to be approximate and not exact though you can expect your results to be withing a few meters of where you actually are, typically between 5 and 10 meters (but bet the US military is always precise when it counts).
What needs to be added to how GPS works is that each GPS satellite has within it a internal Atomic Time Clock – the most accurate clocks available as they work not with springs and metal or even computer chips – but measure time using electrons, which don’t deviate from the laws of atomic physics. Essentially GPS satellites have clocks that are basically never wrong, and were synced with the US Naval Observatory Master Clock when launched, which is the most important part of how they work.
MapToaster.com has a great explanation that couldn’t be more simplified of why time matters, and how time in addition to the location of the satellite is how the receiver puts together this information to give you a location;
The GPS receiver gets a signal from each GPS satellite. The satellites transmit the exact time the signals are sent. By subtracting the time the signal was transmitted from the time it was received, the GPS can tell how far it is from each satellite. The GPS receiver also knows the exact position in the sky of the satellites, at the moment they sent their signals. So given the travel time of the GPS signals from three satellites and their exact position in the sky, the GPS receiver can determine your position in three dimensions – east, north and altitude.
Notice again my added emphasis. If you are truly the nerd you can learn more about the theory behind GPS at gpsinformation.org with included math from Pythagoras and a run down of how the receiver gets it’s “fix”, per se. To get even deeper I would also suggest an article from an Ohio State professor of Astronomy’s Richard Pogge in regards to Einstein’s theories of Special & General Relativity and how they relate to the real world (and how GPS is a working example of both theories).
Essentially now we have a good understanding of GPS. It works on satellites telling us where they are, and what time they sent their signals. Without bringing Eisenstein into the discussion that’s all we need. The receiver does the rest. But for accurate readings, and for your Google Maps Navigation to give you the best results, and the best result quickly, we need to both be able to see the satellites (not be in an underground parking garage) and have an accurate clock on our Android phones.
If you have been using a computer in, I don’t know, the past 15 years you probably either are running an operating system that updates the time on it’s own from atomic clock servers or you run a daemon to update the computer time at a certain frequency – maybe once a day or so. For many applications, especially network communications and encryption, accurate times are very important. And as the National Air & Space museum showed us in the quote and diagram above – an accurate time on your cell phone is important in having an accurate GPS reading. And if you have noticed when updating your computer’s clock from time servers – the clock on your PC is never right!
Even hand made watches drift in time from other clocks – but your PC and phone also drift. And finally we are getting to the tip we set out to provide in this the article after all the background information! Your phone likely gets the time from the cellular towers, but a lot of carriers don’t have their cellular towers always updated – or rather, they have drifted from what we could call the “real” time in relation to what the US Navy keeps and what the GPS satellites are using. Or your particular phone model or software version doesn’t update as often as it should. It could maybe update only on start or at other predefined times – and once you use the app presented below you’ll see that the time on your phone can drift a few seconds every few minutes or so.
Enter, ClockSync from Serge Baranov
(Install from Google Play Store Link)
This nifty app will automatically update your clock at intervals you define from the information provided by NTP, or Network Time Protocol Servers. If you are fanatical, you can update your phone’s clock every hour, or just once a week. I’ve found that on different phones this will improve the GPS fix time on Android (how long it takes for the receiver to locate you on the planet) and improve the accuracy of that first fix (and help it stay correct as you move – especially driving). Easily one of the first apps I’d install on a rooted phone – though root isn’t required as you can manually update the time without granting it superuser privileges.
Before I end and simply urge you to install this nifty app today here are some examples of ClockSync in action.
ClockSync after an update from the local (to me, Ohio State) NTP Server
ClockSync around 30 seconds after the NTP Server update
ClockSync just a few seconds after showing 0 drift we see the fractional change;
ClockSync statistics since usage: note the overall correction over time, almost 8 minutes!
A simple screenshot of my settings page showing updates happen every 3 hours and use a high precision mode
Finally I’ll add that ClockSync comes setup with a Network Time Protocol server already in place, however you may want to find a server closer to your actual location. Unfortunately you can’t use the military servers unless you identify yourself as being a military user (and you’d not be reading this now probably…). However with some Google-Fu you can likely find a local server by searching your state’s name or even better you can look on the NTP.ORG site and find which pool of NTP servers is best for your region.
Here are links below to world-region NTP pools to use with ClockSync (or even your PC) and servers for each country as of this posting;
- North America
- Canada — ca.pool.ntp.org
- United States — us.pool.ntp.org
- Mexico — mx.pool.ntp.org
- Guatemala — gt.pool.ntp.org
- Panama — pa.pool.ntp.org
- Bahamas — bs.pool.ntp.org
- Costa Rica — cr.pool.ntp.org
- El Salvador — sv.pool.ntp.org
- Austria — at.pool.ntp.org
- Switzerland — ch.pool.ntp.org
- Germany — de.pool.ntp.org
- Denmark — dk.pool.ntp.org
- Spain — es.pool.ntp.org
- France — fr.pool.ntp.org
- Italy — it.pool.ntp.org
- Luxembourg — lu.pool.ntp.org
- Netherlands — nl.pool.ntp.org
- Norway — no.pool.ntp.org
- Poland — pl.pool.ntp.org
- Sweden — se.pool.ntp.org
- Slovenia — si.pool.ntp.org
- United Kingdom — uk.pool.ntp.org
- Finland — fi.pool.ntp.org
- Ireland — ie.pool.ntp.org
- Russian Federation — ru.pool.ntp.org
- Belgium — be.pool.ntp.org
- Portugal — pt.pool.ntp.org
- Greece — gr.pool.ntp.org
- Hungary — hu.pool.ntp.org
- Bulgaria — bg.pool.ntp.org
- Romania — ro.pool.ntp.org
- Czech Republic — cz.pool.ntp.org
- Yugoslavia — yu.pool.ntp.org
- Estonia — ee.pool.ntp.org
- Belarus — by.pool.ntp.org
- Slovakia — sk.pool.ntp.org
- Ukraine — ua.pool.ntp.org
- Lithuania — lt.pool.ntp.org
- Macedonia — mk.pool.ntp.org
- Moldova — md.pool.ntp.org
- Latvia — lv.pool.ntp.org
- Croatia — hr.pool.ntp.org
- Republic of Serbia — rs.pool.ntp.org
- Bosnia and Herzegovina — ba.pool.ntp.org
- Armenia — am.pool.ntp.org
- Iceland — is.pool.ntp.org
- Asia / Middle East
- Philippines — ph.pool.ntp.org
- Malaysia — my.pool.ntp.or
- Turkey — tr.pool.ntp.org
- Singapore — sg.pool.ntp.org
- India — in.pool.ntp.org
- Hong Kong — hk.pool.ntp.org
- United Arab Emirates — ae.pool.ntp.org
- Japan — jp.pool.ntp.org
- Bangladesh — bd.pool.ntp.org
- Israel — il.pool.ntp.org
- Korea — kr.pool.ntp.org
- Thailand — th.pool.ntp.org
- Iran — ir.pool.ntp.org
- Taiwan — tw.pool.ntp.org
- China — cn.pool.ntp.org
- Indonesia — id.pool.ntp.org
- Vietnam — vn.pool.ntp.org
- Pakistan — pk.pool.ntp.org
- Oman — om.pool.ntp.org
- Uzbekistan — uz.pool.ntp.org
- Sri Lanka — lk.pool.ntp.org
- Kyrgyzstan — kg.pool.ntp.org
- Cambodia — kh.pool.ntp.org
- Qatar — qa.pool.ntp.org
- Saudi Arabia — sa.pool.ntp.org
- Iraq — iq.pool.ntp.org
- Kazakhstan — kz.pool.ntp.org
- Australia — au.pool.ntp.org
- New Zealand — nz.pool.ntp.org
- New Caledonia — nc.pool.ntp.org
- South America
- Brazil — br.pool.ntp.org
- Chile — cl.pool.ntp.org
- Argentina — ar.pool.ntp.org
- Venezuela — ve.pool.ntp.org
- Peru — pe.pool.ntp.org
- South Africa — za.pool.ntp.org
- Madagascar — mg.pool.ntp.org