Orientation of the LSM303 accelerometer axes

I am using the following library

I get the value not raw, but in units of m/s²
By default, the board orientation is horizontal: X to the north, Y to the west, W to the top.
In my device I place the board vertically, i.e. The Z axis already points to the side, the Y axis down.
When I used the BMI160 sensor, there were no problems with the orientation of the board.
I just added the code and initialized the board reorientation, i.e. changed the accelerometer axis, which will be considered zero.

    BMI160.autoCalibrateAccelerometerOffset(X_AXIS, 1);
    BMI160.autoCalibrateAccelerometerOffset(Y_AXIS, 0);
    BMI160.autoCalibrateAccelerometerOffset(Z_AXIS, 0);


I wrote a post about this problem, but received no answers.

Although I solved the problem.
With the LSM303 accelerometer everything is more complicated, because...
Even in the datasheet I did not find information on how to change the orientation of the board.
There are no examples of these on the Internet either.
Does anyone know if it is possible to change the initial orientation of the board with the LSM303 accelerometer sensor?
Also a related question.
When I receive data from LSM303, the Z axis in the normal position does not produce the maximum range, about 8.35 m/s²
When you turn the board over, the Z axis shows a value with a minus and it is somewhere around 10.52 m/s²
That is, when the Z axis looks up, then 1.46 ranges are missing up to 9.81 m/s².
And when the Z axis is directed downward, then these 1.46 are added to - 9.81 m/s².
Although inverted, it is added to 1.46, but a little less.


and

Is there something wrong with the sensor or calibration?

Needs to be calibrated. Either follow this simple approach (six point calibration) or this much more general and accurate approach. Adafruit also has a tutorial, with code, for their modules.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.