Mobile software developers, whether working on iOS or Android, often use GPS functionality in their apps without fully understanding how GPS works. This article is designed to give you a basic understanding of GPS hardware, so you can appreciate the underlying technology and improve your app’s location-based features.

This article is structured as a conversation between an iOS developer (Alex πŸ‘¨πŸ»β€πŸ’») and an electrical engineer (Sarah πŸ‘©πŸΌβ€πŸ’»). Through their dialogue, we’ll explore the fundamentals of GPS technology.

The Basics of GPS

πŸ‘¨πŸ»β€πŸ’»: So what does GPS stand for?
πŸ‘©πŸΌβ€πŸ’»: It stands for Global Positioning System.

πŸ‘¨πŸ»β€πŸ’»: Who created it, and for what purpose?
πŸ‘©πŸΌβ€πŸ’»: The GPS project was launched by the United States in 1973 to overcome the limitations of earlier navigation systems.

πŸ‘¨πŸ»β€πŸ’»: I know GPS works without an internet connection, but do I need cellular service to use GPS?
πŸ‘©πŸΌβ€πŸ’»: No, you don’t need cellular service either.

How GPS Works Without Internet or Cellular Service

πŸ‘¨πŸ»β€πŸ’»: How does GPS work without internet or cellular service?
πŸ‘©πŸΌβ€πŸ’»: Your device receives signals from satellites. There are about 24 operational satellites in six orbital planes.

πŸ‘¨πŸ»β€πŸ’»: Does my mobile need to connect to all of these satellites?
πŸ‘©πŸΌβ€πŸ’»: No, when stationary, your device only needs to receive signals from at least three satellites. When moving, it needs signals from four satellites for accurate positioning.

GPS Satellites

GPS Satellites in Orbit (Source: Wikipedia)

πŸ‘¨πŸ»β€πŸ’»: How does the GPS system identify me and send data back?
πŸ‘©πŸΌβ€πŸ’»: The satellites don’t identify you. They continuously emit synchronized pulses everywhere. Your device simply receives these signals.

Calculating Your Position

πŸ‘¨πŸ»β€πŸ’»: How does my mobile determine my latitude, longitude, and altitude?
πŸ‘©πŸΌβ€πŸ’»: Your device compares the time it receives signals from each satellite. By calculating the time differences, it can determine your position on Earth. The satellites have highly accurate atomic clocks, which make these calculations possible.

GPS Position Calculation

Calculating Position Using GPS Satellites

πŸ‘¨πŸ»β€πŸ’»: If the service is free and I don’t have a subscription for GPS, how is it funded?
πŸ‘©πŸΌβ€πŸ’»: GPS is one of several Global Navigation Satellite Systems (GNSS). Others include GLONASS, BeiDou, and Galileo. These systems are funded by governments and sometimes private entities. Commercial GPS receivers might have restrictions, like not functioning at high speeds.

BeiDou Navigation System

BeiDou GNSS, which doesn't have full Earth coverage

Accuracy and Limitations of GPS

πŸ‘¨πŸ»β€πŸ’»: What is the typical error margin of GPS?
πŸ‘©πŸΌβ€πŸ’»: The error margin varies but is typically between 15 to 50 meters. Some systems use additional inertial sensors to provide more accurate positioning.

πŸ‘¨πŸ»β€πŸ’»: What is the minimum detectable distance?
πŸ‘©πŸΌβ€πŸ’»: Theoretically, the resolution is as fine as one inch, but in practice, it’s about three meters.

Challenges of Using GPS Indoors

πŸ‘¨πŸ»β€πŸ’»: I tried using GPS inside a large hospital, but the readings were inaccurate.
πŸ‘©πŸΌβ€πŸ’»: GPS signals do not work well indoors because they require a clear line of sight to the satellites.

πŸ‘¨πŸ»β€πŸ’»: But I still got some readings on my maps app indoors.
πŸ‘©πŸΌβ€πŸ’»: That’s likely the last known location. Some devices, like those from Huawei, augment GPS data with accelerometer and gyroscope data to simulate basic indoor navigation, but it’s not reliable.

πŸ‘¨πŸ»β€πŸ’»: What technologies are used for indoor navigation systems?
πŸ‘©πŸΌβ€πŸ’»: Indoor navigation typically uses beacons, Bluetooth, and other technologies. You might want to look into Apple AirTags for more information.

Using Sensors for Positioning

πŸ‘¨πŸ»β€πŸ’»: Why can’t we just use the accelerometer and gyroscope in our phones to calculate position?
πŸ‘©πŸΌβ€πŸ’»: While you can derive some positional data from these sensors, they are prone to significant errors over time due to factors like drift and gimbal lock. Accelerometers and gyroscopes alone can’t provide absolute positioning, and their errors accumulate quickly.

πŸ‘¨πŸ»β€πŸ’»: That was a lot of information. Thanks for the explanation.
πŸ‘©πŸΌβ€πŸ’»: You’re welcome! See you soon.

Conclusion

Understanding how GPS works can help mobile developers better utilize location services in their apps. Whether you’re developing a navigation app or just curious about the technology behind the blue dot on your map, a basic knowledge of GPS hardware can enhance your approach to location-based features.