Help! Magnetometer drift over time

Thread Starter


Joined Nov 18, 2020
Hello, First off, I have to say I am relatively new to magnetometers.

I have been working in a project for the detection of magnets (they can be different sizes) in a three dimensional space around the sensor.

The magnets and sensor positions are not strictly defined and they can be in any orientation in space. I am now using the LIS3MDL board to try and accomplish this.

I am able to use SensorLab library with MotionCal to obtain relatively good values for calibration. I then use the calibrated magnetometer output values to calculate the magnitude of the magnetic field. By continuously reading the sensor, I check for the increase or decrease in the magnitude value which occur when a magnet approaches from any direction.

The problem I have is that over time the sensor will experience drift in the measurements. This will cause the magnitude value, which before was relatively stable, to change a lot as I rotate the sensor.

Is there any way to combat this?

I have by now done some research and have not reached any answer. Any tips or knowledge would be appreciated.

Thank you in advance for any help, really!