Configuration

This guide covers all configuration options available for the BNO08x driver.

Sensor Configuration

Enabling Sensors

1
2
3
4
5
6
7
8
// Enable Rotation Vector at 100 Hz (10ms interval)
imu.EnableSensor(bno08x::BNO085Sensor::RotationVector, 10);

// Enable Step Counter (on-change, interval = 0)
imu.EnableSensor(bno08x::BNO085Sensor::StepCounter, 0);

// Enable Accelerometer at 50 Hz with sensitivity threshold
imu.EnableSensor(bno08x::BNO085Sensor::Accelerometer, 20, 0.1f);

Interval: Report interval in milliseconds (0 = on-change only)

Sensitivity: Change sensitivity threshold for on-change sensors (0.0 = disabled)

Available Sensors

Sensor Description Typical Rate
RotationVector Fused orientation quaternion 1-400 Hz
GameRotationVector Orientation without heading 1-400 Hz
Accelerometer Calibrated acceleration 1-400 Hz
Gyroscope Calibrated angular velocity 1-400 Hz
Magnetometer Calibrated magnetic field 1-50 Hz
LinearAcceleration Acceleration minus gravity 1-400 Hz
Gravity Gravity vector 1-50 Hz
StepCounter Step count (on-change) 0 (on-change)
StepDetector Step detection event 0 (on-change)
TapDetector Tap gesture detection 0 (on-change)
ShakeDetector Shake gesture detection 0 (on-change)

Disabling Sensors

1
imu.DisableSensor(bno08x::BNO085Sensor::RotationVector);

Callback Configuration

Sensor Event Callback

1
2
3
4
5
6
imu.SetCallback([](const bno08x::SensorEvent& e) {
    if (e.sensor == bno08x::BNO085Sensor::RotationVector) {
        auto euler = e.toEuler();
        printf("Yaw: %.1f°\n", euler.yaw);
    }
});

RVC Mode Callback

1
2
3
4
imu.SetRvcCallback([](const rvc_SensorValue_t& val) {
    printf("Yaw: %.2f°, Pitch: %.2f°, Roll: %.2f°\n", 
           val.yaw_deg, val.pitch_deg, val.roll_deg);
});

Interface Selection

Selecting Communication Interface

1
2
3
4
5
6
7
8
9
10
11
// Select I²C interface (PS0=0, PS1=0)
imu.SelectInterface(bno08x::BNO085Interface::I2C);

// Select SPI interface (PS0=1, PS1=1)
imu.SelectInterface(bno08x::BNO085Interface::SPI);

// Select UART interface (PS0=0, PS1=1)
imu.SelectInterface(bno08x::BNO085Interface::UART);

// Select UART RVC mode (PS0=1, PS1=0)
imu.SelectInterface(bno08x::BNO085Interface::UARTRVC);

Note: Interface selection is typically done via hardware pins (PS0/PS1) at boot time. This method is only useful if your hardware allows dynamic control of these pins.

Hardware Pin Control

Reset Control

1
2
// Hardware reset (if RSTN pin is wired)
imu.HardwareReset(2);  // Hold reset low for 2ms

Boot Pin Control (DFU Mode)

1
2
3
// Set BOOTN pin low to enter bootloader mode
imu.SetBootPin(true);   // Active low, so true = low
imu.HardwareReset(10);  // Reset while BOOTN is low

Wake Pin Control (SPI Mode)

1
2
// Pull WAKE pin low to wake sensor from suspend
imu.SetWakePin(true);   // Active low

Data Access Modes

1
2
3
4
imu.SetCallback([](const bno08x::SensorEvent& e) {
    // Process event immediately
});
imu.Update();  // Call frequently

Polling Mode

1
2
3
4
5
6
imu.Update();  // Must be called frequently

if (imu.HasNewData(bno08x::BNO085Sensor::RotationVector)) {
    auto event = imu.GetLatest(bno08x::BNO085Sensor::RotationVector);
    // Process event
}

Sensor Accuracy

The SensorEvent structure includes an accuracy field (0-3) indicating calibration status:

  • 0: Unreliable - sensor not calibrated
  • 1: Low accuracy - calibration in progress
  • 2: Medium accuracy - partially calibrated
  • 3: High accuracy - fully calibrated

Recommendation: Wait for accuracy = 3 before trusting orientation data, especially for heading/yaw.

Power Management

Disable Unused Sensors

To save power, disable sensors you don’t need:

1
2
3
// Only enable what you need
imu.EnableSensor(bno08x::BNO085Sensor::RotationVector, 10);
// Don't enable other sensors if not needed

Update Frequency

Call Update() as frequently as possible for best performance. The driver is designed to be called from:

  • Main loop
  • RTOS task
  • Interrupt service routine (ISR)
  • Timer callback

Default Configuration

After Begin(), the sensor is initialized with:

  • No sensors enabled (must enable explicitly)
  • No callbacks registered
  • Default sensor fusion settings
  • Auto re-sync enabled (detects resets and re-enables configured sensors)

Next Steps


Navigation ⬅️ Platform Integration | Next: Examples ➡️ | Back to Index