LIS3MDL Magnetometer Calibration

Hi, I don’t quite understand how to use the calibration example in the LIS3MDL library. It doesn’t look like there’s a function in the example to update the calibration parameters on the chip. Is there a way to do this? Or do I need to make a correction to the readings in my client code? Thanks so much for your help!

The calibration parameters go in your code.

You may find this post, which describes a more effective approach, to be useful: Correcting the Balboa magnetometer


You are right, the Calibrate example does not use the calibration constants it finds to update any of the magnetometer registers. The values printed by that example can be directly used in the example code for our other products, like the LSM303’s Heading example or our AHRS code. If you’re writing your own program, you can use the calibration values in your code in a similar way.