Using Qwiic to do a fusion algorithm

If I want to use data (gyroscope data and accelerometer data) to correct magnetometer data, do I need something that does a fusion algorithm? What word(s) should I use to search, at the shop page, for something that does that? I’d like for it to be done using Qwiic.

Thank you.

To correct magnetometer data, calibrate the magnetometer. The most comprehensive calibration overview and tutorial is here: https://thecavepearlproject.org/2015/05 … r-arduino/

Simpler calibration algorithms like this one https://www.appelsiini.net/2018/calibrate-magnetometer/ don’t work as well. Once the gyro offsets are removed and the magnetometer is calibrated (optionally, also calibrate the accelerometer), fusion algorithms like Mahony or Madgwick should provide acceptably accurate 3D orientation data.

jremington:
Once the gyro offsets are removed and the magnetometer is calibrated (optionally, also calibrate the accelerometer), fusion algorithms like Mahony or Madgwick should provide acceptably accurate 3D orientation data.

While trying to figure out which SparkFun 9DoF IMU I should get, my searches (which I did using “20948 AHRS”, “20948 Mahony”, “ISM330DHCX AHRS”, “ISM330DHCX Mahony”, “MMC5983MA AHRS”, “MMC5983MA Mahony”, and more) had several results (including one by you) at GitHub. However, I’m not sure how to compare the GitHub results with each other, and even if GitHub can help me find one of the easier ways to use the Mahony algorithm.

Thank you.

I don’t know what would be “easier” for you. This is highly technical material which requires some familiarity with C/C++ coding, and some understanding of what an AHRS 3D orientation algorithm does.

The github example I posted for the ICM 20948 should at least provide some output “out of the box” (make sure the I2C address is correct), but the sensor will require calibration (at minimum, gyro and magnetometer).

Here is an example I posted a few years ago for a different IMU, showing the steps of the magnetometer calibration process: https://forum.pololu.com/t/correcting-t … eter/14315