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:

Software and Dependencies:

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 sensor

import board
import adafruit_bno055

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = adafruit_bno055.BNO055_I2C(i2c)

Now you have access to the acceleration attribute among others

sensor = accelerometer.acceleration
accel_bandwidth

Switch the accelerometer bandwidth and return the new bandwidth. Default value: 62.5 Hz See table 3-8 in the datasheet.

accel_mode

Switch the accelerometer mode and return the new mode. Default value: Normal See table 3-8 in the datasheet.

accel_range

Switch the accelerometer range and return the new range. Default value: +/- 4g See table 3-8 in the datasheet.

acceleration

Gives the raw accelerometer readings, in m/s. Returns an empty tuple of length 3 when this property has been disabled by the current mode.

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 ()

calibrated

Boolean indicating calibration status.

calibration_status

Tuple containing sys, gyro, accel, and mag calibration data.

euler

Gives the calculated orientation angles, in degrees. Returns an empty tuple of length 3 when this property has been disabled by the current mode.

external_crystal

Switches the use of external crystal on or off.

gravity

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.

gyro

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.

gyro_bandwidth

Switch the gyroscope bandwidth and return the new bandwidth. Default value: 32 Hz See table 3-9 in the datasheet.

gyro_mode

Switch the gyroscope mode and return the new mode. Default value: Normal See table 3-9 in the datasheet.

gyro_range

Switch the gyroscope range and return the new range. Default value: 2000 dps See table 3-9 in the datasheet.

linear_acceleration

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.

magnet_mode

Switch the magnetometer power mode and return the new mode. Default value: Forced See table 3-10 in the datasheet.

magnet_operation_mode

Switch the magnetometer operation mode and return the new mode. Default value: Regular See table 3-10 in the datasheet.

magnet_rate

Switch the magnetometer data output rate and return the new rate. Default value: 20Hz See table 3-10 in the datasheet.

magnetic

Gives the raw magnetometer readings in microteslas. Returns an empty tuple of length 3 when this property has been disabled by the current mode.

mode

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
replacing ACCONLY_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.

quaternion

Gives the calculated orientation as a quaternion. Returns an empty tuple of length 3 when this property has been disabled by the current mode.

temperature

Measures the temperature of the chip in degrees Celsius.

use_external_crystal

Switches the use of external crystal on or off.

class adafruit_bno055.BNO055_I2C(i2c, address=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?)

class adafruit_bno055.BNO055_UART(uart)[source]

Driver for the BNO055 9DOF IMU sensor via UART.

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?)