Pages: [1]   Go Down
Author Topic: How to: tilt measurement with an accelerometer?  (Read 728 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 0
Posts: 471
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
« Last Edit: October 29, 2009, 05:42:01 pm by madepablo » Logged

Offline Offline
Sr. Member
****
Karma: 0
Posts: 471
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I saw this equation on internet, but i am not sure if it is correct and how to apply it...

Quote
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:

Quote
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:
http://www.freescale.com/files/sensors/doc/app_note/AN3107.pdf

UPDATE 2: here there is more information
http://www.freescale.com/files/sensors/doc/app_note/AN3461.pdf
« Last Edit: October 30, 2009, 03:05:03 pm by madepablo » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26274
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Other problem is how to know the sensibility AV/Ag. is it located in the datasheet?
300mV per g (VS = 3V) from the datasheet.
http://www.analog.com/static/imported-files/data_sheets/ADXL335.pdf

Make sure your input data is well filtered - the sine of a small angle is also very small.
Logged

"Pete, it's a fool 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.

Offline Offline
Sr. Member
****
Karma: 0
Posts: 471
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks AWOL,

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

Pages: [1]   Go Up
Jump to: