adafruit_bno055
This is a CircuitPython driver for the Bosch BNO055 nine degree of freedom inertial measurement unit module with sensor fusion.
Author(s): Radomir Dopieralski
Hardware:
Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055 (Product ID: 4646)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
- class adafruit_bno055.BNO055[source]
Base class for the BNO055 9DOF IMU sensor.
Quickstart: Importing and using the device
Here is an example of using the
BNO055
class. First you will need to import the libraries to use the sensorimport board import adafruit_bno055
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = adafruit_bno055.BNO055_I2C(i2c)
Now you have access to the
acceleration
attribute among otherssensor = accelerometer.acceleration
- property accel_bandwidth: int
Switch the accelerometer bandwidth and return the new bandwidth. Default value: 62.5 Hz See table 3-8 in the datasheet.
- property accel_mode: int
Switch the accelerometer mode and return the new mode. Default value: Normal See table 3-8 in the datasheet.
- property accel_range: int
Switch the accelerometer range and return the new range. Default value: +/- 4g See table 3-8 in the datasheet.
- property acceleration: Tuple[float | None, float | None, float | None]
Gives the raw accelerometer readings, in m/s^2. Returns an empty tuple of length 3 when this property has been disabled by the current mode.
- property axis_remap
Return a tuple with the axis remap register values.
- This will return 6 values with the following meaning:
- X axis remap (a value of AXIS_REMAP_X, AXIS_REMAP_Y, or AXIS_REMAP_Z.
which indicates that the physical X axis of the chip is remapped to a different axis)
Y axis remap (see above)
Z axis remap (see above)
- X axis sign (a value of AXIS_REMAP_POSITIVE or AXIS_REMAP_NEGATIVE
which indicates if the X axis values should be positive/ normal or negative/inverted. The default is positive.)
Y axis sign (see above)
Z axis sign (see above)
Note that the default value, per the datasheet, is NOT P0, but rather P1 ()
- property calibration_status: Tuple[int, int, int, int]
Tuple containing sys, gyro, accel, and mag calibration data.
- property euler: Tuple[float | None, float | None, float | None]
Gives the calculated orientation angles, in degrees. Returns an empty tuple of length 3 when this property has been disabled by the current mode.
- property gravity: Tuple[float | None, float | None, float | None]
Returns the gravity vector, without acceleration in m/s. Returns an empty tuple of length 3 when this property has been disabled by the current mode.
- property gyro: Tuple[float | None, float | None, float | None]
Gives the raw gyroscope reading in radians per second. Returns an empty tuple of length 3 when this property has been disabled by the current mode.
- property gyro_bandwidth: int
Switch the gyroscope bandwidth and return the new bandwidth. Default value: 32 Hz See table 3-9 in the datasheet.
- property gyro_mode: int
Switch the gyroscope mode and return the new mode. Default value: Normal See table 3-9 in the datasheet.
- property gyro_range: int
Switch the gyroscope range and return the new range. Default value: 2000 dps See table 3-9 in the datasheet.
- property linear_acceleration: Tuple[float | None, float | None, float | None]
Returns the linear acceleration, without gravity, in m/s. Returns an empty tuple of length 3 when this property has been disabled by the current mode.
- property magnet_mode: int
Switch the magnetometer power mode and return the new mode. Default value: Forced See table 3-10 in the datasheet.
- property magnet_operation_mode: int
Switch the magnetometer operation mode and return the new mode. Default value: Regular See table 3-10 in the datasheet.
- property magnet_rate: int
Switch the magnetometer data output rate and return the new rate. Default value: 20Hz See table 3-10 in the datasheet.
- property magnetic: Tuple[float | None, float | None, float | None]
Gives the raw magnetometer readings in microteslas. Returns an empty tuple of length 3 when this property has been disabled by the current mode.
- property mode: int
legend: x=on, -=off (see Table 3-3 in datasheet)
Mode
Accel
Compass (Mag)
Gyro
Fusion Absolute
Fusion Relative
CONFIG_MODE
ACCONLY_MODE
X
MAGONLY_MODE
X
GYRONLY_MODE
X
ACCMAG_MODE
X
X
ACCGYRO_MODE
X
X
MAGGYRO_MODE
X
X
AMG_MODE
X
X
X
IMUPLUS_MODE
X
X
X
COMPASS_MODE
X
X
X
M4G_MODE
X
X
X
NDOF_FMC_OFF_MODE
X
X
X
X
NDOF_MODE
X
X
X
X
The default mode is
NDOF_MODE
.You can set the mode using the line below:sensor.mode = adafruit_bno055.ACCONLY_MODE
replacingACCONLY_MODE
with the mode you want to use- CONFIG_MODE
This mode is used to configure BNO, wherein all output data is reset to zero and sensor fusion is halted.
- ACCONLY_MODE
In this mode, the BNO055 behaves like a stand-alone acceleration sensor. In this mode the other sensors (magnetometer, gyro) are suspended to lower the power consumption.
- MAGONLY_MODE
In MAGONLY mode, the BNO055 behaves like a stand-alone magnetometer, with acceleration sensor and gyroscope being suspended.
- GYRONLY_MODE
In GYROONLY mode, the BNO055 behaves like a stand-alone gyroscope, with acceleration sensor and magnetometer being suspended.
- ACCMAG_MODE
Both accelerometer and magnetometer are switched on, the user can read the data from these two sensors.
- ACCGYRO_MODE
Both accelerometer and gyroscope are switched on; the user can read the data from these two sensors.
- MAGGYRO_MODE
Both magnetometer and gyroscope are switched on, the user can read the data from these two sensors.
- AMG_MODE
All three sensors accelerometer, magnetometer and gyroscope are switched on.
- IMUPLUS_MODE
In the IMU mode the relative orientation of the BNO055 in space is calculated from the accelerometer and gyroscope data. The calculation is fast (i.e. high output data rate).
- COMPASS_MODE
The COMPASS mode is intended to measure the magnetic earth field and calculate the geographic direction.
- M4G_MODE
The M4G mode is similar to the IMU mode, but instead of using the gyroscope signal to detect rotation, the changing orientation of the magnetometer in the magnetic field is used.
- NDOF_FMC_OFF_MODE
This fusion mode is same as NDOF mode, but with the Fast Magnetometer Calibration turned ‘OFF’.
- NDOF_MODE
This is a fusion mode with 9 degrees of freedom where the fused absolute orientation data is calculated from accelerometer, gyroscope and the magnetometer.
- class adafruit_bno055.BNO055_I2C(i2c: I2C, address: int = 40)[source]
Driver for the BNO055 9DOF IMU sensor via I2C.
- offsets_accelerometer
Calibration offsets for the accelerometer
- offsets_gyroscope
Calibration offsets for the gyroscope
- offsets_magnetometer
Calibration offsets for the magnetometer
- radius_accelerometer
Radius for accelerometer (cm?)
- radius_magnetometer
Radius for magnetometer (cm?)