Skip to main content
Mgans.1
Visitor II
November 22, 2021
Solved

I have a LSM303AHTR Mag/Accel burned on a board located in a whiffle ball and need to turn the 3-axis data into feet and inches?

..

This topic has been closed for replies.
TSand.1
TSand.1Best answer
Visitor II
November 23, 2021

Hi, you just have to apply first the conversion from LSB into milli -g, as for example described in the https://github.com/STMicroelectronics/lsm303ah/blob/master/lsm303ah_reg.c

float_t lsm303ah_from_fs2g_to_mg(int16_t lsb)
{
 return ((float_t)lsb * 0.061f);
}

Since a milli-g is 10^-3 * 9.81m/s^2, if you want inches or feet you have to apply the conversion from meter into the target units:

  • Feet: 32.2 feet/s^2
  • Inches: 386.2 inches/s^2

1 reply

TSand.1
TSand.1Best answer
Visitor II
November 23, 2021

Hi, you just have to apply first the conversion from LSB into milli -g, as for example described in the https://github.com/STMicroelectronics/lsm303ah/blob/master/lsm303ah_reg.c

float_t lsm303ah_from_fs2g_to_mg(int16_t lsb)
{
 return ((float_t)lsb * 0.061f);
}

Since a milli-g is 10^-3 * 9.81m/s^2, if you want inches or feet you have to apply the conversion from meter into the target units:

  • Feet: 32.2 feet/s^2
  • Inches: 386.2 inches/s^2