I try to measure Earth's magnet field with LIS3MDL. This chip is operable in (-40..+85) deg. When the temperature is lower than -10 deg, the chip measures becomes wrong. The plot of raw measures after soft-iron and hard-iron compensation are in the plot below. Yellow series is the temperature (right axis), blue series is X, orange axis is Y, grey axis is Z.


According AN4602, the chip can compensate thermal drift with internal temperature sensor. This sensor is enabled in my application (yellow series is obtained with another sensor). Why the chip provides wrong magnetic data?

  • 1
    \$\begingroup\$ Some other component is being affected? \$\endgroup\$
    – Solar Mike
    Jul 25, 2018 at 5:34
  • 1
    \$\begingroup\$ Have you tried the same experiment with the temperature compensation disabled? Maybe what you see is compensated version, and uncompensated is much worse. \$\endgroup\$
    – JRE
    Jul 25, 2018 at 5:41
  • 2
    \$\begingroup\$ Maybe we're interpretting the axes differently, but my reading of the graph is that the readings are always affected by temperature, not just temperature below -10C. AFAICS, the temp swings between 25C and -42C? \$\endgroup\$
    – Neil_UK
    Jul 25, 2018 at 5:53
  • \$\begingroup\$ It's probably best to write the units correctly when dealing with magnetic fields and temperatures, otherwise your angle degrees and temperature degrees might get mixed up. \$\endgroup\$ Jul 25, 2018 at 8:06

2 Answers 2


According AN4602, the chip can compensate thermal drift with internal temperature sensor

Not exactly. According to AN4602, the sensor "internally compensating sensitivity drift over temperature variations using an advanced embedded algorithm"

The above means that sensitivity of the device is compensated, not the absolute value. This is confirmed in FAQ on ST online support site:

We do some initial validation of LIS3MDL and experienced a problem when we do
a temperature cycle and no external magnetic field present. It seems like the
sensors get an offset in the output. We have tried to enable the TEMP_EN bit,
but the output is more or less the same.

In LIS3MDL please consider that embedded temperature compensation can be used
to reduce the thermal drift of the sensitivity, while it is not able to
compensate the thermal drift of the offset. Thermal drift can be up to +/-8mG/°C.

LIS3MDL is TMR sensor. New products like LSM303AGR are AMR technology sensors
and in those mechanism is available which is able to remove offset thermal drift.

So, you have two choices here. Either look for their new AMR sensors, or read thermal sensor output and compensate in your software.

  • \$\begingroup\$ How can I be sure whether the sensor is AMR or not? Datasheet has no info. Now I have LSM9DS1 chip, not still tested. \$\endgroup\$
    – maestro
    Sep 19, 2018 at 5:54
  • \$\begingroup\$ Well, from the plot in the question I take it you have the means to test it and decide if the temperature drift is within your requirements. You can also try to contact manufacturer. I only could find that LIS2MDL, LSM303AGR and LSM303AH are AMR. Some manufacturers, like MEMSIC here make a point of emphasizing this feature \$\endgroup\$
    – Maple
    Sep 19, 2018 at 10:45

Magnetometers are very susceptible to temperature. In industry large calibration processes are gone through to accurately model this thermal drift you are seeing, and then compensate for it.

Note: I'm not talking about hard/soft-iron effects (which is changes in the actual magnetic field).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.