Stephen Ellis
Stephen Ellis

Reputation: 2711

Converting 3-Axis Magnetometer Reading and Accelerometer to Compass Bearing (Win 7)

I've been looking at the sensors on my Samsung 700t in Windows 7 using the Location and Sensor API from C#.

I can get access to my onboard 3-axis accelerometer which gives X,Y,Z outputs and a so-called 3-axis Magnetometer which gives a single value output of type 'float' which seems to vary from 120-160 in my current location depending on orientation (i.e. it is not just calculating a bearing).

I see that there are various articles around the web that derive equations for extracting compass bearing from a combination of accelerometer and magnetometer values correcting for location. None of the solutions is trivial, but they also require 3-axes of response from the magnetometer. I don't have access to 3-axes of output from my magnetometer. Can anyone brighter than me explain what's going on and how I might be able to extract a bearing value?

Upvotes: 2

Views: 1666

Answers (1)

Stephen Ellis
Stephen Ellis

Reputation: 2711

It appears that the reading is a bearing reading. It's just heavily damped, slow to react and very sensitive to nearby magnetic fields such as speakers. This was the cause of the incorrect reading. The API was giving back correct results.

Upvotes: 1

Related Questions