adafruit_lsm6ds

CircuitPython helper library for the LSM6DS family of motion sensors from ST

  • Author(s): Bryan Siepert, Jose David M.

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_lsm6ds.LSM6DS(i2c_bus, address=<sphinx.ext.autodoc.importer._MockObject object>)

Driver for the LSM6DSOX 6-axis accelerometer and gyroscope.

Parameters:
  • i2c_bus (I2C) – The I2C bus the LSM6DSOX is connected to.
  • address (int) – TThe I2C device address. Defaults to 0x6A
pedometer_steps

The number of steps detected by the pedometer. You must enable with pedometer_enable before calling. Use pedometer_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:
  • i2c_bus (I2C) – The I2C bus the device is connected to.
  • address (int) – The I2C device address. Defaults to 0x6A

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 sensor

import board
from adafruit_lsm6ds.ism330dhcx import ISM330DHCX

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = ISM330DHCX(i2c)

Now you have access to the acceleration and gyro: attributes

acc_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:
  • i2c_bus (I2C) – The I2C bus the LSM6DS33 is connected to.
  • address (int) – The I2C device address. Defaults to 0x6A

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 sensor

import board
from adafruit_lsm6ds.lsm6ds33 import LSM6DS33

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = LSM6DS33(i2c)

Now you have access to the acceleration and gyro: attributes

acc_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 sensor

import board
from adafruit_lsm6ds.lsm6dso32 import LSM6DSO32

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = LSM6DSO32(i2c)

Now you have access to the acceleration and gyro: attributes

acc_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:
  • i2c_bus (I2C) – The I2C bus the LSM6DSOX is connected to.
  • address (int) – The I2C device address. Defaults to 0x6A

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 sensor

import board
from adafruit_lsm6ds.lsm6dsox import LSM6DSOX

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = LSM6DSOX(i2c)

Now you have access to the acceleration and gyro: attributes

acc_x, acc_y, acc_z = sensor.acceleration
gyro_x, gyro_z, gyro_z = sensor.gyro