Jimmy Engström


The Wp7 Motion api part 2

What does the Motion API do?

Well basically it combines the different sensors into one sensor.


Accelerometer + Gyroscope
The accelerometer can tell the orientation of the phone by measuring the gravitational forces.
The gyroscope measures the changes in the orientation which means when you start the gyro it won’t be able to tell you what orientation the phone has but it can tell when and how much the orientation changes.
The motion API combines these two values to get the phone's orientation with the accelerometers and uses that as a baseline and then adjust these values with changes from the Gyroscope.
The gyro has a tendency to drift over time so the accelerometer will be used to adjust the gyroscope from time to time.


Compass + Gyroscope
The compass is a slow sensor and is used the same way as the accelerometer as a baseline for the gyro.

The Motion API uses the compass to get the heading (North) and then uses the gyro changes to adjust the bearing.
Since the gyro has a tendency to drift (as I mentioned before) the compass will be used to adjust these values over time.

The compass is also very sensitive to magnetic fields and jumps around a lot, the gyro will smooth these readings out.


The gyro do not contribute with any “new” values, the accelerometer and compass will do just fine when it come to retrieving the phone's orientation and which way it is facing however it will speed up these readings and make them a whole lot smoother.

The gyro is also more precise for smaller movements.


I’m definitely seeing to that my next phone will have a gyroscope, it makes the augmented reality experience a whole lot better.

Posted in Windows Phone