No readings from IMU

Hello everyone,

I am attempting to access the IMU data from the Nano 33 BLE REV2 (ABX00071). I know it uses two IMUs, BMI270 and BMM150, and I am using the example sketch for the corresponding library.

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);
  }
}

This is the output from the serial monitor:

Started
Accelerometer sample rate = 0.39 Hz

Acceleration in G's
X	Y	Z

After a few minutes, the only reading seen is 0.00 0.00 0.00

Please advise :slight_smile:

Thank you!

  if (!IMU.begin()) {
    Serial.println("Failed to initialize IMU!");
    while (1);
  }
// Try adding this
  IMU.setContinuousMode();

Thank you for the advice!

I added that line, but I am afraid this is the output after a few minutes:

Started
Accelerometer sample rate = 0.39 Hz

Acceleration in G's
X	Y	Z
0.00	0.00	0.00

I have tried this with two boards of the same model and observed the same results. Additionally, a sample rate of 0.39Hz seems low no?

You must have some kind of bus contention. Here is the function you called that returned 0.39. It is supposed to return 119.0.

float LSM9DS1Class::accelerationSampleRate()
{
  return 119.0F;
}

You have not included the library.

#include "Arduino_BMI270_BMM150.h"

This is the library example for Simple Accellerometer

/*
  Arduino BMI270 - Simple Accelerometer

  This example reads the acceleration values from the BMI270
  sensor and continuously prints them to the Serial Monitor
  or Serial Plotter.

  The circuit:
  - Arduino Nano 33 BLE Sense Rev2

  created 10 Jul 2019
  by Riccardo Rizzo

  This example code is in the public domain.
*/

#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);
  }
}

In addition to cattledog, the IMU uses i2c, which is connected to pins A4 and A5. You don't have any hardware connected there, do you?
Just checking.

I think the imu is connected internally on the board with Wire1on SDA1/SCL1 which is not routed to A4/A5.

Thank you both!

  1. Could you please explain what you mean by a bus contention?

  2. I have included the library in the script, I mistakenly did not include that when I copied my code here. The code I am uploading to the board is identical to the code provided. Do you have any other suggestions?

  3. There is no hardware connected to the board, only the USB cable to my computer. How would I troubleshoot an i2c error?

If you want to experiment, you can run the i2c_scanner sketch on Wire1.
Just a thought...

Thank you for the suggestion!

I found two I2C devices, one at 0x10 and one at 0x68. I presume these are the BMI270 and BMM150. From page 7 of the datasheet, it appears that these are the only I2C devices on board, so I think this is a fair judgement.

Is there anything else I could try? Is it possible I have received two dud boards?

0x68 is the BMI270.
0x10 is the BMM150
Don't know what to tell you.

Edit: Browsing through the library, I think the library is attempting to use Wire instead of Wire1. This is from /src/BoschSensorClass.h:
BoschSensorClass(TwoWire& wire = Wire);

One additional point - I modified the default IMU sketch to spit out the IMU sample rate - I see 99.84, which is expected in the documentation.

I'm going to try a couple of different nanos with a different IMU. Thank you for your help so far!

Just saw your most recent reply - I've now made that change and did not observe a difference in the output

No. See these lines 503-507 at the end of BMI270.cpp

#ifdef TARGET_ARDUINO_NANO33BLE
BoschSensorClass IMU_BMI270_BMM150(Wire1);
#else
BoschSensorClass IMU_BMI270_BMM150(Wire);
#endif

I do not the think the library is broken. There are no issues reported on github about the wrong bus being used. I have worked on other threads with people using that library on a Nano33 Ble rev2 and they are getting data from the imu.

@cattledog You solution worked for me. Thanks

Hello,
I just got a nano 33 BLE rev.2 board and I have exactly the same problem. It might be interesting to compare the serial numbers or manufacturing dates of our boards. Mine is marked 08-23. The NINA-B306 module is marked 008-0023/20. The BMI270 IMU is marked 5L 3FM and the BMM150 magnetometer is marked 157 T208 09T.

Hello,

Thank you for sharing your questions!

Please ensure that you are using the latest version of the Arduino_BMI270_BMM150 library. You can update or verify this through the Library Manager in the Arduino IDE.

Once updated, I recommend testing the SimpleGyroscope example sketch from the library, which you can find here: SimpleGyroscope Example.

If you still receive only 0.00 values or encounter the "Failed to initialize IMU!" message, it could indicate a hardware or configuration issue. In that case, I encourage you to reach out to Arduino Technical Support via the following form: Arduino Support Contact Form.

Feel free to share any additional details if the issue persists!

Best regards,

Jorge

1 Like

Thank you for your answer, Jorge.
I solved my problem : in the board manager of the IDE, the Mbed OS Nano boards was in an old version: 4.0.8. I updated it to 4.2.1 and all is OK. Maybe the 4.0.8 version is OK for rev. 1 but not for rev. 2 of tne Nano 33 BLE.

1 Like

Hello,

I am facing the same problem. I just bought an Arduino Nano 33 BLE rev2 (not sense!).
I tried:

  • updating all softwares (Arduino IDE, BMI270_BMM150 library, and board package)
  • using different computers and cables
  • tips from this thread

After loading the library example, I receive no reading from the IMU:

Started

Gyroscope sample rate = 0.39 Hz

Gyroscope in degrees/second

X Y Z

The sample rate really worries me. I was wondering if there are any other things anyone tried?

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