Calculating tilt from acceleration
Here is the demonstration how tilt is calculated from acceleration. We assume here that 3-axes accelerometer experiences only 1g gravity acceleration.
Now lets try to move the object. We can see that motion acceleration added to gravity leads to incorrect tilt calculations.
Calculations
I follow this formula for calculating angles of x and y axes:
angle_y = arctan(y/(sqrt(x*x-z*z)))
and
angle_x = arctan(x/(sqrt(y*y-z*z)))
,
where x,y and z – accelerations along axes (in g’s). These formulas have some disadvantages.
Orientations of axes must be used to calculate correct angle.











Hi, have you got any idea how to overcome that problem ? Could we use the gyroscope data to correct that difference ?
BTW how did you read the witilt output?
Regards,
René
@René
Acceleration along some axis can be registered without rotation (e.g. parallel shift), so gyroscope will detect nothing. For accelerometer there is no difference between free-fall acceleration and movement acceleration. That is why I believe, that there is no equation for calculation tilt (or position) using only instantaneous measurements of accelerometer and gyro.
Theoretically, if IMU has 3 axis accelerometer with 3 gyros on each axis then we can integrate rate of turn (gyro output) and get angle (tilt along each axis). By integrating accelerometer measurements we can get position (also theoretically). In practice, sensors data is noisy, so we’ll get not very accurate drifting results.
Unfortunately I have not experimented with gyroscope yet (my witilt has only 1 gyro on z axis). But I suppose that Kalman Filtering algorithm can help to overcome this problem. It is used to estimate position (i.e. path) by accelerometers and gyros measurements.
I read RAW data from witilt using my program that I created using C#. It simply reads data from COM port associated with Bluetooth device.
Im getting trouble of reading raw data fr witilt….
Can i have ur source code for reference?
Thanks…
@Chi Yong
Sure, I will try to post source code this weekend.
Did you connect to the device and can you see Witilt’s data using console as shown on the following link?
http://blog.avangardo.com/2010/09/witilt-wireless-accelerometergyrotilt-controller/