Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Scale Factors Modifications for BHI160B IMU

    Scale Factors Modifications for BHI160B IMU

    vamshi
    Established Member

     Hi Team,

    We are working on BHI160B IMU using STM32-L053R8 and Arduino code provided by Bosch. Present we are able to read data with default scale factors of Acc, Gyro, and Mag. Now, we need to change default scale factors ranges to our own. But, in BHI160B Datasheet unable to understand what values have to write to the registers for setting Acc, Gyro, and Mag scale factors (like Sample rates).
    Is that possible to change those scale factors? If Yes,
    Can anyone please guide me to change the default scale factors to our own (Acc, Gyr, Mag) ranges?


    Any help would be very thankful.

    4 REPLIES 4

    BSTRobin
    Community Moderator
    Community Moderator

    Hi vamshi,

    You could use BHI160 sensor API from here: https://github.com/BoschSensortec/BHy1_driver_and_MCU_solution
    The third parameter of the function bhy_enable_virtual_sensor() is to set the sampling rate of the virtual sensor.
    #define GAME_ROTATION_VECTOR_SAMPLE_RATE 100
    bhy_enable_virtual_sensor(VS_TYPE_GAME_ROTATION_VECTOR, VS_WAKEUP, GAME_ROTATION_VECTOR_SAMPLE_RATE, 0, VS_FLUSH_NONE, 0, 0))

    vamshi
    Established Member

    Thank you for the reply @BSTRobin,

    What about Accelerometer and Gyroscope scale factors? 

    "#define GAME_ROTATION_VECTOR_SAMPLE_RATE 100"
    "bhy_enable_virtual_sensor(VS_TYPE_GAME_ROTATION_VECTOR, VS_WAKEUP, GAME_ROTATION_VECTOR_SAMPLE_RATE, 0, VS_FLUSH_NONE, 0, 0))"

    Do the above changes affect Acc, Gyro sample rates?

    Thank you

    vamshi
    Established Member

    Hi @BSTRobin,

    Could you please give clarity on the above query? As we were unable to find scale factors changing process in the present working code.

    Any help would be very thankful.

    BSTRobin
    Community Moderator
    Community Moderator

    Hi vamshi,

    You could refer "11.4 Sensor Configuration Structure" and sensor API to set dynamic range.

    BHI160B the units of dynamic range.png
    You could see the last parameter dynamic_range in function bhy_enable_virtual_sensor() can set range.
    BHY_RETURN_FUNCTION_TYPE bhy_enable_virtual_sensor(bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status,
    uint16_t sample_rate, uint16_t max_report_latency_ms,
    uint8_t flush_sensor, uint16_t change_sensitivity,
    uint16_t dynamic_range)

    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