SparkFun BMI330 Arduino Library  v1.0.0-2-gdbddb99
Arduino Library for the SparkFun Qwiic BMI330 6-DoF IMU (Bosch BMI330)
Loading...
Searching...
No Matches
SparkFun_BMI330.h File Reference

Arduino-specific implementation for the SparkFun Qwiic BMI330 6-DoF IMU breakout. More...

#include <SparkFun_Toolkit.h>
#include "sfTk/sfDevBMI330.h"
#include <Arduino.h>

Go to the source code of this file.

Classes

class  SfeBMI330ArdI2C
 Arduino I2C implementation for the SparkFun Qwiic BMI330 breakout. More...
 
class  SfeBMI330ArdSPI
 Arduino SPI implementation for the SparkFun Qwiic BMI330 breakout. More...
 

Macros

#define SFE_BMI330_SPI_CLOCK_DEFAULT   4000000
 Default SPI clock for SfeBMI330ArdSPI, in hertz. More...
 

Detailed Description

Arduino-specific implementation for the SparkFun Qwiic BMI330 6-DoF IMU breakout.

This file provides the Arduino wrappers for the Bosch BMI330. SfeBMI330ArdI2C and SfeBMI330ArdSPI inherit from the platform-independent sfDevBMI330 driver and supply the bus - one over Arduino's Wire library, the other over SPI - through the SparkFun Toolkit. One of these two classes is all a sketch needs.

THE BREAKOUT EXPOSES BOTH BUSES. I2C is the default, and the Qwiic connector makes it the path of least resistance:

SfeBMI330ArdI2C imu;
imu.begin();                     // Qwiic, factory address 0x68
imu.begin(SFE_BMI330_ALT_ADDRESS); // ADR jumper closed, 0x69

The SPI pins are broken out as well, and the same driver drives them - nothing above the bus layer changes:

SfeBMI330ArdSPI imu;
imu.begin(10);                   // chip select on D10

SPI is worth the extra four wires when the application is sampling fast. At 6400 Hz with accelerometer and gyroscope both running, each sample is 16 bytes of payload; 400 kHz I2C leaves very little headroom for anything else on the bus, where a 4 MHz SPI link barely notices. SPI is also the answer to an I2C address collision that the single ADR jumper cannot resolve.

BOTH INTERRUPT PINS ARE EXPOSED. INT1 and INT2 are independent, and any source can be routed to either - see mapInterrupt(). Putting data-ready on one pin and motion events on the other lets an ISR tell them apart without a bus transaction, which is the difference between a clean wake and a read that has to happen before the sketch knows whether it needed to.

Author
SparkFun Electronics
Date
September 2026

SPDX-License-Identifier: MIT

See also
https://github.com/sparkfun/SparkFun_BMI330_Arduino_Library

Macro Definition Documentation

◆ SFE_BMI330_SPI_CLOCK_DEFAULT

#define SFE_BMI330_SPI_CLOCK_DEFAULT   4000000

Default SPI clock for SfeBMI330ArdSPI, in hertz.

The BMI330 is specified to 10 MHz. The default here is 4 MHz, which is quick enough to move a full 6-axis sample in about 40 us and forgiving of the jumper wires a breakout usually meets first. Pass a faster clock to begin() once the wiring is short.