adafruit_lsm6ds
CircuitPython helper library for the LSM6DS family of motion sensors from ST
Author(s): Bryan Siepert, Jose David M.
Implementation Notes
Hardware:
Adafruit LSM6DSOX 6 DoF Accelerometer and Gyroscope (Product ID: 4438)
Adafruit ISM330DHCX - 6 DoF IMU - Accelerometer and Gyroscope (Product ID: 4502)
Adafruit LSM6DSO32 6-DoF Accelerometer and Gyroscope (Product ID: 4692)
Adafruit LSM6DS33 6-DoF Accel + Gyro IMU (Product ID: 4480)
Adafruit ISM330DHCX + LIS3MDL FeatherWing - High Precision 9-DoF IMU (Product ID: 4569)
Adafruit LSM6DSOX + LIS3MDL - Precision 9 DoF IMU (Product ID: 4517)
Adafruit LSM6DS33 + LIS3MDL - 9 DoF IMU with Accel / Gyro / Mag (Product ID: 4485)
Adafruit LSM6DSOX + LIS3MDL FeatherWing - Precision 9-DoF IMU (Product ID: 4565)
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
- class adafruit_lsm6ds.LSM6DS(i2c_bus: I2C, address: int = micropython.const, ucf: str = None)
Driver for the LSM6DSOX 6-axis accelerometer and gyroscope.
- Parameters:
- pedometer_steps
The number of steps detected by the pedometer. You must enable with
pedometer_enable
before calling. Usepedometer_reset
to reset the number of steps
- property acceleration: Tuple[float, float, float]
The x, y, z acceleration values returned in a 3-tuple and are in m / s ^ 2.
- property gyro: Tuple[float, float, float]
The x, y, z angular velocity values returned in a 3-tuple and are in radians / second
- property accelerometer_range: int
Adjusts the range of values that the sensor can measure, from +/- 2G to +/-16G Note that larger ranges will be less accurate. Must be an
AccelRange
- property gyro_range: int
Adjusts the range of values that the sensor can measure, from 125 Degrees/s to 2000 degrees/s. Note that larger ranges will be less accurate. Must be a
GyroRange
.
- property accelerometer_data_rate: int
Select the rate at which the accelerometer takes measurements. Must be a
Rate
- load_mlc(ucf)
Load MLC configuration file into sensor
- read_mlc_output()
Read MLC results
This module provides the adafruit_lsm6ds.ism330dhcx
subclass of LSM6DS sensors
- class adafruit_lsm6ds.ism330dhcx.ISM330DHCX(i2c_bus: I2C, address: int = micropython.const)
Driver for the ISM330DHCX 6-axis accelerometer and gyroscope.
- Parameters:
Quickstart: Importing and using the device
Here is an example of using the
ISM330DHCX
class. First you will need to import the libraries to use the sensorimport board from adafruit_lsm6ds.ism330dhcx import ISM330DHCX
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = ISM330DHCX(i2c)
Now you have access to the
acceleration
andgyro
: attributesacc_x, acc_y, acc_z = sensor.acceleration gyro_x, gyro_z, gyro_z = sensor.gyro
This module provides the adafruit_lsm6ds.lsm6ds33
subclass of LSM6DS sensors
- class adafruit_lsm6ds.lsm6ds33.LSM6DS33(i2c_bus: I2C, address: int = micropython.const, ucf: str = None)
Driver for the LSM6DS33 6-axis accelerometer and gyroscope.
- Parameters:
Quickstart: Importing and using the device
Here is an example of using the
LSM6DS33
class. First you will need to import the libraries to use the sensorimport board from adafruit_lsm6ds.lsm6ds33 import LSM6DS33
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = LSM6DS33(i2c)
Now you have access to the
acceleration
andgyro
: attributesacc_x, acc_y, acc_z = sensor.acceleration gyro_x, gyro_z, gyro_z = sensor.gyro
This module provides the adafruit_lsm6ds.lsm6dso32
subclass of LSM6DS sensors
- class adafruit_lsm6ds.lsm6dso32.LSM6DSO32(i2c_bus: I2C, address: int = micropython.const)
Driver for the LSM6DSO32 6-axis accelerometer and gyroscope.
- Parameters:
i2c_bus (I2C) – The I2C bus the LSM6DSO32 is connected to.
address – The I2C device address. Defaults to
0x6A
Quickstart: Importing and using the device
Here is an example of using the
LSM6DSO32
class. First you will need to import the libraries to use the sensorimport board from adafruit_lsm6ds.lsm6dso32 import LSM6DSO32
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = LSM6DSO32(i2c)
Now you have access to the
acceleration
andgyro
: attributesacc_x, acc_y, acc_z = sensor.acceleration gyro_x, gyro_z, gyro_z = sensor.gyro
This module provides the adafruit_lsm6ds.lsm6dsox
subclass of LSM6DS sensors
- class adafruit_lsm6ds.lsm6dsox.LSM6DSOX(i2c_bus: I2C, address: int = micropython.const, ucf: str = None)
Driver for the LSM6DSOX 6-axis accelerometer and gyroscope.
- Parameters:
Quickstart: Importing and using the device
Here is an example of using the
LSM6DSOX
class. First you will need to import the libraries to use the sensorimport board from adafruit_lsm6ds.lsm6dsox import LSM6DSOX
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = LSM6DSOX(i2c)
Now you have access to the
acceleration
andgyro
: attributesacc_x, acc_y, acc_z = sensor.acceleration gyro_x, gyro_z, gyro_z = sensor.gyro