Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    Arduino library for BHI160b for remapping the sensor orientation

    Arduino library for BHI160b for remapping the sensor orientation


    Hi team,

    1) - I am using a custom-made board with bhi160b+bmm150 and ESP32, Which used to work great with available orientation.ino code.
    After some 2weeks of usage, the IC stopped giving the data out. 
     - So I logged the data and found : after flashing the bhy.h data into the IC the BHI160B giving only once the interrupt and stops triggering again for fifo full.
     - So What I have done is read the fifo with timer for every 10ms as I kept the ODR = 100Hz but found same data always.
    -- I doubt can the bootloader code which is in the ROM could be damaged.? Or is there any thing I can test to confirm the IC is working?
    -- I am using same orientation.ino code , which i tested on another board and found working as before.

    2) In the orientation.ino code the end "Status" data represent the accuracy of the data? it always go to 3 and again falls to 0 within seconds, Why like that? Do i need to setup the orientation of the both the IMUs to get correct accuracy? 

    3) I tried to port the bhi_uc_drivers file to the arduino with no luck, this I am doing for remapping of the IMUs on the board orientation. Is there any arduino ported code/drivers for the bhi160b axis remapping drivers?

    6 REPLIES 6

    Community Moderator
    Community Moderator

    Hi chaitanyai,

    1. Did you use the example code and load firmware "Bosch_PCB_7183_di03_BMI160_BMM150-7183_di03.2.1.11696_170103" for your hardware?

    2.Accuracy means the calibration status of funsion algorithm, value 3 indicates that the calibration is complete and the algorithm outputs the best data performance. Value 0 indicates that sensor was uncalibrated. Because you have used a geomagnetic sensor, you need to consider whether the surrounding magnetic field environment has changed, causing the calibration state to drop, and you need to recalibrate.

    3.What is your sensor placement and target coordinate system like? You could draw a picture to show it.

    HI Robin, Thank you for the response.

    1) Yes, I tested orientation.ino and it is working perfectly. One board out of three, while testing suddenly stopped working. Still, the bhi. fw getting flashed and showing the sensor ids but no output data from that board. The remaining two boards working well.
    - Can we check somehow the firmware flashed is perfectly loaded?
    - Is the Virtual sensor and Interrupt enabled?

    2)"Accuracy means the calibration status of fusion algorithm" - Yes That's what I am looking for. The sensor contains BSX-Full right? so the sensor is calibrated by power on? Or do we need to calibrate every power on? - Does BHI160B have dynamic calibration?
    I am expecting, While in motion the sensor will be auto-calibrated am I wrong?

    3)Does orientation and calibration have any relationship?
    Please check my board orientation attached - (Its a custom-made board)

    4) I want to use the Arduino library but cannot find the orientation remapping registers code ported for Arduino drivers available. Is any other Arduino drivers I can get to remap the orientation of the IMU's?

    5) This question is related to the application. As far as I studied, We can't use Euler angles for 360 degrees representation of the object in the space even at the unit axis(I mean I consider only rotations at a single point).
    To achieve this we need to move to the Quaternions. Till this I am good. I am getting the Quaternions from the IMU.
    - Now I am confused. How to represent the object orientation based on Quaternions 
    - What I want is I need to derive the object is X , Y and Z degrees rotation in space, taking board orientation as (0,0,0) reference. Is it possible?

    Can someone help me with this?

    Community Moderator
    Community Moderator

    Hi chaitanyai,

    1. You can track your code and check the return value when the code runs to determine whether the firmware is loaded successfully? Enable virtual sensor ID successfully? Is the interrupt triggered?
    2. The BSX calibration algorithm runs in the background. The first use requires calibration. After calibration, save the calibration profile. The next boot can load the calibration profile.
    3. Perform axis mapping before calibration, otherwise the output of BSX algorithm is inconsistent with the actual coordinates.
    4. The current code supporting Arduino is the da on github
    5. Based on the BSX output, we have not taken this into account at present.