Self Balancing Robot

I'm making a self balancing robot with an Adafruit 10DOF IMU (Adafruit 10-DOF IMU Breakout - L3GD20H + LSM303 + BMP180 : ID 1604 : $29.95 : Adafruit Industries, Unique & fun DIY electronics and kits)
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.

Abhishek

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.