Adafruit 9-DOF Orientation IMU Fusion Breakout - BNO085 (BNO080) - STEMMA QT / Qwiic (ADA4754)

This is a placeholder topic for “Adafruit 9-DOF Orientation IMU Fusion Breakout - BNO085 (BNO080) - STEMMA QT / Qwiic” comments.



Here it is, the motion sensor you were looking for: the one that just gives you the directly usable information without requiring you to first consult with a PhD to learn the arcane arts of Sensor Fusion.

Read more

1 Like

Hi, I want to know Is the IMU sensor BNO085 can detect the angle it rotates in degree?

1 Like

Hi Yiyang,

As listed in the product description, one of the many data streams coming out of this IMU is absolute orientation:

All the best with your project and let us know if you have any more questions!
-James

1 Like

I have had problems consistently reading this unit on a Raspberry Pi 4b over I2C, and I’ve tried the imbalanced resistor trick as well as SW I2C interfaces to no avail. Furthermore, I can’t get it functioning in either UART or SPI modes. Has anyone else met similar difficulties? I had similar problems with BNO055.

3 Likes

Hi Joni,

The first step is to post the code you’re running, the output of sudo i2cdetect -y and a picture of what your setup looks like.

Once you’ve sent that through we can have a better look into what’s causing your problems.
-James

2 Likes

Hi -
I recently bought the Sparkfun RedBoard and Adafruit BNO085 sensor. I am trying to write a sketch using the sample code on the Adafruit product page for Serial Plotter.
https://learn.adafruit.com/adafruit-9-dof-orientation-imu-fusion-breakout-bno085/uart-rvc-for-arduino

when i try to upload, I get error -

Compilation error: redefinition of 'void setup()' 

when I try other sample code sketches such as the Serial Console, the error is -

Compilation error: 'Serial1' was not declared in this scope

I am a very new Arduino user. I am just trying to get the BNO085 to display the sensor data.

Any help would be greatly appreciated.
Thank you.
Jason

Hi Jason,

