Outline
Hardware setup
- raspberry pi
- Qwiic - BNO080搭載 VR IMUモジュール
Raspberry-pi | 配線 | BNO080 |
---|---|---|
01 3.3V | <-> | VCC |
03 SDA | <-> | SDA |
05 SCL | <-> | SCL |
09 GND | <-> | GND |

ディレクトリ構成
home/
├ bno080_accel.py
├ bno080_accel_Quaternion.py # 接続&表示テスト
install
pip install board
sudo pip3 install adafruit-circuitpython-bno08x
check hardwear setting i2cdetect -y 1
run
mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-bno08x
cd ~/IMU_BNO08x/
python3 bno080_accel_Quaternion.py
code
bno080_accel_Quaternion.py
import time
import board
import busio
from adafruit_bno08x import (
BNO_REPORT_ACCELEROMETER,
BNO_REPORT_GYROSCOPE,
BNO_REPORT_MAGNETOMETER,
BNO_REPORT_ROTATION_VECTOR,
)
from adafruit_bno08x.i2c import BNO08X_I2C
i2c = busio.I2C(board.SCL, board.SDA, frequency=400000)
bno = BNO08X_I2C(i2c,address=0x4b)
bno.enable_feature(BNO_REPORT_ACCELEROMETER)
bno.enable_feature(BNO_REPORT_GYROSCOPE)
bno.enable_feature(BNO_REPORT_MAGNETOMETER)
bno.enable_feature(BNO_REPORT_ROTATION_VECTOR)
while True:
time.sleep(0.1)
print("Acceleration:")
accel_x, accel_y, accel_z = bno.acceleration # pylint:disable=no-member
print("X: %0.6f Y: %0.6f Z: %0.6f m/s^2" % (accel_x, accel_y, accel_z))
print("")
print("Gyro:")
gyro_x, gyro_y, gyro_z = bno.gyro # pylint:disable=no-member
print("X: %0.6f Y: %0.6f Z: %0.6f rads/s" % (gyro_x, gyro_y, gyro_z))
print("")
print("Magnetometer:")
mag_x, mag_y, mag_z = bno.magnetic # pylint:disable=no-member
print("X: %0.6f Y: %0.6f Z: %0.6f uT" % (mag_x, mag_y, mag_z))
print("")
print("Rotation Vector Quaternion:")
quat_i, quat_j, quat_k, quat_real = bno.quaternion # pylint:disable=no-member
print(
"I: %0.6f J: %0.6f K: %0.6f Real: %0.6f" % (quat_i, quat_j, quat_k, quat_real)
)
print("")
output
bno080_accel_Quaternion.py
Acceleration:
X: -0.988281 Y: 4.984375 Z: 8.304688 m/s^2
Gyro:
X: 0.005859 Y: 0.001953 Z: 0.000000 rads/s
Magnetometer:
X: -18.125000 Y: -72.187500 Z: -15.812500 uT
Rotation Vector Quaternion:
I: 0.244324 J: 0.051941 K: 0.012756 Real: 0.968201
参考
- Adafruit_CircuitPython_BNO08x/examples/
- pip install adafruit-circuitpython-bno08x
- CircuitPython
- Adafruit_CircuitPython_BNO08x Helper library for the Hillcrest Laboratories BNO08x IMUs
- Pi-BNO080
- ラズベリーパイでデータロガー!電圧測定してグラフにしてみた
- SparkFun Qwiic VR IMU with the BNO080
- Adafruit 9-DOF Orientation IMU Fusion Breakout - BNO085 Python & CircuitPython
- RaspberryPiでI2Cを使えるように設定【2018年】
- Adafruit_CircuitPython_BNO08x