Electronic – Temperature compensation of LSM303DLHC accelerometer / magnetometer

accelerometercalibrationsensortemperature

ST Microelectronics makes the LSM303XXXX, a popular range of 3-axis accelerometer / magnetometer sensors that are used on Arduino breakout boards, etc.

The older LSM303DLH sensor has been replaced by the LSM303DLHC with has improvements in power and data transfer. However, the new LSM303DLHC sensor has a zero-g acceleration delta of 0.5mg/deg compared to the much tighter 0.1mg/deg for the older LSM303DLH.

Using the newer sensor, variation with temperature is noticeable in our data. Fortunately, the LSM303DHLC has a temperature sensor onboard.

  • What method should I use the compensate for sensor drift using the temperature readings? Just a look-up table / simple formula?

  • For batches of instruments (10 – 100) is there any alternative to calibrating each instrument?

  • Will the effect of temperature change over time? i.e. how long until another temperature calibration needs to be done?

EDIT: mg units

Best Answer

In order to compensate for temperature drift, you need to place your accelerometer in a temperature chamber (e.g. these) and concurrently record both temperature and raw acceleration values while slowly changing the chamber temperature over the range of interest (ideally about ~1°/minute). If your accelerometer is well placed, you know that the true value you should be measuring is [0, 0, -9.81 m/s] and any deviation has to be due to temperature drift. Based on this, you can apply some kind of fit to the measured data to build a calibration that you subsequently use to predict the drift based on the measured temperature.

My experience is the following:

  • A polygonal fit of order 3 is enough to implement the calibration. Depending on the temperature performance of your particular sensor (I haven't tested it), a linear fit may be sufficient.
  • The sensor gain (the factor that convert from raw value to G) is relatively immune to temperature, but the sensor offset (additive value) is temperature dependant.
  • For sensor types that are prone to temperature drift, there is a high degree of sample-to-sample variation. You should thus consider calibrating every single parts.
  • More recent parts, such as the LIS3DH, exhibit much lower temperature drift as older parts. This particular one could go without temperature calibration for most applications but the most demanding.