Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BHI260AP Modify Dynamic Range of Accelerometer

    BHI260AP Modify Dynamic Range of Accelerometer

    New Poster

    I see a few posts on this forum about changing the dynamic range of my sensor, BHI260AP, however I do not understand how to actually implement this change. 

    This is a quote from one of the links below: 


    You could refer the following code to modify sensor range.
    In bhi2.c file, bhy2_set_virt_sensor_range() function support to set sensor range.
    int8_t bhy2_set_virt_sensor_range(uint8_t sensor_id, uint16_t range, struct bhy2_dev *dev)

    To set sensor range, you could call bhy2_set_virt_sensor_range() in begin().
    bool BoschSensortec::begin()


    -- I cannot find a BHI2.c file, Does this mean the BHY2.c file? 

    -- I found the refered function but its within the BHY2.c file. I also am not sure what to modify or how to call the function.  SEE SCREENSHOT


    I also found the sensortec file and where the function is being called from.  SEE SCREENSHOT


    I feel quite dumb, but can someone explain this better to me? 

  (GO TO PAGE 149 for dynamic ranges)


    3 REPLIES 3

    Community Moderator
    Community Moderator

    Hi jbarton,

    The previous posts discussed how to modify the measurement range on Nicla Sense ME board, the software environment is Arduino. If you install the Arduino code of the Nicla Sense ME board, you will see bhi2. c in this directory "C:\Users\you name\Documents\Arduino\libraries\Arduino_BHY2\src\bosch" on you PC.

    For information of Nicla Sense ME, you could find it from here:

    Generally, the acceleration range is initialized once rather than set dynamically. Cou we know background information from you:
    1. Could we know your current hardware and software environment?
    2. What is your application and need to modify the acceleration dynamic range?

    I am also using the Nicla Sense ME board with Arduino IDE1.8.19. It’s a standalone device that reports back to an app I am developing through BLE.

    I will double check the pathway, I am not on my computer right now, but I’m pretty sure that’s where I was able to find the BHY2.c file. It must be the same file just one letter different in title. I don’t know how to modify this file.

    I am developing a device to track the throwing motion of a disc golf player and provide feedback to user. It’s worn on the throwing wrist, and when I am testing my design I noticed that on the y axis accelerometer I repeatedly hit the same value, 32768. I believe that to be the max for the 2g sensitivity range, that’s why I could hit the exact same value numerous times over.

    Community Moderator
    Community Moderator

    Hi jbarton,

    According your application, you can set a range greater than 2g to retest instead of dynamically changing the range.