Hi,
Thanks for your inquiry.
BMX160 includes BMI160 IMU and BMM150 magnetometer inside, where BMM150 is connected to BMI160's secondary I2C interface. Please use BMI160 API source code online at https://github.com/BoschSensortec/BMI160_driver to configure BMM150 and get BMM150 raw data in the unit of uT.
You cannot directly use BMM150 raw data in the unit of uT to derive pitch/roll/heading angles, because those raw data is not compensated for offsets of x/y/z axes. This means that if you plot BMX160 mag data in 3D space when you rotate your device randomly in 3D space, you will see a shifted sphere or ellipsoid. You will need to determine the offsets so that you can apply them to the collected BMM150 raw data to move the sphere or ellipsoid to the center [0, 0, 0]uT. Then in the future you can always apply thses offset to BMM150 raw data to derive heading angle. For pitch and roll angles you need an accelerometer for tilt compensation. BSXLite library can do mag calibration and tilt compensation for the final pitch/roll/heading Euler angles.
BSXLite library can be downloaded online at https://www.bosch-sensortec.com/software-tools/software/sensor-fusion-software/. You can also search this community here for similar topics.
Thanks.
... View more