MicroPython BMI270 Library¶
bmi270¶
MicroPython Driver for the Bosch BMI270 Accelerometer/Gyro Sensor
Author(s): Jose D. Montoya
-
class micropython_bmi270.bmi270.BMI270(i2c, address: int =
0x68)[source]¶ Driver for the BMI270 Sensor connected over I2C.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
BMI270class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_bmi270 import bmi270Once this is done you can define your
machine.I2Cobject and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) bmi270 = bmi270.BMI270(i2c)Now you have access to the attributes
- property acceleration_operation_mode : str¶
Sensor acceleration_operation_mode
Mode
Value
bmi270.ACCELERATOR_DISABLED0b0bmi270.ACCELERATOR_ENABLED0b1
- property acceleration_range : str¶
Sensor acceleration_range
Mode
Value
bmi270.ACCEL_RANGE_2G0b00bmi270.ACCEL_RANGE_4G0b01bmi270.ACCEL_RANGE_8G0b10bmi270.ACCEL_RANGE_16G0b11
- error_code() None[source]¶
The register is meant for debug purposes, not for regular verification if an operation completed successfully.
Fatal Error: Error during bootup. This flag will not be cleared after reading the register.The only way to clear the flag is a POR.
- property gyro_range : str¶
Sensor gyro_range
Mode
Value
bmi270.GYRO_RANGE_20000b000bmi270.GYRO_RANGE_10000b001bmi270.GYRO_RANGE_5000b010bmi270.GYRO_RANGE_2500b011bmi270.GYRO_RANGE_1250b100
- load_config_file() None[source]¶
Load configuration file. This is necessary to use the sensor. Script adapted to use with MicroPython from: https://github.com/CoRoLab-Berlin/bmi270_python (c) 2023 MIT License Kevin Sommler