The Z-axis is up out of the chip. Earth’s gravity is down, therefore the reading when the chip is up and level on the Z-axis is -1g.
Reading out the raw 3d data is a good idea to work out the math manually. Depending on what you want to call "0 angle, you need to possibly change signs (±) and use the correct axis in the numerator/denominator for the trig.
The chip actually measures the difference between the force applied to the chip package and the force applied to the sensor itself, which you can think of as a small spring and mass inside the chip.
So, if the chip is sitting still on a table, the table is pushing “up” on the package and the spring+mass and package are being pulled down by the Earth’s gravity. As a result, the chip reports a positive force in the up direction, equal to 1 g. If you experiment a bit, you should see that the signs on X, Y and Z are consistent with that view.
Another consequence of thinking about the sensor this way, is that if the chip is freely falling, it reports 0 g. The forces acting on the package and the spring+mass inside are identical and cancel out.
Thank you Mr Remington, but I am not getting answer for why +/- flips at middle.
May be people are not getting rotation that what I am using. I did tested 0g condition on the table. “X and Y are 0 plus little offset”
Now I am using it as Solder/silkscreen vertically to the ground.
9 - 3 o’clock as horizontal X axis and swing 6 to 12 o’clock. (vertically)
X axis saids from 6:00 to around 7:30 are positive, but it changes negative after 7:30 instead of stay positive till 9:00.
If it stays posi or neg for 90 deg swing, then I am fine. I just rotate PCB 180 deg for what I wnat to see(- for 9 to 12), but I don’t understand that it changes middle.
The procedure was developed for magnetometers but it works perfectly well for accelerometers, providing that you hold the sensor still while each data point is being collected.