Bosch Sensortec Community

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

    BSXlite integration

    BSXlite integration

    George
    Member

    Dear community,

    I am currently integrating the Bosch BSXlite library into my IMU project, working with the BMI088 and the BMX160.

    Since the sensors accelerometer range can be chosen to be 3, 6, 12 or 24g (BMI088) and 2, 4, 8 or 16g (BMX160), resulting in different g per LSB- measurements, I wonder how to set up the range using the BSXlite library (which itself requires the input to be in LSB) to fetch valid output.

    I could not find any instructions regarding this in the integration/api documentation.

    I did find the bsx_set_accrange(BSX_U8) function in the library's header files, which is only defined for BSX_ACCRANGE_2G, 4G, 8G and 16G, hinting to only be compatible with the BMX160 (though bmi088  links to the bsx library as well).

    Am I supposed and if so how, to set up the range of the used sensors within my BSXlite code? (I am aware that with BSXlite, I probably won't have to set the gyroscope's and the magnetometer's range since they are fixed to be 500dps and 16uT/LSB).

    Appreciate any help.

    Best regards,
    George

    6 REPLIES 6

    Hi,

    If you use the default configuration, the bmi160's API will provide the output in units of LSB.

     

    The default configuration of bmi160 is +/- 2g and resolution = 0.061mg/LSB. (The resolution is determined by the hardware and range, which is the minimum value that the sensor can measure.) In this case, the obtained sensor output can be directly used as bsxlite input. As a result, it is reasonable to use LSB(0.061 mg) as the input unit of bsxlite.

    BMI160 has different sensitivity for different range configuration. For example,

    Default configuration:  

    ACC: +/- 2g, output = 1 LSB = 0.061 mg; GYRO:  +/-500 dps, the input gyro data unit =1 LSB = 500dps/16384 = 0.0153 dps.

    Then,

    bmi160_get_sensor_data(&acc_x, &acc_y, &acc_z, &gyr_x, &gyr_y, &gyr_z);
    libraryInput_ts.acc.data.x = acc_x; libraryInput_ts.acc.data.y = acc_y; libraryInput_ts.acc.data.z = acc_z;

    libraryInput_ts.gyro.data.x = gyr_x;libraryInput_ts.gyro.data.y = gyr_y;libraryInput_ts.gyro.data.z = gyr_z;

    Other configurations:

    ACC: +/- 4g, output = 1 LSB = 0.12 mg; GYRO: +/-1000 dps, the input gyro data unit =1 LSB = 1000dps/16384 = 0.03 dps.

    bmi160_get_sensor_data(&acc_x, &acc_y, &acc_z, &gyr_x, &gyr_y, &gyr_z);
    libraryInput_ts.acc.data.x = 2*acc_x; libraryInput_ts.acc.data.y = 2*acc_y; libraryInput_ts.acc.data.z = 2*acc_z;

    libraryInput_ts.gyro.data.x = 2*gyr_x;libraryInput_ts.gyro.data.y = 2*gyr_y;libraryInput_ts.gyro.data.z = 2*gyr_z;

     

    Note that the user has to ensure that the input units are correct, or bsxlite will not give the correct outputs.

    Thanks a lot for the detailed answer and for making this clear.

    As far as I understand now, the configuration string I asked about here is used to tell the bsxLite API the sensor's default settings.

    The user can than decide to :

    1. Set up the sensor itself with its default settings for accel&gyro-range, fetch its data and feed it to the bsxLite API as it is.

    or

    2. Use whatever range he wants, fetch the sensor's data and convert it to the sensor's default LSB/dps or LSB/mg range before feeding it to the bsxLite API. 

    I still wonder how to find the default values for the magnometer (bmm150) are. According to the Datasheet the resolution is 0.3 microTesla.

    Bmm150's api returns 1lsb/microTesla. According to this user this is not a valid input, as he used the "raw" api data, which is 1lsb/(1/16) microTesla, which again is different from the sensors resolution.

       

    Cheers!

    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