Building a Calibrated Tilt Compensated Compass with the LSM303

The LSM303 Breakout is a nice little compass module that consists of a triple axis accelerometer and a triple axis magnetometer. When used together this combination of sensors allows the LSM303 to perform 6D orientation detection and provide all the data needed to calculate a tilt-compensated heading. This post introduces an Arduino sketch that allows both calibration of the LSM303 and the saving of calibration data to the arduino's EEPROM. This data can then be recalled to configure the LSM303 for use at a later date. ...more