cancel
Showing results for 
Search instead for 
Did you mean: 

LSM9DS1 - how to validate the data received from the magnetometer?

jg_spitfire
Senior

Hi, we have designed a custom PCB with the LSM9DS1 as IMU, we are receiving data from the accel, mag, and gyro, in the case of the accel I think is easier to know if the measure is ok (we must get 1G in the z-axis), but how could we validate if the data of the magnetometer is correct? , is there any expected value? we are not using an ST microcontroller to interface with the sensor.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @jg_spitfire​ ,

please consider first that the Earth magnetic field is about 0.5 gauss, so you should get this result calculating the magnetic field intensity from the 3-axis components.

For the conversion formula from LSB (digits) to physical quantities you can refer to the C drivers on Github for the LSM6DSM1 (lsm9ds1_reg.c).

Considering for example the default Full Scale of 4 gauss, the formula is:

float_t lsm9ds1_from_fs4gauss_to_mG(int16_t lsb)
{
  return ((float_t)lsb * 0.14f);
}

For a general check of the (correct) performances of the magnetic sensor, you can run the self test as reported in the lsm9ds1_self_test.c example.

If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.

-Eleon

View solution in original post

8 REPLIES 8
Eleon BORLINI
ST Employee

Hi @jg_spitfire​ ,

please consider first that the Earth magnetic field is about 0.5 gauss, so you should get this result calculating the magnetic field intensity from the 3-axis components.

For the conversion formula from LSB (digits) to physical quantities you can refer to the C drivers on Github for the LSM6DSM1 (lsm9ds1_reg.c).

Considering for example the default Full Scale of 4 gauss, the formula is:

float_t lsm9ds1_from_fs4gauss_to_mG(int16_t lsb)
{
  return ((float_t)lsb * 0.14f);
}

For a general check of the (correct) performances of the magnetic sensor, you can run the self test as reported in the lsm9ds1_self_test.c example.

If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.

-Eleon

Hi, so I should get 0.5 gauss in each axis?

No, only as vector sum of the 3 axis components, i.e. the sqrt(mag_x^2+mag_y^2+mag_z^2).

-Eleon

Where did you get that info, do you have any application document where specifies that?

It is the Earth magnetic field...

-Eleon

sorry, I mean, is there an application note where specify these specs, calibrations methods, etc?, I found that you have some tools but for your ST boards so I asked for the documents because I am not using an ST board

Hi @jg_spitfire​ ,

specifically for the there is unfortunately no application note for the LSM9DS1...

However, for the specific magnetic sensor component in the LSM9DS1 I would suggest you the AN5069 Application note for the LIS2MDL, where there are a few more examples about the magnetic output and the device configurations.

-Eleon

thanks!