Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Calibration questions

    Calibration questions

    ShanM
    New Poster

    I could use some advice about how to code for the calibration of the BMI160.  Consider that I will want to have the user hit a calibration button and initiate a gyro and accelerometer calibration process.  Consider a button for each for simplicity of this question.  What do I need to do in my functions tied to each of these buttons?  I see that the API has some internal test capabilities.  Are these related to the calibration process or is there some other command I haven't seen yet?

    For the accelerometer calibration the user will have to put the product flat on a desk then hit the button which will start my routine.  They then need to rotate the device in a 360 degree circle.  Can you explain the necessary things my code needs to do to initiate the process, and to know when it is done, what it needs to read, what calculations or data it needs to do to write back to the calibration so that the device is 'calibrated'?  I assume the same type of calling patterns would be needed for the gyro except that the user needs to rotate it 360 degrees in x, then y, then z axis.  How can my code know that each of these stages is completed and to move on to the next one, or when the process is completed, how to lock that in?

    Or am I thinking about calibration all wrong?  Please suggest a more productive way of approaching this if I am not on the right track.

    1 REPLY 1

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    Thanks for your inquiry.

    BMI160 has built-in self-test feature for accelerometer and gyroscope. This is to check if the sensor is working properly or not after PCB assembly. It has nothing to do with calibration.

    Gyro calibration is relatively simple. You can place your device stationary on a table at any orientation and then click "Gyro calibration" button. If you configure BMI160 gyro to 100Hz normal mode, then you can set up a counter for 1000 samples which is about 10 seconds long. After the counter reaches 1000, you can display "Gyro calibration is done". Then you can average these 1000 gyro data samples to get the offsets for x/y/z axes. In the future all gyro raw data should subtract these offsets to get calibrated values. This means that when your device is stationary gyro x/y/z data should be all around 0 dps (degree per second). If you also want to calibrate gyro x/y/z sensitivities, then you will need a turn table and this becomes complicated.

    Accel calibration is to convert BMI160 accel x/y/z data to align with your device X/Y/Z axes, because BMI160 x/y/z axes will be invisible inside your device. Now you can click "Accel calibration" button and display "Please place device X axis pointing up". Then you can click "Start" button to collect BMI160 accel x/y/z data for 300 samples for example.  If you configure BMI160 accel to 100Hz normal mode, then it will take about 3 seconds. When the counter reaches 300, you can click "Stop" button. Now you can average these 300 data samples to get accel x/y/z data at Z_up position. Then you can repeat the above process for Z_down, X_up, X_down, Y_up and Y_down the other 5 positions. Then you can search accelerometer calibration application note or code sample online about how to obtain accel 3 offsets and 3x3 sensitivity matrix calibration parameters from the above data sets you have collected. Then you can display "Accel calibration is done". In the future you need to apply these accel calibration parameters to all BMI160 accel raw data. Therefore, when you place any device axis X/Y/Z to up or down position, you should get +1g or -1g values after calibration.

    Thanks.

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist