Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    What is the method to calibrate Accelerometer and Gyro meter for BMX160?

    What is the method to calibrate Accelerometer and Gyro meter for BMX160?


    Hi Team,

          Present, I am Working with BMX160 Sonsor . 

          What is the method to calibrate Accelerometer and Gyro meter for BMX160? i.e. Procedure of Calibrate for Accelerometer and Gyro meter on BMX160.  

          How we confirm that BMx160 of Accelerometer and Gyro meter are calibrated?

          Please provide required Info and reference documents.


    Thnak you,

    M Krishna.


    3 REPLIES 3

    Community Moderator
    Community Moderator

    Hello MKrishna,

    There was FOC in driver code, you could refer it.

    Hi Team,

         Thank you for quick response.

          1. Pls let me know the procedure for Acc & Gyro calib done (tilt / rotate etc) as per code? I found below reputed links ()- Is Bosch different than these 2 links? (calibration-of-an-inertial-measurement-unit-imu, IMU calibration)

    2.  What is difference between calibration and FOC? Do we get some values from Calibration and use them for FOC? 


    Thank you,



    Community Moderator
    Community Moderator

    Hello MKrishna,

    You could get FOC description in BMX160 data sheet.
    FOC could conpensates offset errors of accelerometer and gyroscope.

    This is FOC exmaple code for BMX160.

    ## FOC and offset compensation
    > FOC shouldnot be used in Low-power mode
    #### Example for configuring FOC for accel and gyro

    /* An example for configuring FOC for accel and gyro data */
    int8_t start_foc(struct bmi160_dev *dev)
    int8_t rslt = 0;
    /* FOC configuration structure */
    struct bmi160_foc_conf foc_conf;
    /* Structure to store the offsets */
    struct bmi160_offsets offsets;

    /* Enable FOC for accel with target values of z = 1g ; x,y as 0g */
    foc_conf.acc_off_en = BMI160_ENABLE;
    foc_conf.foc_acc_x = BMI160_FOC_ACCEL_0G;
    foc_conf.foc_acc_y = BMI160_FOC_ACCEL_0G;
    foc_conf.foc_acc_z = BMI160_FOC_ACCEL_POSITIVE_G;

    /* Enable FOC for gyro */
    foc_conf.foc_gyr_en = BMI160_ENABLE;
    foc_conf.gyro_off_en = BMI160_ENABLE;

    rslt = bmi160_start_foc(&foc_conf, &offsets, sen);

    if (rslt == BMI160_OK) {
    printf("\n FOC DONE SUCCESSFULLY ");
    printf("\n OFFSET VALUES AFTER FOC : ");
    printf("\n OFFSET VALUES ACCEL X : %d ",offsets.off_acc_x);
    printf("\n OFFSET VALUES ACCEL Y : %d ",offsets.off_acc_y);
    printf("\n OFFSET VALUES ACCEL Z : %d ",offsets.off_acc_z);
    printf("\n OFFSET VALUES GYRO X : %d ",offsets.off_gyro_x);
    printf("\n OFFSET VALUES GYRO Y : %d ",offsets.off_gyro_y);
    printf("\n OFFSET VALUES GYRO Z : %d ",offsets.off_gyro_z);

    /* After start of FOC offsets will be updated automatically and
    * the data will be very much close to the target values of measurement */

    return rslt;