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
BMA400
class. First you will need to import the libraries to use the sensorimport board import bma400
Once this is done you can define your
board.I2C
object 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_2
0x00
bma400.ACC_RANGE_4
0x01
bma400.ACC_RANGE_8
0x02
bma400.ACC_RANGE_16
0x03
- 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_BW0
0x00
0.48 x ODRbma400.ACC_FILT_BW1
0x01
0.24 x ODR
- property output_data_rate : str¶
Sensor output_data_rate
Mode
Value
bma400.ACCEL_12_5HZ
0x05
bma400.ACCEL_25HZ
0x06
bma400.ACCEL_50HZ
0x07
bma400.ACCEL_100HZ
0x08
bma400.ACCEL_200HZ
0x09
bma400.ACCEL_400HZ
0xA4
bma400.ACCEL_800HZ
0xB8
- 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_0
0x00
bma400.OVERSAMPLING_1
0x01
bma400.OVERSAMPLING_2
0x02
bma400.OVERSAMPLING_3
0x03
- 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_MODE
0x00
bma400.LOW_POWER_MODE
0x01
bma400.NORMAL_MODE
0x02
bma400.SWITCH_TO_SLEEP
0x03