What Is a Digital Compass in an iPhone?by John Papiewski
To help you navigate your way to an important business meeting, the iPhone has a built-in digital compass. Instead of a fragile, magnetized needle on a paper dial, the iPhone's compass is a computerized device on a chip. The chip's technology is entirely solid-state and more reliable than a traditional compass. The iPhone's iOS software links directly to the chip, providing orientation data for apps.
Integrated Circuit Chip
Apple uses a specialized integrated circuit chip as the iPhone's digital compass. The chip measures magnetic fields and calculates compass directions based on its onboard sensors. It registers magnetism in three dimensions, so the iPhone can find "north" whether you hold it flat, vertical or some orientation in between. Because the technology exploits a phenomenon called the Hall Effect, the device has no moving parts to wear out and is more vibration and shock-resistant than a standard compass.
The Hall Effect is a well-known phenomenon in which a magnetic field affects the flow of current through a metal. The effect works best when magnetic field lines penetrate the flat surface of the metal at a 90-degree angle. To make the digital compass more responsive to fields at all angles, the Hall Effect sensors sit under a nickel-iron disk. The disk concentrates magnetic field lines so they always pass through the sensors.
The iPhone's iOS software contains a programming interface to the digital compass. When a developer creates an app that provides directions, she writes a brief reference in her code to the compass interface. When you use the program to navigate, iOS retrieves the iPhone's current heading from the digital compass chip and passes the data to the app.
Apple-provided apps which take advantage of the digital compass include "Compass" and "Maps." In the case of Maps, the compass keeps the map oriented such that the north side is always aligned to the top of the iPhone's screen. Third-party navigation apps such as "Marine & Lakes," "Navigator X" and "Scout" also use the compass. The app "Theodolite" simulates a surveyor's instrument, superimposing elevation, compass direction and GPS data on an image of the local terrain. "Star Walk" and related astronomy apps use the compass to identify stars, planets and other sky objects.