cancel
Showing results for 
Search instead for 
Did you mean: 

Calibration of LSM6DS3

MHass.1
Associate II

I am using LSM6DS3. I got very strange values of gyroscope and accelerometer. I save some data of gyroscope at static position and figures of gyroscope data at static position is attached. Does LSM6DS3 needs calibration? Or we don't need to celebrate the LSMDS3? It is very difficult to arrange rotation table by calibration and sometime impossible?

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @MHass.1​ , regarding the y axis of your graphs, are the values in "dps" units? And do they refer to the gyroscope acquisition? Assuming that the master-slave communication is OK, I would suggest you to check if you properly configured the LSM6DS3 device and if you are well decoding the data, by checking the C code examples on Github repository at this link, for example the lsm6ds3_read_data_polling.c file. Regards

/* Restore default configuration */
  lsm6ds3_reset_set(&dev_ctx, PROPERTY_ENABLE);
  do {
    lsm6ds3_reset_get(&dev_ctx, &rst);
  } while (rst);
 
  /*  Enable Block Data Update */
  lsm6ds3_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
 
  /* Set full scale */
  lsm6ds3_xl_full_scale_set(&dev_ctx, LSM6DS3_2g);
  lsm6ds3_gy_full_scale_set(&dev_ctx, LSM6DS3_2000dps);
 
  /* Set Output Data Rate for Acc and Gyro */
  lsm6ds3_xl_data_rate_set(&dev_ctx, LSM6DS3_XL_ODR_12Hz5);
  lsm6ds3_gy_data_rate_set(&dev_ctx, LSM6DS3_GY_ODR_12Hz5);
 
  /* Read samples in polling mode (no int) */
  while(1)
  {
    uint8_t reg;
 
    /* Read output only if new value is available */
    lsm6ds3_xl_flag_data_ready_get(&dev_ctx, &reg);
    if (reg)
    {
      /* Read acceleration field data */
      memset(data_raw_acceleration.u8bit, 0x00, 3 * sizeof(int16_t));
      lsm6ds3_acceleration_raw_get(&dev_ctx, data_raw_acceleration.u8bit);
      acceleration_mg[0] =
        lsm6ds3_from_fs2g_to_mg(data_raw_acceleration.i16bit[0]);
      acceleration_mg[1] =
        lsm6ds3_from_fs2g_to_mg(data_raw_acceleration.i16bit[1]);
      acceleration_mg[2] =
        lsm6ds3_from_fs2g_to_mg(data_raw_acceleration.i16bit[2]);
 
      sprintf((char*)tx_buffer, "Acceleration [mg]:%4.2f\t%4.2f\t%4.2f\r\n",
              acceleration_mg[0], acceleration_mg[1], acceleration_mg[2]);
      tx_com(tx_buffer, strlen((char const*)tx_buffer));
    }
 
    lsm6ds3_gy_flag_data_ready_get(&dev_ctx, &reg);
    if (reg)
    {
      /* Read angular rate field data */
      memset(data_raw_angular_rate.u8bit, 0x00, 3 * sizeof(int16_t));
      lsm6ds3_angular_rate_raw_get(&dev_ctx, data_raw_angular_rate.u8bit);
      angular_rate_mdps[0] =
        lsm6ds3_from_fs2000dps_to_mdps(data_raw_angular_rate.i16bit[0]);
      angular_rate_mdps[1] =
        lsm6ds3_from_fs2000dps_to_mdps(data_raw_angular_rate.i16bit[1]);
      angular_rate_mdps[2] =
        lsm6ds3_from_fs2000dps_to_mdps(data_raw_angular_rate.i16bit[2]);
 
      sprintf((char*)tx_buffer, "Angular rate [mdps]:%4.2f\t%4.2f\t%4.2f\r\n",
              angular_rate_mdps[0],
              angular_rate_mdps[1],
              angular_rate_mdps[2]);
      tx_com(tx_buffer, strlen((char const*)tx_buffer));
    }
}