Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Open IMU, drifting


Hi Team, l am back and still trying to get a better roll compensated Yaw heading using your V3 IMU , as using your AHRS l was getting a ±10-15 degree yaw error to my heading when tilting left/right.
I have found Mike Barkers, Pololu Open IMU code (which is exactly what l was after in a previous post, how to put Merlins correction data into a AHRS which in testing without user defined calibration or with it after defining the offsets by using Merlins Magneto correction, has massive drift.
The tilt compensation is as good as could be hoped for -+2 degrees, but after starting it just drifts in the Roll, Pitch and Yaw.
Am l correct in my assumption that this code is suitable for V3
As you can see in the code, l have tried to alter full scales (more than likely incorrectly) and played with scaling without luck.

The BNO055 that l had hi hopes for was great in a static test, but in a dynamic test it has issue with velocity and drifts badly. Adafruit/Bosch don’t seem to want to know about it, as can be seen in this forum
Thanks for any help

Pololu_open_IMUkdaltered.ino (21.4 KB)


Hi, Kevin.

As far as I know, the Pololu Open IMU software should work with the MinIMU-9 v3, and I didn’t see any obvious problems with the changes you made to the code. Were you ever able to get the original code working before you started changing it?

We are not familiar with the details of that software, so if you continue to have trouble, you might consider contacting Mike Baker directly about it.

Kevin C


Hi Kevin, thanks for the response. Without altering the code the V3 starts drifting right from the start, with or without user defines(calibration). That’s when l added full scale alterations to mag, gyro,accel and playing with scaling (not that l really know what l am doing).

I have left an issue for Mike on Github Pololu Open IMU but he hasn’t answered.
Kevin D


Try RTIMUlib. It works very well for me: State of the art AHRS for $25


Hi Jim, l have tried RTIMUlib numerous times and it has just a little bit less tilt/yaw heading change. Say instead of Pololu AHRS +10, -15 heading change, RTIMUlib does about 1 to 2 degrees less. Pololu Open IMU drop’s this down to at worse ± 2 degrees tilt compensation Yaw change (still has very responsive heading change). But just starts drifting on Yaw, pitch, Roll.
Both l see are using quaternions as the rotation matrix (which was what l had hoped was the differance with the inaccuracies, but have just looked at RT and see it is using the same), RTIMU using Kalman filter and Pololu Open Mahony filter, l am surprised at the difference in the tilt inaccuracies.
Jack Edwards auto pilot designer see’s about ± 5 degrees tilt/Yaw heading change using Pololu AHRS with a V3.
To jolt your memory, you hadn’t seen as badly tilted ellipsoid of the Mag X,Y, from the data of 3 of the V3 l have.I can corrected the non linear compass degrees around a compass rose (caused by the tilted ellipsoid) via deviation correction coding, but l don’t know how to correct the poorly tilted compensation. I have tried doing some re-cal coding of the accel but without success (tried doing max min and scaling all axis to same and putting in bias from Magneto)

If someone was kind enough to alter either of the AHRS, RTIMU preferable, to incorporate Merlins Magneto matrix as the raw calibrated data for a Mag and Accel it would be very much appreciated by me and of course anyone else using the Pololu IMU (it is currently passed my coding skills, but l am still improving)


Magneto.pdf (165.1 KB)
Hi Team, l have uploaded a copy of a procedure of how to implement Merlins Magneto data, could you please confirm if you think this is the correct use of, from raw to calibrated X,Y,Z.
As l have done this my off centre, tilted ellipsoid, just went to a centred tilted ellipsoid.
In getting the data for the Magneto, l turned the IMU with the X axis (screen print up) pointing along a wooden horizontal axle that l turned around in 24 equal segments of 360 degree’s (l had a small plastic wheel with tread marks as the equal increments). I copied the 3 axis, X,Y,Z.
Then l taped the Y axis along the horizontal Axle, rotated again 24 times copied the X,Y,Z data and added that to the X axis data.
Then l taped the IMU so it was on its edge and the Z axis was now pointing parallel to the horizontal axle and turned 24 equal segments and again copied the X,Y,Z data to the others, so l have 3 lots of Mag data all combined.
All the 3 axis were taped on the axle, pointing in the same direction down the axle (x forward, Yforward, z forward)
So all the 3 separate X data, when turned around the X and Y and Z axis via the axle is in 1 column, the same for the Y data and Z data.
x = any raw axis data
X turned, 1 xxxx xxxx xxxx
2 xxxx xxxx xxxx
thru to 24 xxxx xxxx xxxx

Y turned, 1 xxxx xxxx xxxx
2 xxxx xxxx xxxx
thru to 24 xxxx xxxx xxxx

Z turned, 1 xxxx xxxx xxxx
2 xxxx xxxx xxxx
thru to 24 xxxx xxxx xxxx

Then run it thru Magneto to get the correction data.
Is this the correct method of getting the required correction data.


I see the data from the axis isn’t under there corresponding X,Y,Z columns when posted, so please visualise the data as being in columns.