2019-05-21 05:14 PM
I am using a LSM303DLHC and setting it up with:
// CTRL_REG1_A (0x20) loaded with 0x27 = 00100111, 10hZ rate,normal power enable X,Y,Z on
Write_Register(ACC_I2C_ADDRESS,0x20,0x27);
// CTRL_REG4_A (0x23) loaded with 0x40 = 01000000, big endian, +/-2g
Write_Register(ACC_I2C_ADDRESS,0x23,0x40);
And reading the registers as follows:
ACC_Data[0] = Read_Register(ACC_I2C_ADDRESS,0x28); // read out x MSB
ACC_Data[1] = Read_Register(ACC_I2C_ADDRESS,0x29); // read out x LSB
But I am betting odd results like:
Ax:-16160 Ay:-16352 Az:192
When the sensor is 'flat' ie X and Y horizontal and Z vertical.
The output range seems to be about zero to -32,000? Is this correct?
Regards Bill Legge
2023-07-05 06:11 AM
The range of the entire 2 bytes is -32,727. However, this gets further divided by 2 because the range of the readings is 2G. 16,000+/- "counts" means that you are reading 1G. This is completely normal.
I agree that is seems like your output should be 32,727 for 90 degrees (gravity), but this is normal behavior.
2023-07-05 09:08 AM
Hi @BLegg ,
@wb346 is right, it is absolutely normal.
In addition I suggest you to enable also Block Data Update (bit '7' reg CTRL_REG4_A (23h)).
If this helps you, please mark my answer as "Best Answer" by clicking on the "Accept as Solution" button, this can be helpful for Community users to find this solution faster.