I saw this equation on internet, but i am not sure if it is correct and how to apply it...
Vout = Voffset + [(AV/Ag)x1gxsinB]
where:
Vout is the voltage readed into the analogical pin (calculated from the lecture from the 1024 levels)
Voffset is the voltage at 0g acceleration
AV/AG is the sensibility
g is the gravity on earth
and B is the tilt angle.
I suppose that Voffset is the voltage when the sensor is not in movement and the lecture in arduino is 512 --> 2.5Volts. Is it correct?
Other problem is how to know the sensibility AV/Ag. is it located in the datasheet?
i suppose that g could by 9.8 m/s^2, although an aprox. of 10 m/s^2 could be also valid.
So, in theory, the final equation to derive B is:
B = arcsin [(Vout-Voffset)/(AV/Ag)]
In theory we obtain the tilt angle B in degrees for one of the axis. If we repeat the calculation taking into account the values of the different pins, we could obtain the tilt for x, y and z