Arduino/Genuino 101 accelerometer calibration failed

Hi All,

I tried to accelerometer calibration on Adruino/Genuino 101.
Y and Z axis are calibrated certainly.
But, only Z axis is not calibrated.
Z axis accelerometer value is not stable.

This is Output value.

Z axis accelerometer is some times indicate 1.00.

Originally, Z axis Output value should indicate always 1.00.

I made a program with reference to this web page.

Does anyone got any idea why the calibration is failed?

[Serial Port Output]
AccelerometerX, AccelerometerY, AccelerometerZ, GyroX, GyroY, GyroZ
0.00, -0.00, 0.99, 0.00, 0.06, -0.06
0.00, -0.00, 0.00, -0.06, 0.06, 0.00
0.00, -0.00, 0.00, -0.06, 0.06, 0.00
0.00, -0.00, 0.00, -0.06, 0.06, 0.00
0.00, -0.00, 0.00, -0.06, 0.06, 0.00
0.00, -0.00, 0.00, 0.00, 0.06, 0.00
0.00, -0.00, 0.00, -0.06, 0.00, 0.06
0.00, -0.01, 0.00, -0.06, 0.00, 0.00
0.00, -0.00, 0.00, 0.06, 0.00, 0.00
0.00, -0.00, 0.00, 0.00, 0.06, 0.00
0.00, -0.00, 0.00, -0.06, 0.00, 0.06
0.00, -0.00, 0.00, -0.06, -0.06, 0.00
0.00, -0.00, 0.00, -0.06, 0.06, 0.00
0.00, -0.00, 0.00, 0.00, 0.00, 0.00
0.00, -0.00, 0.99, -0.12, -0.06, 0.00

Code

#include <CurieIMU.h>

float accelScale, gyroScale;

int axR, ayR, azR, gxR, gyR, gzR;
float ax, ay, az, gx, gy, gz;

void setup() {
  Serial.begin(250000);

  CurieIMU.begin();

  CurieIMU.autoCalibrateAccelerometerOffset(X_AXIS, 0);
  CurieIMU.autoCalibrateAccelerometerOffset(Y_AXIS, 0);
  CurieIMU.autoCalibrateAccelerometerOffset(Z_AXIS, 1);

  CurieIMU.autoCalibrateGyroOffset();
  
  CurieIMU.setGyroRate(50);  //Gyro Rate
  CurieIMU.setAccelerometerRate(50);  //AccerelometerRate

  CurieIMU.setAccelerometerRange(2);
  CurieIMU.setGyroRange(2000);
  
}

void loop() {
  CurieIMU.readMotionSensor(axR, ayR, azR, gxR, gyR, gzR);
  ax = convertRawAcceleration(axR);
  ay = convertRawAcceleration(ayR);
  az = convertRawAcceleration(azR);

  gx = convertRawGyro(gxR);
  gy = convertRawGyro(gyR);
  gz = convertRawGyro(gzR);

  Serial.print(ax); Serial.print(",");
  Serial.print(ay); Serial.print(",");
  Serial.print(az); Serial.print(",");

  Serial.print(gx); Serial.print(",");
  Serial.print(gy); Serial.print(",");
  Serial.print(gz); Serial.print("\n");
  
  delay(100);
}


float convertRawAcceleration(int aRaw) {
  // since we are using 2G range
  // -2g maps to a raw value of -32768
  // +2g maps to a raw value of 32767
  
  float a = (aRaw * 2.0) / 32768.0;
  return a;
}

float convertRawGyro(int gRaw) {
  // since we are using 250 degrees/seconds range
  // -250 maps to a raw value of -32768
  // +250 maps to a raw value of 32767
  
  float g = (gRaw * 2000.0) / 32768.0;
  return g;
}