Go Down

Topic: Self Balancing Robot (Read 462 times) previous topic - next topic


I'm making a self balancing robot with an Adafruit 10DOF IMU (http://www.adafruit.com/product/1604)
I need help with converting the accelerometer raw data [m/s^2] into degrees of tilt.

Does anyone know the logic behind it?
I tried to get the documentation, but can't seem to figure it out.

Any help would be greatly appreciated.



Nov 23, 2015, 06:16 pm Last Edit: Nov 23, 2015, 06:18 pm by DuaneDegn
A single axis of the accelerometer will experience an acceleration from gravity based on this equation.

a = g * cos(θ)

So if you have "a" from your sensor, then you can compute the angle with the equation:

θ = cos-1(a/g)

cos-1 is also known as the arccosine or acos.

The angle returned from an acos function will likely be in radians.

One problem you are likely to have, is the accelerometer can't tell the difference between the acceleration from gravity and the acceleration from the motors. You really need to use gyros and accelerometers together to keep a balancing robot upright.

Go Up