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 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.
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 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.