# MPU9250 Gyro Calibration-Offset

I'm working with mpu9250 gyroscope and I got fine measurements for beginning period (few minutes). I calculated offset at start in manner to average sum of first 1000 results from mpu9250 gyro. But If I put mpu9250 on one place and I don't move it I got accumulated error of axes. For example after 5min I got offset of pitch ~1.2degree, roll ~2.5degree and yaw ~1degree.

Does anyone have idea how to solve this or what is there happening? I assume that mpu9250 need some movement each period (for example mpu9250 need position change every 10sec to avoid accumulating of error)

• Please give more detail. How do you calculate the angles? Integration of gyro samples or a special filter(madgwick..) ? Have you heard a 'drift' term which is related to gyroscope? Feb 26, 2021 at 14:59
• You can avoid from long term drift using kalman filtering or getbetter results applying some techniques high pass filtering. Feb 26, 2021 at 16:09
• @BerkerIşık Sorry for later answer from me.. I use integration method. I heard for that and I'm trying to figurate out how to solve drift with some filter or proper integration Mar 1, 2021 at 14:31
• I try to use Complementary filter where accelerometer is involved in formula. Basically I use something like this: pitch = 0.82 * gyro_pitch + 0.18 * accel_pitch, roll = 0.82 * gyro_roll + 0.18 * accel_roll. I think this is sort of Kalman filter right? I'm still struggling to cancel accumulating error. I found that gyro gives error when mpu9250 is in static position (no movement for mpu9250) and accel gives error when I try (for example) to go the 90degree not large error but.. I compare pitch and roll from gyro, accel and complementary calculation that's how I notice when certain device Mar 1, 2021 at 14:33
• What is your Target? If it is calculating orientation but under what conditions? Accuracy criteria? There are a lot of disturbances in low cost IMUs. Drift only one of them. You should consider also temperature drift, noise, vibration, Axis misalignments, vibration, lineer acceleration(this effects your orientation), magnetic enviroment factors... Are you try to find orientation in static conditions(under no axial acceleration-deaccelaration) or what? Give detail please? You can use earths gravity(roll,pitch) or earth`s magnetic field(yaw) instead of gyroscope. Mar 1, 2021 at 21:33