IMU Data not correct on Arduino BLE Sense REV2

I want accelerometer data from bmi270 sensor which is onboard the arduino ble sense rev2. But the values are in 1000s when kept horizontally on my desk. It should be around 1.00 on z axis and nearly 0 on x and y axis. Pls help. At times the readings cross 20,000. Pls note that the acceleration values do change linearly most of the time upon moving the board.

image

image

I used example code of Arduino__BMI270_BMM150.h library as below:

#include "Arduino_BMI270_BMM150.h"

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println("Started");

  if (!IMU.begin()) {
    Serial.println("Failed to initialize IMU!");
    while (1);
  }

  Serial.print("Accelerometer sample rate = ");
  Serial.print(IMU.accelerationSampleRate());
  Serial.println(" Hz");
  Serial.println();
  Serial.println("Acceleration in G's");
  Serial.println("X\tY\tZ");
}

void loop() {
  float x, y, z;

  if (IMU.accelerationAvailable()) {
    IMU.readAcceleration(x, y, z);

    Serial.print(x);
    Serial.print('\t');
    Serial.print(y);
    Serial.print('\t');
    Serial.println(z);
  }
}

Calibrate the magnetometer and the accelerometer as described in this tutorial:

Also, make sure that you are using the correct library calls to get scaled values.

I have worked with mpu 9250, 6050 and lsm6dsox but have never got such values from them. Is it possible that there is some fault in my bmi270 sensor?

It looks to me like the library does no scaling at all, so you are seeing the raw values.

If that is the case, it is easy enough to scale them yourself. The acceleration along any vertical axis can be taken as 1g when the sensor is held still, so that defines the scale factor for that axis.

There might be significant offset corrections, which you can find using the simple min/max approach: Accelerometer Calibration II: Simple Methods | Chionotech

Is there any library which can help me with scaling? I need to scale accelerometer, gyro and magnetic sensor as they all have raw values only.

Once calibrated, data scaling is accomplished by a single multiplication. You don't need a library for that.

1 Like

As per the datasheet,

image

You will need to divide the values by 8192, because the accelerometer sensitivity for this sensor defaults to -/+ 4g of range (S4g in the table) for this board. Your values will likely saturate, depending on how hard you move, to -/+ 32768 units in your serial monitor.

Check out the Interrupts_subclassing example code which opens up more of the sensor's parameters for the user to tweak.

1 Like

Thanks for your help. I figured that out earlier. For the gyroscope, the values need to be divided by 16.384. I also informed the guy who wrote this library and now he has added scaling in the library so we need not divide by these values anymore

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.