Library Installation
You can install the Adafruit BNO08x RVC library for Arduino using the Library Manager in the Arduino IDE.
Click the Manage Libraries ... menu item, search for Adafruit BNO08x RVC, and select the Adafruit BNO08x RVC library:
- Board 3V to BNO085 Vin (Red Wire).
- Board GND to BNO085 GND (Black Wire)
- Board RX to BNO085 SDA (Blue Wire)
- Board 3V to BNO085 P0 (Purple Wire
Open up File -> Examples -> Adafruit BNO08x RVC-> uart_rvc
After opening the demo file, upload to your Arduino wired up to the sensor. Once you upload the code, you will see the heading principal axes and acceleration values being printed when you open the Serial Monitor (Tools->Serial Monitor) at 115200 baud, similar to this:
Load Example - Serial Plotter
In addition to the text based example code shown above, we have also included a version that is formatted to display nicely in the Arduino Serial Plotter.
Open up File -> Examples -> Adafruit BNO08x RVC-> uart_rvc_plotter
After opening the demo file, upload to your Arduino wired up to the sensor. Once you upload the code, open the Serial Plotter (Tools->Serial Plotter) at 115200 baud and you will see graphs of the heading and acceleration like these:
Play around with it! Move the sensor around and see how rolling back and forth, front to back, and twisting change the graphs. I think you'll be pleasantly surprised!
/* 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); }
Page last edited January 21, 2025
Text editor powered by tinymce.