Mahony AHRS Arduino code for LSM9DS1 9DOF sensor

Working AHRS Arduino code has been posted for the LSM9DS1 breakout, based on the Mahony fusion filter. I also posted code for a tilt-compensated compass and detailed instructions and code for accurately calibrating the accelerometer and magnetometer.

The AHRS code requires the Sparkfun LSM9DS1 library. With default sample rate settings, the update rate is 80Hz on a 16 MHz Arduino Pro Mini, and the code takes up less than half the flash memory.

The LSM9DS1 sensor performs far better than the obsolete MPU-9250 and also better than any other consumer grade IMU I have tested.

The Adafruit LSM9DS1 breakout was used for the development as it has on board level shifters for 3V and 5V processors, but the code will be fine with the Sparkfun breakout and a 3.3V processor.

Download at GitHub - jremington/LSM9DS1-AHRS: Mahony 3D fusion filter and tilt compensated compass, with sensor calibration code

Note: The X, Y and Z accel/gyro axes DO NOT form a right handed system, contrary to the Sparkfun breakout board product description. This is corrected in the code.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.