CircuitPython H3LIS200DL Driver¶
h3lis200dl
¶
CircuitPython Driver for the ST H3LIS200DL Accelerometer
Author(s): Jose D. Montoya
- class h3lis200dl.AlertStatus(high_g, low_g)¶
Create new instance of AlertStatus(high_g, low_g)
- high_g¶
Alias for field number 0
- low_g¶
Alias for field number 1
-
class h3lis200dl.H3LIS200DL(i2c_bus: busio.I2C, address: int =
0x19
)[source]¶ Driver for the H3LIS200DL 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
H3LIS200DL
class. First you will need to import the libraries to use the sensorimport board import h3lis200dl
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA h3lis = h3lis200dl.H3LIS200DL(i2c)
Now you have access to the attributes
accx, accy, accz = h3lis.acceleration
- property acceleration : tuple[float, float, float]¶
Acceleration property :return: Acceleration data
- property data_rate : str¶
Sensor data_rate selects the data rate at which acceleration samples are produced. In low-power modes they define the output data resolution. Table shows all the possible configurations
Mode
Value
h3lis200dl.RATE_50HZ
0b00
h3lis200dl.RATE_100HZ
0b01
h3lis200dl.RATE_400HZ
0b10
h3lis200dl.RATE_1000HZ
0b11
- property full_scale_selection : str¶
Sensor full_scale_selection
Mode
Value
h3lis200dl.SCALE_100G
0b0
h3lis200dl.SCALE_200G
0b1
- property high_pass_filter_cutoff : str¶
Sensor high_pass_filter_cutoff
Mode
Value
Data Rate=50 Hz
Data Rate=100 Hz
Data Rate=400 Hz
Data Rate=1000 Hz
h3lis200dl.HPCF8
0b00
1
2
8
20
h3lis200dl.HPCF16
0b01
0.5
1
4
10
h3lis200dl.HPCF32
0b10
0.25
0.50
2
5
h3lis200dl.HPCF64
0b11
0.125
0.25
1
2.5
- property high_pass_filter_mode : str¶
Sensor high_pass_filter_mode used to configure the high-pass filter cutoff frequency ft which is given by:
\[f_{t}= \frac{f_{s}}{6*HP_{c}}\]Mode
Value
h3lis200dl.FILTER_NORMAL_MODE
0b00
h3lis200dl.FILTER_SIGNAL_FILTERING
0b01
- property interrupt1_configuration¶
interrupt 1 configuration :return: interrupt 1 configuration
- property interrupt1_duration¶
interrupt 1 duration set the minimum duration of the interrupt 1 event to be recognized. Duration steps and maximum values depend on the ODR chosen
- Returns:¶
interrupt 1 duration
- property interrupt1_latched¶
Latch interrupt request on the INT1_SRC register, with the INT1_SRC register cleared by reading the INT1_SRC register. Default value: 0. (0: interrupt request not latched; 1: interrupt request latched)
- property interrupt1_source_register¶
interrupt 1 source register. Gives Interrupt 1 Information
- property interrupt1_threshold¶
interrupt 1 threshold :return: threshold
- property interrupt2_configuration¶
interrupt 2 configuration :return: interrupt 2 configuration
- property interrupt2_duration¶
interrupt 2 duration set the minimum duration of the interrupt 2 event to be recognized. Duration steps and maximum values depend on the ODR chosen
- Returns:¶
interrupt 2 duration
- property interrupt2_latched¶
Latch interrupt request on the INT2_SRC register, with the INT2_SRC register cleared by reading the INT2_SRC register. Default value: 0. (0: interrupt request not latched; 2: interrupt request latched)
- property interrupt2_source_register¶
interrupt 2 source register. Gives Interrupt 2 Information
- property interrupt2_threshold¶
interrupt 2 threshold :return: threshold
- property operation_mode : str¶
Sensor operation_mode allow the user to select between power-down and two operating active modes. The device is in power-down mode when the PD bits are set to “000” (default value after boot). Table shows all the possible power mode configurations and respective output data rates. Output data in the low-power mode are computed with the low-pass filter cutoff frequency defined by the
data_rate
Mode
Value
h3lis200dl.POWER_DOWN
0b000
h3lis200dl.NORMAL_MODE
0b001
h3lis200dl.LOW_POWER_ODR0_5
0b010
h3lis200dl.LOW_POWER_ODR1
0b011
h3lis200dl.LOW_POWER_ODR2
0b100
h3lis200dl.LOW_POWER_ODR5
0b101
h3lis200dl.LOW_POWER_ODR10
0b110
- property x_enabled : str¶
Sensor x_enabled In order to optimize further power consumption of the h3lis200dl, data evaluation of individual axes can be deactivated. Per default, all three axes are active.
Mode
Value
h3lis200dl.X_DISABLED
0b0
h3lis200dl.X_ENABLED
0b1