Shortly following the release of Apple's new iPhone 5s, reports began to surface that there could be a problem with some of the device's motion sensor capabilities.

What’s going on with the iPhone 5s accelerometer, and how can developers respond?

on Oct 24, 13 • by Chris Bubinas • with No Comments

Shortly following the release of Apple's new iPhone 5s, reports began to surface that there could be a problem with some of the device's motion sensor capabilities...

Home » Static Analysis » What’s going on with the iPhone 5s accelerometer, and how can developers respond?

Shortly following the release of Apple’s new iPhone 5s, reports began to surface that there could be a problem with some of the device’s motion sensor capabilities. Games that relied on the accelerometer, such as many driving games, were behaving oddly, and Apple’s own compass was delivering discrepancies in direction as high as 8 to 10 degrees off from the same software on the iPhone 5, CNET reported. Speculation abounded over whether this was an embedded software error or a hardware problem. According to recent analysis, the issue is almost certainly in the hardware, meaning that a patch update is probably not forthcoming. However, the reliability of the error means that developers do have some recourse in building around the hardware flaw.

In a recent blog post, Eagle Jones, CEO of 3D API developer RealityCap, explained that the error could almost certainly be attributed to Apple’s decision to switch to a new accelerometer in the iPhone 5s. While the iPhone 5 uses a STMicroelectronics LIS331DLH accelerometer, according to iFixit, a recent Chipworks teardown found that the iPhone 5s has swapped the part out for a Bosch Sensortech BMA220 accelerometer.

Comparing the spec sheets for the two, Jones determined that the Bosch part has slightly more of a zero-gravity bias, the built-in offset that accounts for changes in the readout due to manufacturing variance. While the bias for the ST component is +/- 20mg (mg is an abbreviation for milli-g, which is one one thousandth of standard gravity, not milligram), the Bosch accelerometer’s bias is nearly five times higher, at +/- 95mg. The effect on the readout for the ST part is around a +/- 1 degree accuracy range, while the Bosch part comes out to a range of about +/- 5 degrees in tilt.

Calibrating and correcting
Jones questioned the rationale behind switching parts, noting that the slight power savings amount to a negligible difference in battery life and no difference in cost, while the difference in accuracy appears to be substantial. Since the error is hardware-based, Apple can’t issue a patch, but developers can work around the problem on a software level.

“What can developers who depend on reasonable accuracy from the accelerometer do?” Jones asked. “The good news is that a large component of the bias error in the accelerometer doesn’t change. Thus it is possible to work around the problem by incorporating a calibration procedure into apps. This procedure would ask the user to place the device in different orientations to determine the accelerometer bias. Apps can then subtract this measured bias from the data coming from the accelerometer to get a corrected reading.”

By building in adjustments that account for hardware discrepancies, app developers can avoid corresponding functionality errors in their programs. Shortcomings in the mechanical design or embedded software of hardware components can be frustrating, but they are addressable for companies with the right processes in place to make ongoing adjustments to their programs. They also provide a valuable lesson in terms of the far-reaching consequences of even minor flaws in data feeds, underscoring the importance of avoiding software-layer errors through tools like static analysis.

Software news brought to you by Klocwork Inc., dedicated to helping software developers create better code with every keystroke.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top