DEV Community

loading...

How does your phone know where you're?

type404_ profile image Tisha ・4 min read

Well, I'm pretty sure you have thrown around the term GPS around casually many times but have you ever wondered how it works?
If you have or you're wondering now then you're at the right place

How it all started?

As you would know, GPS or Global Positioning System is that technology which tells us our geographical location. The concept for the technology started in the late 1960s by the U.S military. It was called NAVSTAR and the first satellite was launched in the orbit in 1978, but it was only in 1995 it became fully operational and was used in cars in the US in 1996. Only in 2000s did it become available to civilians and started being widely adopted.

Wow, that's just around 20 years ago we started adopting this and now we can't even imagine stepping out of the house without GPS, I mean I definitely can't. I struggle with direction even with GPS.

How does it work?

It has three basic parts:

  1. Satellites: As of May 2020, there were 29 satellites that fly, each in its orbit at an altitude of 20,000 km.
  2. Ground Stations: There are 16 stations that make sure, the satellites are functioning properly, they use radars to find out if the satellites are where they're supposed to be.
  3. Receivers: This is your device (phone, watch etc.) that receives the GPS location.

The receiver in your phone is following a signal from the satellites to determine how far it is. When it finds out how far you're from 4 or more GPS satellites it can tell you where you're. For a GPS to tell your exact location, it needs to see 4 or more satellites this is because it uses something called a trilateration mechanism.

Did you know?: GPS doesn't need a phone signal or internet to work, but they make it more efficient. This is how your offline maps work when you're in a place without internet signal.

What is Trilateration?

2-D Trilateration

Imagine, you are on a trip to the US and you decide to experience life without GPS (Bold move) and you find yourself lost somewhere with no idea, you find a local and ask them "where am I?" they say, "You are 625 miles from Boise." That's nice, but that doesn't tell you much, because that means you can be anywhere on the below circle within 625 miles radius.

Circle with the centre as B

So now you ask another person, and they say "You're 690 miles from Minneapolis, Minnesota." So now you know that you're in the intersection of the below two circles. That's better you have narrowed down your location.

B and M circle intersection

Now you are lucky and you find another person, who tells that you're 615 miles from Tucson, Arizona. So, you have another circle which intersects the other two circles and you know you're in Denver, Colorado.

Intersection of circle B, M and D

3-D Trilateration

Now when it comes to this, we are dealing with spheres instead of circles thus making it a tad bit harder to visualise. This includes our latitude, longitude as well as altitude.
If the radii from the above example go in all direction, you end up with a 3D sphere.
So, if you know you're 20 miles from Satellite A, you're in an imaginary sphere (I did the easy drawing, you'll have to use your imagination here now) with a radius of 20 miles and you know you're 15 miles from Satellite B. So, these two satellites overlap to form a circle. Now add Satellite C and you get a third sphere which intersects this circle at two points.
Now, Earth would act as our fourth sphere because only one of the two points would actually be on the ground so you automatically eliminate the point in the space.
The more satellites you use the better accuracy you get of your location. It at least needs 4 satellites.

How does the calculation work?

  1. GPS satellites send their position and current time to the receiver at certain intervals.
  2. The GPS receiver gets this information in the form of radio signals which it analyzes to get the location of the satellites and the distance between the receiver and the satellites.
  3. To calculate the distance it takes the speed of the wave which travels at the speed of light and the time it takes to travel from the satellite to the receiver. The time needs to be synchronized to nanoseconds for both the receiver and the satellite to maintain the accuracy. (There's a lot that goes behind this to happen because the satellites have atomic clocks which are too expensive for every receiver to have so they use quartz clock that resets itself.Read More Here
  4. Calculating the location isn't as hard because the satellites travel in predictable orbits and the receiver stores an almanac which tells where each satellite should be at a given time.

Whewww....

So yeah, that's it. Hopefully, the next time you are using that GPS on your phone you would want to take a moment and appreciate the maths and science that goes behind making sure you get to your destination!
I know I do, but I still wish Google Maps stop telling me to head north and south...I sometimes feel calculating the distance would be easier than understanding GPS. But that's just me and my absolute lack of direction.
Thanks for reading! If you liked it, go ahead do the usual like, share, subscribe.

Discussion (0)

pic
Editor guide