Pages: [1]   Go Down
Author Topic: An Arduino Library for compass tilt compensation and hard iron offset  (Read 2019 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 6
I love YaBB 1G - SP1!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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:

Enjoy!  smiley-lol Please give us feedback, so we can improve it.

Global Moderator
Online Online
Shannon Member
Karma: 224
Posts: 13915
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Impressive work, well done!

Rob Tillaart

Nederlandse sectie -,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: