Hello,

We have been working on a new arduino library for compass tilt compensation and hard iron offset. Its finally complete today, so I thought I would share it with the arduino community.

The three main parts are:

1) Compass Hard Iron Offset Auto-Solver

2) Accelerometer Yaw Pitch & Roll Calculator

3) 360° Compass Tilt Compensation

The auto solver is a Gaussian elimination solver requiring at least 6 datasets, the code included will filter and capture 8 datasets around the sphere and compute the best solution possible. Tilt compensation is not angle limited, it will compensate in any orientation. All the calculations that need to be done in the loop() are using fixed point integer math. The library has 3 examples that use the Honeywell HMC5883L 3 axis compass and the Freescale MMA8453Q 3 axis accelerometer. However any 3 axis compass & accelerometer pair will do.

The library and a more descriptive blog entry can be found here:

http://n0m1.com/2012/02/27/6dof-arduino-compass-accelerometer/

Enjoy! XD Please give us feedback, so we can improve it.