Please post a .zip of your code, or just paste it into your post with three backticks (`) either side.

We’ll take a look and see if we spot everything, but I suspect you’ve got two void setups and have tried to use Serial1 in loop but you’ve defined it in setup

Thanks James, I just copied and pasted the code from the Adafruit page. Here is everything in my sketch windows. I am using a Mac OS with IDE 2.1.0. I have the Board selected as Arduino Uno and port selected as /dev/cu.usbserial-1410 Serial Port (USB).

Here is code for the UART_RVC, Serial Console - using the File → Examples → Adafruit BNO08x RVC-> uart_rvc with the error

Compilation error: 'Serial1' was not declared in this scope

Code -

/* Test sketch for Adafruit BNO08x sensor in UART-RVC mode */

#include "Adafruit_BNO08x_RVC.h"

Adafruit_BNO08x_RVC rvc = Adafruit_BNO08x_RVC();

void setup() {
  // Wait for serial monitor to open
  Serial.begin(115200);
  while (!Serial)
    delay(10);

  Serial.println("Adafruit BNO08x IMU - UART-RVC mode");

  Serial1.begin(115200); // This is the baud rate specified by the datasheet
  while (!Serial1)
    delay(10);

  if (!rvc.begin(&Serial1)) { // connect to the sensor over hardware serial
    Serial.println("Could not find BNO08x!");
    while (1)
      delay(10);
  }

  Serial.println("BNO08x found!");
}

void loop() {
  BNO08x_RVC_Data heading;

  if (!rvc.read(&heading)) {
    return;
  }

  Serial.println();
  Serial.println(F("---------------------------------------"));
  Serial.println(F("Principal Axes:"));
  Serial.println(F("---------------------------------------"));
  Serial.print(F("Yaw: "));
  Serial.print(heading.yaw);
  Serial.print(F("\tPitch: "));
  Serial.print(heading.pitch);
  Serial.print(F("\tRoll: "));
  Serial.println(heading.roll);
  Serial.println(F("---------------------------------------"));
  Serial.println(F("Acceleration"));
  Serial.println(F("---------------------------------------"));
  Serial.print(F("X: "));
  Serial.print(heading.x_accel);
  Serial.print(F("\tY: "));
  Serial.print(heading.y_accel);
  Serial.print(F("\tZ: "));
  Serial.println(heading.z_accel);
  Serial.println(F("---------------------------------------"));


  //  delay(200);
}

For the Serial Plotter, I opened File → Examples → Adafruit BNO08x RVC-> uart_rvc_plotter, and get the same error with this code -

/* Test sketch for Adafruit BNO08x sensor in UART-RVC mode */

#include "Adafruit_BNO08x_RVC.h"

Adafruit_BNO08x_RVC rvc = Adafruit_BNO08x_RVC();

void setup() {
  // Wait for serial monitor to open
  Serial.begin(115200);
  while (!Serial)
    delay(10);

  Serial.println("Adafruit BNO08x IMU - UART-RVC mode");

  Serial1.begin(115200); // This is the baud rate specified by the datasheet
  while (!Serial1)
    delay(10);

  if (!rvc.begin(&Serial1)) { // connect to the sensor over hardware serial
    Serial.println("Could not find BNO08x!");
    while (1)
      delay(10);
  }

  Serial.println("BNO08x found!");
}

void loop() {
  BNO08x_RVC_Data heading;

  if (!rvc.read(&heading)) {
    return;
  }

  Serial.println();
  Serial.println(F("---------------------------------------"));
  Serial.println(F("Principal Axes:"));
  Serial.println(F("---------------------------------------"));
  Serial.print(F("Yaw: "));
  Serial.print(heading.yaw);
  Serial.print(F("\tPitch: "));
  Serial.print(heading.pitch);
  Serial.print(F("\tRoll: "));
  Serial.println(heading.roll);
  Serial.println(F("---------------------------------------"));
  Serial.println(F("Acceleration"));
  Serial.println(F("---------------------------------------"));
  Serial.print(F("X: "));
  Serial.print(heading.x_accel);
  Serial.print(F("\tY: "));
  Serial.print(heading.y_accel);
  Serial.print(F("\tZ: "));
  Serial.println(heading.z_accel);
  Serial.println(F("---------------------------------------"));


  //  delay(200);
}

The void loop error was because I opened a new sketch and didn’t delete the default code that appeared, so I didn’t get that error this time, just the Serial1 not declared.

Thank you.

Hi @Jason243967 I notice you mentioned you are trying the code on an Arduino UNO, which only has a single Serial bus. Serial1 is only available on Arduinos with more than one Serial bus, such as the Mega. The images on the Adafruit page you linked depict something different to a Uno, it’s a pity they haven’t specified which Arduino they are using.

You might be able to replicate what they are doing with a Uno using SoftwareSerial. Alternatively, use the BNO080 with I2C rather than UART, which will free up the single Serial bus on the Arduino for passing the data to your computer.

3 Likes

Thanks Jacob. Haven’t tried it yet, but I wanted to say thank you for the reply. I will try my best, even though I am a total newbie and this is all a bit confusing. The Arduino board I am using is a Sparkfun Redboard, which I have selected as a UNO. It is connected via stemmaQT with qwiic cable, so I don’t have to worry about pins and soldering.

If I use this Sparkfun code snippet - will that fix the problem?

https://learn.sparkfun.com/tutorials/redboard-turbo-hookup-guide/example-serial-ports

1 Like

Hi Jason,

I think I know what the issue is, and I agree it’s a bit confusing.

If you are using the SparkFun Redboard Qwiic then you are right to select UNO in the Arduino IDE. The Redboard Qwiic uses the same microcontroller as it’s brains (ATmega328).

The SparkFun guide you linked is written for the SparkFun Redboard Turbo. The tricky part is that the Redboard Turbo is the same size and shape as the UNO so that all the things that work with a UNO should still work on a turbo and they can add a few extra features, like more than one serial interface.
The downside is that because the Redboard Turbo uses a more advanced microcontroller (ATSAMD21G18), any code written using those extra features isn’t backward compatible with the standard UNO.

Jacob’s suggested workaround should work and get you back on track.

1 Like

Thanks Jacob and Trent. I have now switched boards, and am trying to get the BNO085 working with the Sparkfun SAMD51 Thing Plus.

I have all the libraries and dependencies loaded, the IDE recognizes the board and port. I can compile and upload code such as the example rotation vector. But after opening Serial Monitor and getting data for at most a few tenths of a second, the communication between the board/sensor and my serial monitor appears to hang and the serial monitor stops receiving/displaying the sensor data.

I have reset the board in bootloader mode, successfully uploaded the code example file again, and then opened serial monitor - same issue, the data displays for a brief moment (most that I got was 4 seconds, but it’s usually less than that).

Any thoughts? I have tried different micro-usb cables, i have tried changing the usb port connection to my computer. I always check that the board/port is properly selected in the IDE. the IDE has no problem identifying the board if I unplug it and re-connect it.

Any advice would be greatly appreciated. As I said above, I am very inexperienced Arduino user, with no programming expertise at all. Just trying to make work my way through. Thank you.

  • just one other point - if I unplug the USB cable from the computer and plug it back in, the SAMD51 starts displaying the sensor data (am using the rotation vector example) in the serial monitor for several seconds, and then just stops - if i repeat the unplugging of the USB cable from the computer, serial monitor will receive and display data again for a few seconds before stopping.

Hi @Jason243967 - if the code halts randomly there’s a couple things that could be at play.

It is probably a good idea to uncomment this delay - especially if you’re using soft serial.

If there is a single bad reading this condition will halt the code - that could be any loose wire or another reason for a failed reading.

Thanks Michael. I will try this and let you know what happens. Appreciate the reply.