minIMU-9 V3 Drift after power back on

Hello All/Pololu
I’ve been working on a Head Tracking unit with the MinIMU-9 v3 (discontinued) using the AHRS code. Calibrated, with very stable gyro reading. However, If I turned off the unit for like five to ten minutes. The gyro reading started to drift immediately right after power back on and that included after a minute of staying still. The re-calibration values and the original values are somewhat slightly differences. But both are obtained at the intended operating position. Currently, I have to go through the whole processes calibrate, upload the sketch, to have a stable gyro reading. Any suggestions, thanks.

That is typical behavior for a gyro. You need to re-determine the offsets on every power up, and at some frequency during normal use. Experiment to determine the optimal approach.

The calibration procedure is quite simple and can be incorporated into your working sketch, so there is no need to upload new code.

Hi J.Remington
I did actually thought about on the flight/continues calibration. However, my High School procedural coding skill with QBasic, C and VB are quite rusty. Currently, I am using both, the adopted Pololu’s AHRS and RTimulib code. I Salute the individual/folks at RTimulib. Great OpenSource 'S

Here is the entirety of the minIMU-9-ahrs gyro and accelerometer offset calculation. Just take out the accelerometer part and put the gyro offset calculation anywhere you like.

  for(int i=0;i<32;i++)    // We take some readings...
    for(int y=0; y<6; y++)   // Cumulate values
      AN_OFFSET[y] += AN[y];

  for(int y=0; y<6; y++)
    AN_OFFSET[y] = AN_OFFSET[y]/32;


  for(int y=0; y<6; y++)

Hi J.Remington,
I wasn’t sure how to proceed with your suggestion. I did tried without luck. So I thought I could give myself a little more time during the start up process/sampling values for the offset calculation by increased the delay (20) values at couple of places. I got roughly about 8 to 11 second to situate myself at the intended operating position after plugin the USB. It been working very well. For about two weeks, I’ve notice
only ±5° in Yaw axis differences after very startup processes and no drift (without requiring constant re-calibration)

Here it is and thanks a lot. Three pins, one wire and eight solder join. 'S