Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    How to configure acceleration range of Nicla Sense ME (BHI260AP)?

    How to configure acceleration range of Nicla Sense ME (BHI260AP)?

    chinoramas
    Member

    Hi,

    I have a nicla sense ME IMU sensor and I want to evaluate the various sensitivity range of the accelerometer?

    Does anyone have an idea how to change the acceleration range parameter in Arduino?

    Or any sample code that I can refer to?

    I tried to search and found something but still, I cannot get it how to implement it on the program.

    chinoramas_0-1651586663569.png

     

    Thank you

    Regards

    Christian 

    10 REPLIES 10

    zgg
    Long-established Member

    Hi 

    This has actually already been implemented, you could refer to the: 

    https://github.com/arduino/nicla-sense-me-fw/blob/main/Arduino_BHY2/src/BoschSensortec.cpp

    BoschSensortec::configureSensorRange() invokes the API: bhy2_set_virt_sensor_range() to change the dynamic range.

    you could refer to the datasheet  section 13.2.8  for more details such as the units of the range. 

    Let me know if this helps and / or if you have additonal questions. 

    void BoschSensortec::getSensorConfiguration(uint8_t id, SensorConfig& virt_sensor_conf)

    gets the configuration (incl. the dynamic range) of the sensor. 

     

    Where do I put this command into? Ignore my stupidity, I'm pretty new to this stuff, trying to do a school project. 

    zgg
    Long-established Member

    Hi Jbarton

    no worries. 

     

    you could try this, e.g.:

    in the example sketch: https://github.com/arduino/nicla-sense-me-fw/blob/main/Arduino_BHY2/examples/Standalone/Standalone.i...

    you could add a line, 

    void setup()
    {
    Serial.begin(115200);
    while(!Serial);

    BHY2.begin();

    accel.begin();

    accel.setRange(16);  // this is an example, you might need to change this to 4, 8 or 16 based on your needs
    gyro.begin();
    temp.begin();
    gas.begin();
    rotation.begin();
    }

    zgg
    Long-established Member

    BTW, there is a new PR on the github which adds a new example on how to read and reconfigure the range of the IMU on Nicla Sense.

    Please check the details here:

    https://github.com/arduino/nicla-sense-me-fw/pull/65/commits/9c6858f55613c9ee8944aba8e47c8a79a63ba5b...

     

    you could find a new sketch which does exactly that. 

    Thank you for your  solution. Is there any way to set range from Host side? for example, i read nicla sensor data from portenta h7 by BHY2_Host libra, but there isn't any function to set 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