From Acceleration to Degrees

Hardware used : The discussion is based on the STM32-103STK board but rely on every other that use accelerometer :

The Game ball code given from Olimex website use the

Get MMA coordinates (X,Y,Z) 

that convert the LIS3LV02 accelerometer measurements to “mouse coordinates”.

My question is in the same way to convert the accel. measures to degrees instead of coordinates.

Has anyone already done it ?

You cant. If you integrate acceleration you get the speed, integrating the speed you get the position. If you want to get an angle you should integrate the output of an inertial (IMU) sensor, so integrating angular rate.

Thanks for your reply.

I understand what you mean, this can’t be if we are in a 3 axes freedom, but can’t it be extrapolated if we “lock” an axis :

as a simple example if the measurements are taken from a bike : the Z axis is not used and for simplicity consider that we only want to know how much degrees the driver is doing righ or left :

can’t it be interpreted from the LIS ?

If you intend to use LIS sensor as an static measuring device, than this could work fine, you should convert cartesian coordinate system in spherical coordinate system (look Matlab’s cart2sph):

theta=atan2(y,x)

phi=atan2(z,sqrt(x^2+y^2)

r=sqrt(x^2+y^2+z^2)

Where theta and phi are azimuth and elevation angles, r is the absolute value of acceleration (sum of all three axes, it should be 1g if it is intended for static measuring).

atan2 is a enhanced function of arctangens(x) in other words its a four-quadrant arctangens.

If the measurements are taken from a bike you would get the dynamic components superimposed. At least you should implement a very large averaging filter.

What do you mean by “Superimposed” ?,

it sems that I have to look for an inclinometer, is it ?

My english is not very good, with superimposed I meant that dynamic signal is added over a static signal.

Yes, what I have suggested you is an inclinometer. But inclinometer will not work on biclycle when driving, because if you ride in a circle then the centrifugal force keeps you on the bicycle and you will not measure the right angle. It remembers me the a video of a Dakota pilot making loopings and airleron rolls with a glass of water on the instrumental panel without spiling water.

OK I understand now.

Yes you are right, the centrugal energy should be taken in count as the weight of the reference i.e. : the driver + the bike’s one.

That said, if you turn around a circle, the sensor should not be fixed on you but into your bike, as we want to measure the bike-ground angle.

The WiTilt from Sparkfun is a triple axis accelerometer. The code has a mode where it converts the accelerometer measurements into degrees.

You can download the sample code from the product page (http://www.sparkfun.com/commerce/produc … ts_id=8563)

and then look at the degreeDisplay function. The code is a little messy but you can get an idea of how to do it.

Also, if you download the WiTilt datasheet, the equations for how to do this can be found on the last page.