Electronic – Gyroscope Problem

gyromicrocontroller

I am working at a project which requires to determine the roll of a device. I studied the method through I can do this and I find that an IMU (Inertial Measurement Unit) could help me. I started with the gyro but I do not know sure if it works correctly. Gyro starts to drift too quickly, if I roll in one direction the gyro angle is about 10 degrees shifted. I am using the STM L3GD20 gyro module. If somebody could explain me if this is normal I will appreciate.

Best Answer

Just to add a bit more explanation to the why's of using a gyro vs accelerometer for orientation: A gyro gives rotation rate, so to get orientation, we have to integrate:

orientation = Integrate(gyro_data, dt) + C

The C tells us we never get absolute orientation, only relative orientation. With the accelerometer, at least we get an absolute orientation with respect to gravity.

The integration tells us that our noise will accumulate over time, and our value for orientation will become worse as time goes on. We do not need to integrate to get orientation from accelerometer. Even if our gyro has less noise than our accelerometer, it might still make sense to use the accelerometer. It depends on the relative noise levels and how long you plan to sample.

Where the gyro shines is during dynamic motion of the device. We can use the combination of the gyro and accelerometer to better distinguish linear motion from change in orientation.