Accelerometer at 16g outputs wrong values
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,
There is an error.
When calculating the scale for the sensitive one cannot use SCALE/32768. This formula works others for all the others sensitivities on the accelerometer but fails for the 16G.
According to the datasheet:

but 16/32768 does not correspond to the sensitity value. However 24g will give that value. I have contacted ST to advise.
for 16g:
x = data[0] * 0.000732;
y = data[1] * 0.000732;
z = data[2] * 0.000732;
or 0.732 / 1000