-1

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

the 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 the 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 ?

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;
} 

1 Answers1

0

The documentation states that:

Accelerometer range is set at [-4,+4]g -/+0.122 mg

So, the value returned by the function readAcceleration is in the range [-4,4], representing -4g to 4g

g is the gravitational acceleration = 9.81 m/s2

The code you're showing is the implementation of the function readAcceleration. As I understand it, the raw acceleration data represented as a 16-bit signed integer (between −32,768 to 32,767), which is then normalized (divided by 32,768) and multiplied by 4 to put in the correct range of [-4,4].

Aziz
  • 20,065
  • 8
  • 63
  • 69
  • thanks okey that mean the data what he collect from the write read register multiple with tha rang and divided with with the unsigned lsb the max range of g is 4*9.81 = -+39,24 g – Alaa Mousa Feb 13 '22 at 14:14
  • ± 39,24 m/s² (not g) – Aziz Feb 13 '22 at 14:20