BMA400 Library¶
bma400¶
BMA400 Bosch Accelerometer CircuitPython Driver
Author(s): Jose D. Montoya
-
class bma400.BMA400(i2c_bus: busio.I2C, address: int =
0x14)[source]¶ Driver for the BMA400 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
BMA400class. First you will need to import the libraries to use the sensorimport board import bma400Once this is done you can define your
board.I2Cobject and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA bma = bma400.BMA400(i2c)Now you have access to the attributes
accx, accy, accz = bma.acceleration- property acc_range : str¶
Sensor acc_range
Mode
Value
bma400.ACC_RANGE_20x00bma400.ACC_RANGE_40x01bma400.ACC_RANGE_80x02bma400.ACC_RANGE_160x03
- property filter_bandwidth : str¶
Sensor filter_bandwidth Data rate between 800Hz and 12.5Hz, controlled by
output_data_rate. Its bandwidth can be configured additionally byfilter_bandwidth:Mode
Value
bma400.ACC_FILT_BW00x000.48 x ODRbma400.ACC_FILT_BW10x010.24 x ODR
- property output_data_rate : str¶
Sensor output_data_rate
Mode
Value
bma400.ACCEL_12_5HZ0x05bma400.ACCEL_25HZ0x06bma400.ACCEL_50HZ0x07bma400.ACCEL_100HZ0x08bma400.ACCEL_200HZ0x09bma400.ACCEL_400HZ0xA4bma400.ACCEL_800HZ0xB8
- property oversampling_rate : str¶
Sensor oversampling_rate oversampling rate 0/1/2/3 for normal mode osr=0: lowest power, lowest oversampling rate, lowest accuracy osr=3: highest accuracy, highest oversampling rate, highest power settings 0, 1, 2 and 3 allow linearly trading power versus accuracy(noise)
Mode
Value
bma400.OVERSAMPLING_00x00bma400.OVERSAMPLING_10x01bma400.OVERSAMPLING_20x02bma400.OVERSAMPLING_30x03
- property power_mode : str¶
Sensor power_mode
In sleep mode, data conversions are stopped as well as sensortime functionality.
In low power mode, data conversion runs with a fixed rate of 25Hz. The low power mode should be mainly used in combination with activity detection as self wake-up mode.
In normal mode, output data rates between 800Hz and 12.5Hz.
Mode
Value
bma400.SLEEP_MODE0x00bma400.LOW_POWER_MODE0x01bma400.NORMAL_MODE0x02bma400.SWITCH_TO_SLEEP0x03