Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BHI260 Gravity Vector unwanted offset appears

    BHI260 Gravity Vector unwanted offset appears

    btruden_henway
    Long-established Member

    Hello,

    I'm using a BHI260AB chip with an STM32 as the host processor.

    To start I want to do something very simple now, which is basically taking the gravity vector measurement and with that vector figure out the inclination angle of my device.

    So, I have the BHI chip with the following references (in red):

    btruden_henway_0-1643315724141.png

    Then we have the gravity:

    btruden_henway_1-1643315785326.png

    Then when the chip has a certain inclination:

    btruden_henway_2-1643315859050.png

    In this picture, gravity has just two components (YZ) because the drawing shows a rotation around the X-axis (it's easier for me to draw this 2D scheme). But let's assume that the chip can have any orientation and the gravity is decomposed into the three axes.

    On my project, I have an initial position of the device which is when the BHI chip is in the following orientation:

    btruden_henway_3-1643316095773.png

    This orientation is considered to be the 0° inclination. And the inclination angle is calculated by doing the following:

    btruden_henway_4-1643316548145.png

    alfa = arcsin(gz / g);

    Where gz is the module of the Z component of the gravity and g is the module of the gravity. 

    So I do that calculation with my STM32 and I was surprised when I placed the device in the initial position (picture 4). My alfa angle was showing of inclination. I was expecting the angle not to be 0°, but not to have such an error in the initial position.

    Inspecting the g components got from the BHI chip in the initial position I got the following:

    x = 0.017333984375 g

    y = -0.992431640625 g

    z = 0.120361328125 g

    I'm very surprised by the Z component. It should be very low, but it's not. 

    As a comment, I didn't run any calibration on the chip or any offset correction before these calculations. I just connected the chip and used it as it was. But still, I'm concerned about the magnitude of the error.

    Is there something that I should do before using the gravity vector?

    I didn't try the same by using the accelerometer values instead of the gravity virtual sensor. But I guess the gravity virtual sensor is based on the accelerometer readings. So, It should be the same. 

    I hope anybody can help me.

    Thanks!

    4 REPLIES 4

    Minhwan
    Community Moderator
    Community Moderator

    Hello, 

     

    xyz values for gravity is correct as root( x2 + y2 + z2) = 1. So, two things you can do for more accurate value. 

    If there is offset, the gavity value of root( x2 + y2 + z2) exceeds 1. 

    So, I think you need to calibrate BHI260 as below youtube clip. (It's BNO055, but same method as BHI260AB) 

    https://www.youtube.com/watch?v=Bw0WuAyGsnY    

    And also, please check whether you set BHI260 properly. 

    Thanks, 

    btruden_henway
    Long-established Member

    Hello Minhwan,

    Thank you for your prompt reply.

    In the Youtube video, I can see that they use the "Bosch Development Desktop" application for doing the calibration. 

    In my case, I use an STM32 as a host processor connected to the BHI260AB over SPI. I don't understand very well how should I do with my STM32 for calibrating the gravity virtual sensor.

    Right now what I do with the STM32 is the following:

    • Reset the BHI chip
    • Download the Firmware to the BHI chip
    • Run a self-test on the accelerometer
    • Run a self-test on the gyroscope
    • Configure gravity virtual sensor with a sample rate of 25Hz
    • Periodically read the gravity vector

    So, here are some questions:

    1. What should I do for calibrating the gravity vector? is there some command that I must send to the BHI260AB? is not clear in the datasheet.
    2. In the case that I use more virtual sensors (I plan to use the Game Rotation Vector too), should I run a calibration routine for each of them separately?
    3. Is it necessary to run the calibration routine (shown in the video) every time the device is turned on (every time the firmware is downloaded to the BHI chip)?

    Thanks!

     

     

    Hello Minhwan,

    Do you have any update on this topic?

    Thanks!

    I finally found the dynamic calibration is automatically performed by the Fuser2 Core as soon as a virtual sensor is enabled.

    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