Dependencies¶
This driver depends on the Register and Bus Device libraries. Please ensure they are also available on the CircuitPython filesystem. This is easily achieved by downloading a library and driver bundle.
Installing from PyPI¶
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install adafruit-circuitpython-bno055
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-bno055
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-bno055
Usage Notes¶
Of course, you must import the library to use it:
import adafruit_bno055
This driver takes an instantiated and active I2C object (from the busio
or
the bitbangio
library) as an argument to its constructor. The way to create
an I2C object depends on the board you are using. For boards with labeled SCL
and SDA pins, you can:
from busio import I2C
from board import SDA, SCL
i2c = I2C(SCL, SDA)
Once you have the I2C object, you can create the sensor object:
sensor = adafruit_bno055.BNO055(i2c)
And then you can start reading the measurements:
print(sensor.temperature)
print(sensor.euler)
print(sensor.gravity)
Contributing¶
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Documentation¶
For information on building library documentation, please check out this guide.
Table of Contents¶
Simple test¶
Ensure your device works with this simple test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import time
import board
import busio
import adafruit_bno055
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_bno055.BNO055(i2c)
while True:
print("Temperature: {} degrees C".format(sensor.temperature))
print("Accelerometer (m/s^2): {}".format(sensor.acceleration))
print("Magnetometer (microteslas): {}".format(sensor.magnetic))
print("Gyroscope (rad/sec): {}".format(sensor.gyro))
print("Euler angle: {}".format(sensor.euler))
print("Quaternion: {}".format(sensor.quaternion))
print("Linear acceleration (m/s^2): {}".format(sensor.linear_acceleration))
print("Gravity (m/s^2): {}".format(sensor.gravity))
print()
time.sleep(1)
|
adafruit_bno055
- Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - 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
-
class
adafruit_bno055.
BNO055
(i2c, address=40)[source]¶ Driver for the BNO055 9DOF IMU sensor.
-
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.
-
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.
-
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.
-
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
¶ Switch the mode of operation and return the previous mode.
Mode of operation defines which sensors are enabled and whether the measurements are absolute or relative. If a sensor is disabled, it will return an empty tuple.
legend: x=on, -=off +——————+——-+———+——+———-+ | Mode | Accel | Compass | Gyro | Absolute | +==================+=======+=========+======+==========+ | 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 | - | +——————+——-+———+——+———-+ | COMPASS_MODE | X | X | - | X | +——————+——-+———+——+———-+ | M4G_MODE | X | X | - | - | +——————+——-+———+——+———-+ | NDOF_FMC_OFF_MODE| X | X | X | X | +——————+——-+———+——+———-+ | NDOF_MODE | X | X | X | X | +——————+——-+———+——+———-+
The default mode is
NDOF_MODE
.
-
offsets_accelerometer
¶ Calibration offsets for the accelerometer
-
offsets_gyroscope
¶ Calibration offsets for the gyroscope
-
offsets_magnetometer
¶ Calibration offsets for 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.
-
radius_accelerometer
¶ Radius for accelerometer (cm?)
-
radius_magnetometer
¶ Radius for magnetometer (cm?)
-
temperature
¶ Measures the temperature of the chip in degrees Celsius.
-
use_external_crystal
¶ Switches the use of external crystal on or off.
-