Problems with Accelerometer's reading from MinIMU-9 v2

Hi.

I am using MinIMU-9 v2 with an Arduino Mega 2560 Rev3. I have tried with the example code to get the angles roll, pitch,
and yaw, and it works well. However, when I tried the “Calibrate” example from LSM303 Library, I found that the
readings from the accelerometer is always divisible by 4 (i.e. -4 8 0 4 16 256 260 and so on.) I also tried the “Serial” example
in LSM303 Library which shows the readings from the accelerometer and the magnetometer, and the accelerometer’s
readings are also divisible by 4. Has anyone encountered with this kind of problem? Or is it normal?

Thank you.

Hello.

This is normal and isn’t actually a problem. You can get higher resolution readings with more bits of data if you enable the high resolution output mode on LSM303, by setting bit 3 (0x08) to 1 in the LSM303_CTRL_REG4_A register.

–David

Ok I see.
I try this and it works well now. Thank you very much David.

This is also a problem in MinIMU9AHRS code. Originally, the code was written in the function Accel_Init() in I2C.ino as

compass.writeAccReg(LSM303_CTRL_REG4_A, 0x08); // high resolution output mode
compass.writeAccReg(LSM303_CTRL_REG4_A, 0x20); // 8 g full scale: FS = 10 on DLHC

so the high resolution output mode is overwritten by the second line here.

The code should be changed to

compass.writeAccReg(LSM303_CTRL_REG4_A, 0x28);

to keep both the 8g full scale and the high resolution output mode enabled.