Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMI160: Convert raw data from the into meaningful data.


    BMI160: Convert raw data from the into meaningful data.

    Hi everybody,

    I have a BMI160 sensor, which is connected to my Adafruit Feather M0 Bluefruit LE  development board to measure the acceleration and orientation. I have found a code online for the development board (through Arduino IDE) and I uploaded the code to my board. I successfully receive sensordata via Bluetooth Low Energy at my computer, however these data are not meaningful. My question is how do I "convert" these raw data into meaningful data (i.e. in m/s² and °/s) ? 

    //No matter how I move the sensor, the first zeros remain


    Here is a part of the code for the development board:

    void loop(void) {
      byte data[12]; 
      if(millis()-lastUpdate >=1000)
      lastUpdate = millis();
      for (int i = 0; i < 12; i++)
        // Read 12 bytes of data
        // xGyr lsb, xGyr msb, yGyr lsb, yGyr msb, zGyr lsb, zGyr msb
        // xAccl lsb, xAccl msb, yAccl lsb, yAccl msb, zAccl lsb, zAccl msb
        ble.print(data[i]); //send value to bluefruit uart
        Serial.print(data[i], HEX);
        Serial.print(" ");
        Serial.print(" ");
      ble.println();  //print newline so app knows to plot the values
    byte readBMI(int reg)
        byte data = 0x00;
        // Start I2C Transmission
        // Select data register
        // Stop I2C Transmission
        // Request 1 byte of data
        Wire.requestFrom(AddrBMI160, 1);
        // Read 12 bytes of data
        // xGyr lsb, xGyr msb, yGyr lsb, yGyr msb, zGyr lsb, zGyr msb
        // xAccl lsb, xAccl msb, yAccl lsb, yAccl msb, zAccl lsb, zAccl msb
        if (Wire.available() == 1)
          data =;
      return data;



    1 REPLY 1
    Long-established Member

    Re: BMI160: Convert raw data from the into meaningful data.

    First of all I am not an expert but I have some personal experience with BMX160 which combines both the BMI160 and BMM150.
    BMI160 returns LSBs and looking the datasheet e.g for 2g range we have 16384LSB/g (see pg8). So the first thing you have to consider is the range you have set for both sensor.

    What can I see from you code is that you read 12bytes of data. That makes sense since BMI160 integrates a 16bit digital triaxial accel and gyro (see pg2).

    What you have to do is
    1. Parsing the data. At the moment the readings you receive are the data of accel and gyro for x,y,z axis all in one raw 🙂

    2. Depending on the range you have set the accel and gyro just make the convertion from LSB to g or mg for accel and deg per second for gyro following the datasheet.

    Keep in mind that data parsing and units convertion should be perfomed into the central's side (computer)and not to peripheral (Adafruit feather) since is more efficient in terms of energy for BLE applications.

    Hope this helps