Bosch Sensortec Community

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

    Setting Range with I2c protocol

    Setting Range with I2c protocol

    AnthonyGui
    New Poster

    Hello everyone,

    I am currently gathering data from all the BMIs in shuttleboard versions. I have set the range for the acceleration via the smbus2 proposed by Python. However, my acceleration measures add up to 11,100 mg(even when taking into account biases and noises that is not 9.81 m/s^2 so 1000mg or 1g).

    Hence, I believe that there may be a problem when setting the acceleration range. Indeed, when using the Python smbus2 I can only write bytes (at minimum one) but the range is set by writing only one bit to the bus.

    Does anyone know how to solve this problem?

    Thanks in advance,

    Best,

    Anthony Guillard

    2 REPLIES 2

    Vincent
    Community Moderator
    Community Moderator

    You can read out the register then marked the other bits and only change the bits for changing the range. 

    After that, you write back the whole register byte. 

    It is a common solution for your problem. 

    For you read out, can you tell me which BMI chips you are using now? 

    For the acceleration in the BMI, there is different resolution so there is 12 bits / 16 bits accleration data,  you need figure out the sensitivity through the related datasheet.  if it is 12 bits, then you can not convert the sensor data with whole 2 bytes read out value. 

    Dear Vincent,

    Thank you so much for your help. That is what I have just implemented.
    I am using the BMI088 as of right now before moving on to the other ones. The acceleration is represented by 16 bits.

    After having implemented your method I have realised something else: the datasheet mentions that the conversion from LSB to mg is done in the following way

    Acc_mg = Acc_int_Y/f32768*1000*2**(<0x41> + 1)*1.5

    Where <0x41> is the content of that said register. I am using the BMI088 in +/-3g mode thus the register output is 0. I was previously using the range setting (so 3 here) instead of the register output. However, both solutions yield odd results.
    Did I make a mistake in the conversion process?

    Best,

    Anthony Guillard

    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