Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMI160 - Fast Offset Compensation (FOC)

    BMI160 - Fast Offset Compensation (FOC)

    New Poster

    Hi all, 

    I am trying to improve the accuracy of the accelerometer and gyro readings from BMI160 by using the FOC.

    For the accelerometer, I noticed that the offsets change depending on the orientation: I tried g on x axis, g on y axis and then g on z axis.

    Is there an explanation to this? 

    Many thanks 



    9 REPLIES 9

    Community Moderator
    Community Moderator


    I don't know your application with BMI160. For static offset calibration, our common suggestion is save value in your flash but not BMI160's NVM, because NVM have wirte times limitation.

    If you could check that accel static offset will not change along with product liftime, you can save value in NVM. It's decided by your application.

    Best regards.


    Hi Yanchao,  

    I am struggling with the offsets. 

    I did as you suggested saving the offsets given by bmi160_start_foc() in my local flash then applied them to the raw data - this didn't work for me. 

    I tried to learn the offset myself. I put the device on a flat surface, g is on z axis, I read the raw data on x and y for X time (I did 5 to 10 seconds). The avergare over this period of time is the offset. I've been appliying it as follows: a = ((a_raw - offset)*g)/sensitivty. This method didn't work for me either. 

    The only way for me to get sensible results is to use the FOC. I am not sure what I am missing here?

    Can you please help me?

    Many thanks

    Kind regards




    Community Moderator
    Community Moderator

    Hi katie,

    I think your methord is right, maybe some mistake you didn't get.

    Please show me your log, the offset value before and after offset compensation. Before offset compensation, the accel output value offset is lagger.

    Best regards.

    Many thnaks for your feedback.

    It does work now. 

    Kind regards



    Long-established Member

    Hi Katie,

    Could you share your code snippet for FOC?