MicroPython H3LIS200DL Library¶
h3lis200dl¶
Micropython Driver for the ST H3LIS200DL Accelerometer
Author(s): Jose D. Montoya
- class micropython_h3lis200dl.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 micropython_h3lis200dl.h3lis200dl.H3LIS200DL(i2c, address: int =
0x19)[source]¶ Driver for the H3LIS200DL Sensor connected over I2C. The H3LIS200DL is a low-power high-performance 3-axis linear accelerometer
The H3LIS200DL has scales of ±100g/±200g and is capable of measuring accelerations with output data rates from 0.5 Hz to 1 kHz.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
H3LIS200DLclass. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_h3lis200dl import h3lis200dlOnce this is done you can define your
machine.I2Cobject and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) h3lis200dl = h3lis200dl.H3LIS200DL(i2c)Now you have access to the attributes
accx, accy, accz = h3lis200dl.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_50HZ0b00h3lis200dl.RATE_100HZ0b01h3lis200dl.RATE_400HZ0b10h3lis200dl.RATE_1000HZ0b11
- property full_scale_selection : str¶
Sensor full_scale_selection
Mode
Value
h3lis200dl.SCALE_100G0b0h3lis200dl.SCALE_200G0b1
- 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.HPCF80b001
2
8
20
h3lis200dl.HPCF160b010.5
1
4
10
h3lis200dl.HPCF320b100.25
0.50
2
5
h3lis200dl.HPCF640b110.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_MODE0b00h3lis200dl.FILTER_SIGNAL_FILTERING0b01
- 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_rateMode
Value
h3lis200dl.POWER_DOWN0b000h3lis200dl.NORMAL_MODE0b001h3lis200dl.LOW_POWER_ODR0_50b010h3lis200dl.LOW_POWER_ODR10b011h3lis200dl.LOW_POWER_ODR20b100h3lis200dl.LOW_POWER_ODR50b101h3lis200dl.LOW_POWER_ODR100b110
- 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_DISABLED0b0h3lis200dl.X_ENABLED0b1