adafruit_lis331
A library for the ST LIS331 family of high-g 3-axis accelerometers
Author(s): Bryan Siepert
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
Base class for the LIS331 family of 3-axis accelerometers. Cannot be instantiated directly
- param ~busio.I2C i2c_bus:
The I2C bus the LIS331 is connected to.
- param address:
The I2C device address. Defaults to
0x18
The frequency above which signals will be filtered out
The reference value to offset measurements when using the High-pass filter. To use, use_reference
must be set to true when enabling the high-pass filter. The value is a signed 8-bit number from -128 to 127. The value of each increment of 1 depends on the currently set measurement range and is approximate:
Range
Incremental value (LSB value)
LIS331HHRange.RANGE_6G
or H3LIS331Range.RANGE_100G
~16mg
LIS331HHRange.RANGE_12G
or H3LIS331Range.RANGE_200G
~31mg
LIS331HHRange.RANGE_24G
or H3LIS331Range.RANGE_400G
~63mg
When the high-pass filter is enabled with use_reference=False
, calling zero_hpf()
will set all measurements to zero immediately, avoiding the normal settling time seen when using the high-pass filter without a hpf_reference()
Enable or disable the high-pass filter.
enabled – Enable or disable the filter. Default is True
to enable
cutoff (RateDivisor) – A RateDivisor
to set the high-pass cutoff frequency. Default is RateDivisor.ODR_DIV_50
. See RateDivisor
for more information
use_reference – Determines if the filtered measurements are offset by a reference value. Default is false.
See section 4 of the LIS331DLH application note for more information LIS331DLH application note for more information
Select the rate at which the accelerometer takes measurements. Must be a Rate
The Mode
power mode that the sensor is set to, as determined by the current data_rate
. To set the mode, use data_rate
and the appropriate Rate
Adjusts the range of values that the sensor can measure, Note that larger ranges will be less accurate. Must be a H3LIS331Range
or LIS331HHRange
The x, y, z acceleration values returned in a 3-tuple and are in \(m / s ^ 2\).
Driver for the LIS331HH 3-axis high-g accelerometer.
i2c_bus (I2C) – The I2C bus the LIS331 is connected to.
address – The I2C device address. Defaults to 0x18
Quickstart: Importing and using the device
Here is an example of using the
LIS331
class. First you will need to import the libraries to use the sensorimport board import adafruit_lis331Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA lis = adafruit_lis331.LIS331HH(i2c)Now you have access to the
acceleration
attributeacceleration = lis.acceleration
Driver for the H3LIS331 3-axis high-g accelerometer.
i2c_bus (I2C) – The I2C bus the LIS331 is connected to.
address – The I2C slave address of the sensor. Defaults to 0x18
Quickstart: Importing and using the device
Here is an example of using the
LIS331
class. First you will need to import the libraries to use the sensorimport board import adafruit_lis331Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA lis = adafruit_lis331.H3LIS331(i2c)Now you have access to the
acceleration
attributeacceleration = lis.acceleration
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4