Section 4: Flight-Control-Functions.

....... MAG3110 Calibration Data Source Code .........

======== File-Name: 5_Calibration_Data_MAG3110.ino =========



/+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++ 5: Function to load Calibration Matrix for MAG3110 +++++++
//++++ 5: Function to load Calibration Matrix for MAG3110 +++++++
//                Last Update: 13-08-2022 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

void Mag3110_CaliMatrix()
  {
 if (Calib_Serie==1)
  {
  Yaw_Correction   =  0.0;    //degrees
  Mag_Declination  = -2.3;    //2.3 degrees
// mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
//+++++++ Load MAG3110 Magnetometer Calibration Matrices ++++++++
// **************************************************************

// MAG3110-1 Magnetometer Calib.data ***************************
// used: MAG3110-no1_0x01_0x80_coolterm capture 2021-09-26 23--.txt                                                                                  
// Sensor orientation tov kubus. x=>-cubY y=>CubX  z=>-CubZ. 

// mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

// x, y, z-Component of Hard-Iron Shift vector Mag_Vsi in bit-values is: 
 Mag_VSx = -1885;
 Mag_VSy =  2244;
 Mag_VSz =  1132;

// The Mag-Calibration Matrix Wmin1 or W**-1=sqrt(A[3x3]) is: !!!!!

// First row of Wmin1   MagCTp  row=0
 Wmin1[0][0] = 1.977976e-03;
 Wmin1[0][1] = 1.108997e-05;
 Wmin1[0][2] = 1.639445e-05;

// Second row of Wmin1   MagCTp  row=1
 Wmin1[1][0] = 1.108997e-05;
 Wmin1[1][1] = 1.967348e-03;
 Wmin1[1][2] = 1.206046e-05;

// Third row of Wmin1   MagCTp  row=2
 Wmin1[2][0] = 1.639445e-05;
 Wmin1[2][1] = 1.206046e-05;
 Wmin1[2][2] = 2.021327e-03;
 
//mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
//***************************************************************
  Serial.println("Series-1 Mag.Calibration Matrices have been loaded...");
  delay(1000);
// **************************************************************
  }


// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

if (Calib_Serie==2)
  {

// **************************************************************
//++++++ Load MAG3110 Magnetometer Calibration Matrices +++++++++
// **************************************************************

// MAG3110-2 Magnetometer Calib.data ****************************
// file used: MAG3110-no2_0x01_0x80_coolterm capture 2021-08-19 20-21-37.txt                                                                                  
// Sensor orientation tov kubus. x=>-CubY y=>CubX  z=>-CubZ. 

   Yaw_Correction   =  0.0;    //degrees
   Mag_Declination  =  0.0;    //2.0 degrees
//mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

// x, y, z-Component of Hard-Iron Shift vector Mag_Vsi in bit-values is: 
 Mag_VSx = -2970;
 Mag_VSy = 4410;
 Mag_VSz = 1002;

// The Mag-Calibration Matrix Wmin1 or W**-1=sqrt(A[3x3]) is: !!!!!
// First row of Wmin1   MagCTp  row=0
 Wmin1[0][0] = 2.219608e-03;
 Wmin1[0][1] = -3.325698e-05;
 Wmin1[0][2] = -4.606673e-06;

// Second row of Wmin1   MagCTp  row=1
 Wmin1[1][0] = -3.325698e-05;
 Wmin1[1][1] = 2.187797e-03;
 Wmin1[1][2] = -1.293148e-06;

// Third row of Wmin1   MagCTp  row=2
 Wmin1[2][0] = -4.606673e-06;
 Wmin1[2][1] = -1.293148e-06;
 Wmin1[2][2] =  2.288794e-03;

// mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm   
// **************************************************************
  Serial.println("Series-2 Mag.Calibration Matrices have been loaded...");
  delay(1000);
// ************************************************************
  }

}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++ End of function to load MAG3110 Calibration Matrix +++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Free-Drones Company 2022