Posts: 31
Joined: Fri Aug 22, 2014 7:07 am

LSM9DS0 using yaw as direction only?

Sun Jun 16, 2019 9:41 am

Hi all,

I have a project where I have the need of a compass. I've come quite far and got somewhat ok results using a LSM9DS0 along with with this library: ... ss-filters

In short, you calibrate the magnetometer and use those values as a base for the other scripts and you got a working compass that tilt compensates as well.

The calibration takes care of the hard iron issues one might have and I get fairly accurate numbers. However, due to soft iron, 0 and 180 degrees are accurate roughly down to a single degree but 90 and 270 are 10-20 degrees off. This is indeed quite good for a ~30 USD sensor but I need more accurate than that for my project.

That got me thinking... wouldn't it (in theory at least) be easier to take the magnetometer out of the equation and just use the acc and gyro to get a relative heading? That way, I would get rid of the issues with calibrating the magnetometer and just use a relative heading (yaw) instead, which I easily can offset to true north. Or would this just produce more inaccurate figures?

All I need is a working compass that is accurate within 1-2 degrees all the way around (that has tilt compensation as well). What would be my best choice? I will be using this for an autonomous boat project.

Return to “Automation, sensing and robotics”