Lost your way? Recently, Gizmodo has been following a story about faulty motion sensors in the iPhone 5s. If you find yourself having problems with the motion sensors that power your iPhone's Compass, Maps, or other third-party apps, there's an easy way to try and fix the problem.
According to Gizmodo's report, the iPhone 5s's accelerometer issues are reputedly due to default calibration errors for the device's hardware sensors. To combat this, the CEO of indie developer RealityCap, Eagle Jones suggests placing "a calibration procedure into apps" that recalibrates the sensor to receive "a corrected reading."
But Apple already ships a recalibration system for your device--it's hidden away within the Compass. The calibration screen that appears when you first launch the app hooks into Apple's entire Core Motion framework, which includes your accelerometer, gyroscope, and other motion data. (If you're interested in the nitty gritty of the APIs, the information is publicly available in Apple's Developer Library.) Calibrate the device in Compass, and it should properly adjust the accelerometer in Maps and any other third-party apps, according to an Apple Support document last modified on September 24.
Unfortunately, this calibration isn't perfect: The sensor's data can still be affected by magnetic and environmental interference (including other phones, tablets, and computers). You can try to fix a badly-behaving accelerometer/compass by force-quitting and relaunching Compass to trigger the calibration screen, and you'll have the best luck if you calibrate at least several feet away from any other magnetic or electronic devices. But it still may not solve your calibration woes. I ran a few (rather unscientific) tests in my office that equalized my iPhone 5s and 5 within a few degrees, but both iPhone models displayed a header a good 40 degrees south of what it should have.
That said, Apple does note in the above-mentioned support document that "you should use the digital compass for basic navigation assistance, but you shouldn't rely on it to determine precise locations, proximity, distance, or direction." Though it's an annoying caveat for users who want to use their iPhone for precise compass navigation, it's to be expected: Sensors such as the one in the iPhone aren't necessarily as good as a traditional mechanical compass.