InvenSense Inc. manufacture the MPU6050 Gyro and Accelerometer which AllMyServos uses with the Raspberry Pi.
Raw sensor data is scaled to:
- Accelerometer: -2 / +2 g
- Gyro: -500 / +500 degrees
Accelerometer data is then filtered using a lowpass filter which isolates the effect of gravity. This can be used to calculate roll, pitch and yaw angles. Compared to the gyroscope data, changes take longer to register but the orientation is more accurate over time.
The gyroscope reports changes in rotation about the x, y and z axis (up to 500 deg) between samples. This data tracks sudden changes accurately but it is also subject to drift which makes it progressively less accurate over time. These two measurements are combined using a complementary filter to produce a final roll, pitch and yaw.
The effect of gravity on the IMU is demonstrated using an artificial horizon. The complementary filter is demonstrated using orthographic images which represent roll, pitch and yaw.
Some Inertial Measuring Units also include a Magnetometer which helps determine the absolute orientation. The MPU6050 does support daisy chaining to a magnetometer and this is certainly an area for further development.