6 Replies Latest reply on Mar 31, 2017 9:34 AM by Intel Corporation

    How does Genuino Arduino 101 Intel Curie Autocalibration (Ax Ay Az) process works?

    uomodellamansarda

      I am reading the source code file CurieIMU.cpp#L409, made by Intel for Arduino/Genuino 101. I have some questions:

      • How does auto-calibration work in this specific case? This is not very clear to me.
      • Why the offset can be assumed to be linear?
      • Is there any reference stating that it is safe to assume a linear offset for 1 axis calibration?
      • Why when I see the data on the serial monitor or on my file created with processing, the Z acceleration autocalibrated values jump from 1~0,99 to 0,00 g? (

      The CurieIMUgetAccelerometerOffset reference says that the sensitivity is 3,9 mg.

      Given a sensitivity of +-2g, I have to use this formula

      3,9*19,6/32767 

      in order to convert the value in m/s^2.

      Here is the library code, made by Intel, that computes the correct offset:

       

       

       

       

      {

          int bmiOffset = offset / 3.9;

       

          if (bmiOffset < -128) {

              bmiOffset = -128;

          } else if (bmiOffset > 127) {

              bmiOffset = 127;

          }

       

          if (axis == X_AXIS) {

              setXAccelOffset(bmiOffset);

          } else if (axis == Y_AXIS) {

              setYAccelOffset(bmiOffset);

          } else if (axis == Z_AXIS) {

              setZAccelOffset(bmiOffset);

          }

       

          setAccelOffsetEnabled(true);

      }

       

      I have a Intel Arduino Genuino 101, i  tried to implement the autoCalibrateAccelerometerOffset() function, through the code below on Arduino Genuino 101.

      In a static test, without any stress or noise, I read the three axis value.

      MtB97.png

      When I see the data on the serial monitor or on my file created with processing, the Z acceleration values jump from 1~0,99 to 0,00 g.

       

       

      Here my code

      #include "SoftwareSerial.h"

      #include "CurieIMU.h"

       

      float sensorVals[] = {0,0,0};

       

      void setup() {

       

          Serial.begin(9600);

          while (!Serial);  

       

          Serial.println("Inizializzazione del device...");

          CurieIMU.begin();

       

          CurieIMU.setAccelerometerRange(2);

          CurieIMU.autoCalibrateAccelerometerOffset(X_AXIS,0);

          CurieIMU.autoCalibrateAccelerometerOffset(Y_AXIS,0);

          CurieIMU.autoCalibrateAccelerometerOffset(Z_AXIS,1);

      }

       

      void loop() {

       

          sensorVals[0] = CurieIMU.readAccelerometerScaled(0);

          sensorVals[1] = CurieIMU.readAccelerometerScaled(1);

          sensorVals[2] = CurieIMU.readAccelerometerScaled(2);

       

          Serial.print(sensorVals[0]);

          Serial.print(",");

          Serial.print(sensorVals[1]);

          Serial.print(",");

          Serial.println(sensorVals[2]);

          delay(100);

      }

       

       

      I also posted this question on StackOverflow, Arduino Forum, GitHub without a useful answer.

      Thank you Andrea