Overview
The BNO085 is a 9-axis motion sensor with its own sensor-fusion processor. One package holds a 3-axis accelerometer, gyroscope and magnetometer plus a small processor running CEVA's SH-2 firmware, which blends all three and hands you finished results: orientation as a quaternion, linear acceleration, gravity, step counts and more. You get stable orientation without writing or tuning a fusion filter yourself.
This pre-soldered GY-BNO08X board breaks out ten pins: VCC, GND, SCL, SDA, ADD, CS, INT, RST, PS1 and PS0. It has no regulator or level shifter, so it is a 3.3 V-only board (2.4 to 3.6 V). With PS0 and PS1 left alone it speaks I2C. Connecting PS0 to 3.3 V switches it to UART-RVC, a one-wire stream of yaw, pitch, roll and acceleration at 115200 baud that even an Arduino Uno can read.
Typical uses are robot heading, self-balancing robots, gimbals, head tracking and motion capture. This manual covers the pinout, wiring for Arduino, ESP32, Raspberry Pi and Pico, working code for each, and answers on the I2C address, UART-RVC mode, yaw drift and connection problems.
At a Glance
Specifications
| Parameter | Value |
| Sensor IC | CEVA BNO085 with SH-2 sensor-fusion firmware |
| Sensors | 3-axis accelerometer, gyroscope and magnetometer |
| Fusion outputs | Rotation vector, game rotation vector, linear acceleration, gravity and more |
| Supply voltage | 2.4 – 3.6 V (use 3.3 V). No regulator on the board. |
| Logic level | 3.3 V. Not 5 V tolerant. |
| I2C | Normally 0x4B on this board, 0x4A with ADD on GND · 100 or 400 kHz |
| UART-RVC | 115200 baud, 100 frames per second, data out on the SDA pin |
| Mode pins | PS1 / PS0: 00 I2C · 01 UART-RVC · 10 UART · 11 SPI |
| INT and RST | Interrupt output and reset input, both active low, optional for I2C |
| Header | 10-pin: VCC · GND · SCL · SDA · ADD · CS · INT · RST · PS1 · PS0 |
Pinout Diagram
Ten pins sit in one row. VCC and GND power the board (3.3 V only). SCL and SDA are the I2C lines, and in UART-RVC mode the SDA pin becomes the data output instead. ADD sets the I2C address, CS is the chip select for SPI mode, INT is the interrupt output and RST is the reset input. PS1 and PS0 select the interface: leave both unconnected for I2C, or connect PS0 to 3.3 V for UART-RVC. The pad marked BOOT is for firmware updates only, so leave it unconnected.
Wiring Guide
Two interfaces are used below. The ESP32 and Raspberry Pi use I2C with the full SH-2 library. The Arduino Uno / Nano and the Pico use UART-RVC, where the sensor streams yaw, pitch, roll and acceleration on a single wire and no library is needed. The mode pins are read only at power-up, so power-cycle the board after changing PS0.
Arduino Uno / Nano Wiring (UART-RVC)
The SH-2 libraries from Adafruit and SparkFun need more memory than an Uno or Nano has, so this setup uses UART-RVC instead. With PS0 on 3.3 V the sensor sends a ready-made heading 100 times a second on its SDA pin.
| BNO085 Pin | Arduino Uno / Nano |
|---|---|
| VCC | 3.3V pin |
| GND | GND |
| PS0 | 3.3V pin (selects UART-RVC) |
| SDA | RX0 (pin 0), data from the sensor |
ESP32 Wiring (I2C)
| BNO085 Pin | ESP32 Pin | Notes |
|---|---|---|
| VCC | 3V3 | Power |
| GND | GND | Ground |
| SDA | GPIO 21 | I2C data |
| SCL | GPIO 22 | I2C clock |
Raspberry Pi Wiring (I2C)
| BNO085 Pin | Raspberry Pi Pin | Notes |
|---|---|---|
| VCC | 3.3V (Pin 1) | Power |
| GND | GND (Pin 6) | Ground |
| SDA | GPIO 2 (Pin 3) | I2C data |
| SCL | GPIO 3 (Pin 5) | I2C clock |
Raspberry Pi Pico Wiring (UART-RVC)
| BNO085 Pin | Pico Pin | Notes |
|---|---|---|
| VCC | 3V3(OUT) (Pin 36) | Power |
| GND | GND (Pin 38) | Ground |
| PS0 | 3V3(OUT) (Pin 36) | RVC mode |
| SDA | GP5 (Pin 7) | UART1 RX |
Code Examples
View or download this product's example code on GitHub.
All four examples print yaw, pitch and roll in degrees about ten times a second. The UART-RVC examples decode the sensor's 19-byte frames directly. The I2C examples read the game rotation vector, a quaternion built from the accelerometer and gyroscope, and convert it to angles.
Arduino Uno / Nano — UART-RVC (No Library)
// BNO085 (GY-BNO08X) in UART-RVC mode on an Arduino Uno or Nano - no library needed
// Wiring: VCC -> 3.3V, GND -> GND, PS0 -> 3.3V, SDA pin (data out) -> RX0 (pin 0)
// Unplug the wire from pin 0 while uploading, then reconnect it.
// The sensor sends a 19-byte frame 100 times per second at 115200 baud.
uint8_t frame[17]; // everything after the two 0xAA header bytes
unsigned long lastPrint = 0;
int16_t toInt16(uint8_t low, uint8_t high) {
return (int16_t)(((uint16_t)high << 8) | low);
}
void setup() {
Serial.begin(115200); // RX listens to the sensor, TX prints to the Serial Monitor
}
// Returns true when frame[] holds a complete frame with a valid checksum
bool readFrame() {
while (Serial.available() >= 19) {
if (Serial.read() != 0xAA) continue; // first header byte
if (Serial.peek() != 0xAA) continue; // second header byte
Serial.read();
for (uint8_t i = 0; i < 17; i++) frame[i] = Serial.read();
uint8_t sum = 0;
for (uint8_t i = 0; i < 16; i++) sum += frame[i];
if (sum == frame[16]) return true;
}
return false;
}
void loop() {
if (!readFrame()) return;
if (millis() - lastPrint < 100) return; // print 10 times per second
lastPrint = millis();
float yaw = toInt16(frame[1], frame[2]) * 0.01; // degrees
float pitch = toInt16(frame[3], frame[4]) * 0.01;
float roll = toInt16(frame[5], frame[6]) * 0.01;
Serial.print("Yaw: ");
Serial.print(yaw, 2);
Serial.print(" Pitch: ");
Serial.print(pitch, 2);
Serial.print(" Roll: ");
Serial.println(roll, 2);
}
ESP32 — I2C with the Adafruit BNO08x Library
// BNO085 (GY-BNO08X) on an ESP32 over I2C - quaternion to yaw / pitch / roll
// Library Manager: install "Adafruit BNO08x" (it pulls in Adafruit BusIO and Unified Sensor)
// Wiring: VCC -> 3V3, GND -> GND, SDA -> GPIO 21, SCL -> GPIO 22 (PS0 and PS1 left open)
#include <Adafruit_BNO08x.h>
#define BNO08X_RESET -1 // RST pin not wired
Adafruit_BNO08x bno08x(BNO08X_RESET);
sh2_SensorValue_t sensorValue;
void setReports() {
// Game rotation vector: smooth orientation from the accelerometer and gyroscope
if (!bno08x.enableReport(SH2_GAME_ROTATION_VECTOR, 20000)) { // one report every 20 ms
Serial.println("Could not enable the game rotation vector");
}
}
void setup() {
Serial.begin(115200);
// This board style normally answers at 0x4B; it moves to 0x4A when ADD is tied to GND
if (!bno08x.begin_I2C(0x4B) && !bno08x.begin_I2C(0x4A)) {
Serial.println("BNO085 not found - check wiring and 3.3 V power");
while (true) { delay(1000); }
}
setReports();
}
void loop() {
if (bno08x.wasReset()) setReports(); // turn the report back on after a reset
if (!bno08x.getSensorEvent(&sensorValue)) return;
if (sensorValue.sensorId != SH2_GAME_ROTATION_VECTOR) return;
float qr = sensorValue.un.gameRotationVector.real;
float qi = sensorValue.un.gameRotationVector.i;
float qj = sensorValue.un.gameRotationVector.j;
float qk = sensorValue.un.gameRotationVector.k;
float yaw = atan2(2.0 * (qi * qj + qk * qr), 1.0 - 2.0 * (qj * qj + qk * qk)) * RAD_TO_DEG;
float pitch = asin(constrain(2.0 * (qj * qr - qi * qk), -1.0, 1.0)) * RAD_TO_DEG;
float roll = atan2(2.0 * (qj * qk + qi * qr), 1.0 - 2.0 * (qi * qi + qj * qj)) * RAD_TO_DEG;
Serial.print("Yaw: ");
Serial.print(yaw, 1);
Serial.print(" Pitch: ");
Serial.print(pitch, 1);
Serial.print(" Roll: ");
Serial.println(roll, 1);
}
Raspberry Pi — Python over I2C
#!/usr/bin/env python3
# BNO085 (GY-BNO08X) on Raspberry Pi over I2C
# Install once: pip3 install adafruit-circuitpython-bno08x (enable I2C in raspi-config)
# Recommended: add dtparam=i2c_arm_baudrate=400000 to /boot/firmware/config.txt, then reboot
import math
import time
import board
import busio
from adafruit_bno08x import BNO_REPORT_GAME_ROTATION_VECTOR
from adafruit_bno08x.i2c import BNO08X_I2C
i2c = busio.I2C(board.SCL, board.SDA, frequency=400000)
bno = BNO08X_I2C(i2c, address=0x4B) # use 0x4A if ADD is tied to GND
bno.enable_feature(BNO_REPORT_GAME_ROTATION_VECTOR)
while True:
qi, qj, qk, qr = bno.game_quaternion
yaw = math.degrees(math.atan2(2 * (qi * qj + qk * qr), 1 - 2 * (qj * qj + qk * qk)))
pitch = math.degrees(math.asin(max(-1.0, min(1.0, 2 * (qj * qr - qi * qk)))))
roll = math.degrees(math.atan2(2 * (qj * qk + qi * qr), 1 - 2 * (qi * qi + qj * qj)))
print(f"Yaw: {yaw:7.1f} Pitch: {pitch:6.1f} Roll: {roll:7.1f}")
time.sleep(0.1)
Raspberry Pi Pico — MicroPython over UART-RVC
# BNO085 (GY-BNO08X) on Raspberry Pi Pico in UART-RVC mode (MicroPython, no driver needed)
# Wiring: VCC -> 3V3(OUT), GND -> GND, PS0 -> 3V3(OUT), SDA pin (data out) -> GP5 (UART1 RX)
from machine import UART, Pin
import struct
import time
uart = UART(1, baudrate=115200, tx=Pin(4), rx=Pin(5), rxbuf=512)
HEADER = bytes([0xAA])
def read_frame():
"""Return ((yaw, pitch, roll) in degrees, (x, y, z) in m/s^2), or None."""
while uart.any() >= 19:
if uart.read(1) != HEADER: # first header byte
continue
if uart.read(1) != HEADER: # second header byte
continue
frame = uart.read(17)
if frame is None or len(frame) != 17:
return None
if sum(frame[0:16]) & 0xFF != frame[16]:
continue # checksum mismatch
index, yaw, pitch, roll, ax, ay, az = struct.unpack_from("<Bhhhhhh", frame, 0)
angles = (yaw * 0.01, pitch * 0.01, roll * 0.01)
accel = (ax * 0.0098067, ay * 0.0098067, az * 0.0098067) # mg to m/s^2
return angles, accel
return None
while True:
latest = None
reading = read_frame()
while reading: # drain the buffer and keep the newest frame
latest = reading
reading = read_frame()
if latest:
(yaw, pitch, roll), (ax, ay, az) = latest
print("Yaw: {:7.2f} Pitch: {:6.2f} Roll: {:7.2f} Accel: {:5.2f} {:5.2f} {:5.2f}".format(
yaw, pitch, roll, ax, ay, az))
time.sleep(0.1)



