cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303AGR accelerometer disappointing accuracy

GDemu.1
Associate

0693W000001ceuOQAQ.png

I configured LSM303AGR accelerometerit for high accuracy mode 50Hz and I am reading it at 20 Hz via i2c.

The xyz signals are very unstable, and the final angle calculated (see figure) has huge variations. 2 degrees is far from what my expectations for a component described as "high accuracy 12 bit". What am I doing wrong?

Here is my code

void configure_inclinometer(){

 Wire.beginTransmission(0x19); // Set accel

 Wire.write(0x20);            // CTRL_REG1_A register

 Wire.write(0x47);            // 50 Hz, normal power, all 3 axis enabled. 0x47 0b0100 0111

 Wire.endTransmission();

 Wire.beginTransmission(0x19); // Set accel

 Wire.write(0x23);            // CTRL_REG4_A register

 Wire.write(0x08);            // continuous update, littleendian, 2g, high resolution, 4-wire spi //0x08 0b0000 1000

 Wire.endTransmission();

}

2 REPLIES 2
Eleon BORLINI
ST Employee

Hi @GDemu.1​ , can you try with enabling the? I'm afraid that if the data are issued every 20ms (50Hz) and you read them every 50ms (20Hz), there could be some kind of misalignment... I suggest you to set the BDU bit in CTRL_REG4_A (23h), to wait that the output registers are not updated until MSB and LSB have been read. Please note that if you have some errors in the acceleration, you will integrate this error when calculating the velocity and space parameters. Btw, if your application is the inclinometer, you should be interested to very low (quasi-static) acceleration variations, so I suggest you to set at least a low pass filter enabling the FDS bit in CTRL_REG1_A (20h) register, if you don't want to change the other ODR-related settings (p. of the datasheet). There is however a device specifically designed for the inclinometer application in the ST sensors portfolio, the IIS3DHHC. Regards

GDemu.1
Associate

I think that it is ok to read at lower frequency than the conversion frequency. It means that I skip to read some conversions.

I tried to read at 20 Hz setting the accelerometer conversion to 10 Hz and as expected I get about two consecutive identical reads.

I have enabled the BDU but there is no change. If there was a random bit in the wrong place we would see non-sense numbers, not noise.

From the datasheet I read that the noise in the output should be 3 mg RMS (at 100 Hz), which means 50 count. For my data at 20 Hz I calculated about 140 count RMS noise.

I am not blaming anyone, I just want to get the best out of this accelerometer.

About the filter: I prefer to filter in my program and have full control of it.

Could it be a hardware problem?

Increasing the capacitance near the accelerometer would reduce the noise in the output?

I haven't followed exactly the application hints.

What is the role of the capacitor C1 on pin 5? I have 100 nF there (instead of 220 nF recommended).

Vdd_IO and Vdd are connected together and 100 nF (datasheet suggest 2x100 nF plus 10 uF). I am 5 cm from the DC-DC converter, that has 22 uF ceramic output capacitor. Adding 220 uF in parallel has no effect on the accelerometer readings.