Skip to content

Accelerometer at 16g outputs wrong values #14

Open
@PhySan0111

Description

@PhySan0111

Hi all,

I used your library with some small changes. Instead of using 4g for the accelerometer, I tried to switch to 16g. So, I modified the following lines:
in the begin method used: writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0x88);//0x70 is 119 Hz, 4G, and 0x88 is 238Hz, 16G

Then in the readAcceleration methods to:

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] * 16.0 / 32768.0;
  y = data[1] * 16.0 / 32768.0;
  z = data[2] * 16.0 / 32768.0;

  return 1;
}

When reading the data with the arduino faced up I read values like this:
0.02 0.03 0.68
which does not seem correct since z, should output 1.0g
After further investigation I use 24.0g for the scale and the output was correct and as expected
Am I doing some wrong? or am I the only one facing this problem?

Thanks in advance

Best regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions