IMU Yaw Drift

My IMU application is a sailboat autopilot. As such, I do not need absolute accuracy but heading data must be stable and fairly linear.

Breadboard setup:

Sparkfun IMU-9250 (SKU: SEN-13762)

Arduino Nano (ATmega328P - same as Pro Mini)

Kris Winer’s Example Code straight from SF’s hook-up guide

Initial testing:

(IMU stationary for >30 at startup)

I2C communications as expected

Pitch and roll values (from Mahony filter) are stable +/- 1 deg

Yaw values drift at rates from .2 deg/sec up to 2 deg/sec over a large range (+/- 50 deg)

All three mag values also drifting.

Update rate 435 hz (higher than expected)

Troubleshooting so far:

Tested in alternate location (away from any iron or magnets)

Tested with/without 10k pull-up resistors on SDA & SCL

Negated the mz in the filter argument list (-myIMU.mz) as suggested in one of the forum posts

Tested with loop delay (ahead and after interrupt sense) to lower update rate to 100 hz

— yaw and mag data drift behavior the same in all cases.

Did I just get a board with a bad AK8963? Suggestions welcome.

Thanks!

Hello jehertel.

Pretty much all IMU’s have a yaw drift issue and it’s something you need to account for in code. Unfortunately I don’t have any details on how to do that, but if you search “IMU yaw drift” on your favorite search engine, some examples from people way more informed on this than me should show up.

Chris, thanks for the reply. I understand that drift is an issue with all IMU’s. The testing with the 9250 however drifts radically — at some times more than 120 degrees over a few seconds. The only other IMU I’ve tested (BNO055) also had drift based on certain levels of motion but it was +/- 2 degrees when it was stationary. Right now I don’t see how any software could fix this without some additional (stable) sensor data.

Have others had luck with the 9250?

Thanks again,

Jim

Hi Jim.

You happen to have your order or invoice number?