LSM303DLM Acceleration output is unstable

Dear all,

I’m working on 3 Axis Compass using LSM303DLM with PIC16F1936 Controller. In this Project my I2C Interface is working good. I’m able to read Stable Magnetic Sensor Reading very well. But when i try to read Accelerometer reading, the readings are fluctuating even if the Sensor is not moving. What could be the problem. Kindly guide me.

Thanks

You are probably just seeing normal sensor noise. Post an example of the output.

This is what Im getting with Default Settings of Gain in both Sensors

Mx: 0077 My:-0134 Mz:-0482 Ax: 0128 Ay: 0080 Az:-0080
Mx: 0077 My:-0138 Mz:-0485 Ax:-0048 Ay: 0096 Az: 0112
Mx: 0076 My:-0137 Mz:-0486 Ax: 0016 Ay: 0256 Az: 0224
Mx: 0080 My:-0135 Mz:-0482 Ax: 0064 Ay: 0256 Az: 0016
Mx: 0080 My:-0138 Mz:-0482 Ax:-0256 Ay:-0080 Az:-0064
Mx: 0079 My:-0134 Mz:-0482 Ax: 0224 Ay: 0112 Az:-0128
Mx: 0082 My:-0137 Mz:-0482 Ax:-0080 Ay: 0064 Az:-0176
Mx: 0076 My:-0137 Mz:-0484 Ax: 0160 Ay: 0272 Az: 0432
Mx: 0078 My:-0137 Mz:-0484 Ax: 0272 Ay: 0256 Az: 0192
Mx: 0083 My:-0137 Mz:-0481 Ax: 0192 Ay:-0016 Az:-0064
Mx: 0076 My:-0136 Mz:-0484 Ax: 0016 Ay: 0224 Az: 0128
Mx: 0084 My:-0135 Mz:-0480 Ax:-0080 Ay: 0192 Az: 0032
Mx: 0079 My:-0136 Mz:-0484 Ax: 0128 Ay:-0064 Az: 0176
Mx: 0077 My:-0137 Mz:-0483 Ax:-0080 Ay: 0160 Az: 0080
Mx: 0079 My:-0138 Mz:-0483 Ax:-0032 Ay: 0192 Az:-0240
Mx: 0075 My:-0137 Mz:-0484 Ax: 0000 Ay: 0240 Az: 0096
Mx: 0082 My:-0137 Mz:-0481 Ax:-0096 Ay: 0080 Az: 0112
Mx: 0080 My:-0137 Mz:-0480 Ax:-0240 Ay: 0112 Az: 0112
Mx: 0074 My:-0138 Mz:-0484 Ax: 0176 Ay: 0288 Az: 0000
Mx: 0078 My:-0138 Mz:-0481 Ax: 0144 Ay: 0064 Az: 0176
Mx: 0075 My:-0135 Mz:-0483 Ax:-0048 Ay:-0064 Az: 0192
Mx: 0077 My:-0136 Mz:-0483 Ax:-0176 Ay: 0000 Az: 0272
Mx: 0081 My:-0137 Mz:-0480 Ax: 0192 Ay:-0048 Az: 0224
Mx: 0076 My:-0136 Mz:-0482 Ax: 0384 Ay:-0208 Az:-0208
Mx: 0083 My:-0134 Mz:-0481 Ax: 0128 Ay: 0320 Az: 0016
Mx: 0078 My:-0134 Mz:-0483 Ax:-0048 Ay: 0176 Az:-0112
Mx: 0078 My:-0137 Mz:-0484 Ax:-0048 Ay: 0144 Az:-0128
Mx: 0086 My:-0136 Mz:-0483 Ax: 0048 Ay:-0016 Az: 0256
Mx: 0076 My:-0137 Mz:-0486 Ax: 0192 Ay: 0128 Az: 0272
Mx: 0083 My:-0134 Mz:-0483 Ax: 0080 Ay: 0176 Az: 0336

Magnetic Reading are pretty stable but acceleration readings are unstable.

Kindly guide

There is something indeed wrong, because the acceleration due to gravity is not evident.

One possibility is that the code is incorrectly ordering the data bytes, but there are other possibilities. Post the code, using code tags.

You should check the magnetometer readings as you rotate the sensor. The readings should be consistent with the direction of magnetic North.