Can someone explian the lib for me Arduino_LSM9DS1

0

Am using arduino nano 33 Ble and am using the Lib Arduino_LSM9DS1 am trying to understand the equation but i dont get it

they say: data[0]*4/32768 wher the lsb 32768. it should be a 16 bit rigester where the lsb should 2^16 = 65536. or hier they use -+ 32768 ?. and what exactly 4 ? why they use this rang not a an 8 or 16 ?

can somone explin it to me ? and how exactly get the acceleration and in which unit ?

thanks

int LSM9DS1Class::readAcceleration(float& x, float& y, float& z)
{
  int16_t data[3];

  if (!readRegisters(LSM9DS1_ADDRESS, LSM9DS1_OUT_X_XL, (uint8_t*)data, sizeof(data))) {
    x = NAN;
    y = NAN;
    z = NAN;

    return 0;
  }

  x = data[0] * 4.0 / 32768.0;
  y = data[1] * 4.0 / 32768.0;
  z = data[2] * 4.0 / 32768.0;

  return 1;
} 
  • Accelerometer range is set at ±4 g with a resolution of 0.122 mg.

The formula converts from a signed 16-bit integer to +/- 4.0g.

1 Like

Thanks
but when they callculat the magnetfeld they use the Rang in the data shit multipel 100 ?

is there any explain for that ?

int LSM9DS1Class::readMagneticField(float& x, float& y, float& z)
{
  int16_t data[3];

  if (!readRegisters(LSM9DS1_ADDRESS_M, LSM9DS1_OUT_X_L_M, (uint8_t*)data, sizeof(data))) {
    x = NAN;
    y = NAN;
    z = NAN;

    return 0;
  }

  x = data[0] * 4.0 * 100.0 / 32768.0;
  y = data[1] * 4.0 * 100.0 / 32768.0;
  z = data[2] * 4.0 * 100.0 / 32768.0;

  return 1;
}

why the 100 ?
it should be
x = data[0] * 4.0 / 32768.0; ??

So you didn't bother to follow the link to the documentation that says:

  • Accelerometer range is set at ±4 g with a resolution of 0.122 mg.
  • Gyroscope range is set at ±2000 dps with a resolution of 70 mdps.
  • Magnetometer range is set at ±400 uT with a resolution of 0.014 uT.
  • Accelerometer and gyroscope output data rate is fixed at 104 Hz.
  • Magnetometer output data rate is fixed at 20 Hz.
1 Like

Thanks

but it should 119 hz also ? i guess there are a wrong info

More likely, failure to read and understand the documentation.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.