Go Down

Topic: How to: tilt measurement with an accelerometer? (Read 1 time) previous topic - next topic


Oct 29, 2009, 09:45 pm Last Edit: Oct 29, 2009, 11:42 pm by madepablo Reason: 1
I have an adxl335 accelerometer working with an arduino duemillanove.

I used a example sketch, included in the arduino 0017 software, to read acceleration. It seems to run, but i am interested on tilt measurement.

There are different post at this forum related to this and other accelerometers, but in any case is explained how to measure tilt by this sensor.

Any idea?

Thanks in advance!


Oct 30, 2009, 01:25 am Last Edit: Oct 30, 2009, 09:05 pm by madepablo Reason: 1
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]

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

So, is it right?

UPDATE: here it is where is saw the equation:

UPDATE 2: here there is more information


Other problem is how to know the sensibility AV/Ag. is it located in the datasheet?

300mV per g (VS = 3V) from the datasheet.

Make sure your input data is well filtered - the sine of a small angle is also very small.
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


Thanks AWOL,

I will try to develop an sketch along this weekend and post it here soon.

Go Up