adafruit_icm20x
¶
Library for the ST ICM20X Motion Sensor Family
 Author(s): Bryan Siepert
Implementation Notes¶
Hardware:
 Adafruit’s ICM20649 Breakout: https://adafruit.com/product/4464
 Adafruit’s ICM20948 Breakout: https://adafruit.com/product/4554
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_icm20x.
CV
¶ struct helper

classmethod
add_values
(value_tuples)¶ Add CV values to the class

classmethod
is_valid
(value)¶ Validate that a given value is a member

classmethod

class
adafruit_icm20x.
AccelRange
¶ Options for
ICM20X.accelerometer_range

class
adafruit_icm20x.
GyroRange
¶ Options for
ICM20X.gyro_data_range

class
adafruit_icm20x.
GyroDLPFFreq
¶ Options for
ICM20X.gyro_dlpf_cutoff

class
adafruit_icm20x.
AccelDLPFFreq
¶ Options for
ICM20X.accel_dlpf_cutoff

class
adafruit_icm20x.
ICM20X
(i2c_bus, address)¶ Library for the ST ICM20X WideRange 6DoF Accelerometer and Gyro Family
Parameters: 
reset
()¶ Resets the internal registers and restores the default settings

acceleration
¶ The x, y, z acceleration values returned in a 3tuple and are in \(m / s ^ 2.\)

gyro
¶ The x, y, z angular velocity values returned in a 3tuple and are in \(degrees / second\)

accelerometer_range
¶ Adjusts the range of values that the sensor can measure, from +/ 4G to +/30G 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 500 Degrees/second to 4000 degrees/s. Note that larger ranges will be less accurate. Must be a
GyroRange

accelerometer_data_rate_divisor
¶ The divisor for the rate at which accelerometer measurements are taken in Hz
Note
The data rates are set indirectly by setting a rate divisor according to the following formula:
\[\text{accelerometer_data_rate} = \frac{1125}{1 + divisor}\]This function sets the raw rate divisor.

gyro_data_rate_divisor
¶ The divisor for the rate at which gyro measurements are taken in Hz
Note
The data rates are set indirectly by setting a rate divisor according to the following formula:
\[\text{gyro_data_rate} = \frac{1100}{1 + divisor}\]This function sets the raw rate divisor.

accelerometer_data_rate
¶ The rate at which accelerometer measurements are taken in Hz
Note
The data rates are set indirectly by setting a rate divisor according to the following formula:
\[\text{accelerometer_data_rate} = \frac{1125}{1 + divisor}\]This function does the math to find the divisor from a given rate but it will not be exactly as specified.

gyro_data_rate
¶ The rate at which gyro measurements are taken in Hz
Note
The data rates are set indirectly by setting a rate divisor according to the following formula:
\[\text{gyro_data_rate } = \frac{1100}{1 + divisor}\]This function does the math to find the divisor from a given rate but it will not be exactly as specified.

accel_dlpf_cutoff
¶ The cutoff frequency for the accelerometer’s digital low pass filter. Signals above the given frequency will be filtered out. Must be an
AccelDLPFCutoff
. Use AccelDLPFCutoff.DISABLED to disable the filterNote
Readings immediately following setting a cutoff frequency will be inaccurate due to the filter “warming up”

gyro_dlpf_cutoff
¶ The cutoff frequency for the gyro’s digital low pass filter. Signals above the given frequency will be filtered out. Must be a
GyroDLPFFreq
. Use GyroDLPFCutoff.DISABLED to disable the filterNote
Readings immediately following setting a cutoff frequency will be inaccurate due to the filter “warming up”


class
adafruit_icm20x.
ICM20649
(i2c_bus, address=104)¶ Library for the ST ICM20649 WideRange 6DoF Accelerometer and Gyro.
Parameters: Quickstart: Importing and using the ICM20649 temperature sensor
Here is an example of using the
ICM2020649
class. First you will need to import the libraries to use the sensorimport board import adafruit_icm20x
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA icm = adafruit_icm20x.ICM20649(i2c)
Now you have access to the acceleration using
acceleration
attribute and the gyro information using thegyro
attribute.acceleration = icm.acceleration gyro = icm.gyro

class
adafruit_icm20x.
MagDataRate
¶ Options for
ICM20948.magnetometer_data_rate

class
adafruit_icm20x.
ICM20948
(i2c_bus, address=105)¶ Library for the ST ICM20948 WideRange 6DoF Accelerometer and Gyro.
Parameters: Quickstart: Importing and using the ICM20948 temperature sensor
Here is an example of using the
ICM20948
class. First you will need to import the libraries to use the sensorimport board import adafruit_icm20x
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA icm = adafruit_icm20x.ICM20948(i2c)
Now you have access to the acceleration using
acceleration
attribute, the gyro information using thegyro
attribute and the magnetic information using themagnetic
attributeacceleration = icm.acceleration gyro = icm.gyro magnetic = icm.magnetic

magnetic
¶ The current magnetic field strengths onthe X, Y, and Z axes in uT (microteslas)

magnetometer_data_rate
¶ The rate at which the magnetometer takes measurements to update its output registers
