In a recent interview with Alasdair Allan regarding the iPhone sensor suite, he talked a bit about how the various sensors have to be used together to figure out how the phone is oriented.
"Basically the magnetometer in the iPhone is exactly that. It measures the magnetic field. And it is very susceptible to local changing magnetic field monitors, CPUs, TVs, anything like that will affect it quite badly. By default, what you're measuring, of course, is the ambient magnetic field of the Earth. And that's how you can use it as a digital compass because there are tables that will draw up and show you how to do deviations from magnetic north to true north, depending on your latitude and longitude. Which is why to do augmented reality apps, you need both the accelerometer and the magnetometer, so it can get your pitch and roll to the device and the GPS to get the latitude and longitude so you know the deviation from true north."
"I think it's misleading to talk about precision. I mean basically, it reports three figures: X, Y, and Z. And this is the linear acceleration values reported by the hardware's G force values. So value one represents a load of approximately one gravity. But, of course, the problem is what you're dealing with is you're measuring the acceleration. So if your iPhone is sitting face-up on the table, you'll be measuring an acceleration of one gravity straight down, thereabouts. So if you're using it as a detection of movement, you also have to take into account the fact that you're in a gravitational field and, of course, just spinning the iPhone left and right if it's sitting flat on the table isn't going to give you the roll. I mean that's one of the big gotchas of the accelerometer. And it's a mistake quite a lot of people make is that you're not going to get your pitch and roll out of the accelerometer. You need the magnetometer in addition to that."




Help













