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, address=<sphinx.ext.autodoc.importer._MockObject object>)¶ 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
-
reset
()¶ Resets the sensor’s configuration into an initial state
-
acceleration
¶ The x, y, z acceleration values returned in a 3-tuple and are in m / s ^ 2.
-
gyro
¶ The x, y, z angular velocity values returned in a 3-tuple and are in radians / second
-
accelerometer_range
¶ 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
-
gyro_range
¶ 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
.
-
accelerometer_data_rate
¶ Select the rate at which the accelerometer takes measurements. Must be a
Rate
-
gyro_data_rate
¶ Select the rate at which the gyro takes measurements. Must be a
Rate
-
pedometer_enable
¶ Whether the pedometer function on the accelerometer is enabled
-
high_pass_filter
¶ The high pass filter applied to accelerometer data
-
temperature
¶ Temperature in Celsius
-
This module provides the adafruit_lsm6ds.ism330dhcx
subclass of LSM6DS sensors¶
-
class
adafruit_lsm6ds.ism330dhcx.
ISM330DHCX
(i2c_bus, address=<sphinx.ext.autodoc.importer._MockObject object>)¶ 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
-
gyro_range
¶ Adjusts the range of values that the sensor can measure, from 125 Degrees/s to 4000 degrees/s. Note that larger ranges will be less accurate. Must be a
GyroRange
. 4000 DPS is only available for the ISM330DHCX
-
This module provides the adafruit_lsm6ds.lsm6ds33
subclass of LSM6DS sensors¶
-
class
adafruit_lsm6ds.lsm6ds33.
LSM6DS33
(i2c_bus, address=<sphinx.ext.autodoc.importer._MockObject object>)¶ 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, address=<sphinx.ext.autodoc.importer._MockObject object>)¶ 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, address=<sphinx.ext.autodoc.importer._MockObject object>)¶ 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