About calibrate minimu-9

how many to set value min and max in library LSM303 before calbrate.

// These are just some values for a particular unit; it is recommended that
// a calibration be done for your particular unit.
m_max.x = +540; m_max.y = +500; m_max.z = 180;
m_min.x = -520; m_min.y = -570; m_min.z = -770;

_device = LSM303_DEVICE_AUTO;
acc_address = ACC_ADDRESS_SA0_A_LOW;

io_timeout = 0; // 0 = no timeout
did_timeout = false;

My process, I will set the value min and max with -2048 … 2047 before

m_max.x = +2047; m_max.y = +2047; m_max.z = 2047;
m_min.x = -2048; m_min.y = -2048; m_min.z = -2048;

After the calibrate to get value to change

Is right or wrong.

thank you.


You do not have to set the m_max and m_min values before you run the Calibrate example. The m_max and m_min vectors in the code you are referring to are only used in the heading calculation, which is not used in the Calibrate example. The correct way to do the calibration is to run the Calibrate example, move the board in all directions, get the values from it, and use them in your program.

If you want to use the LSM303 library by itself, instead of the AHRS program, you would do something like the Heading example:

  // Calibration values. Use the Calibrate example program to get the values for
  // your compass.
  compass.m_min.x = -520; compass.m_min.y = -570; compass.m_min.z = -770;
  compass.m_max.x = +540; compass.m_max.y = +500; compass.m_max.z = 180;

For the AHRS, you change the M_X_MIN through M_Z_MAX calibration constants to appropriate values.

- Ryan

Thank you. ^-^