MicroPython ICG20660 Driver

icg20660

MicroPython Driver for the TDK ICG20660 Accelerometer/Gyro sensor

  • Author(s): Jose D. Montoya

class micropython_icg20660.icg20660.ICG20660(i2c, address: int = 0x69)[source]

Driver for the ICG20660 Sensor connected over I2C.

Parameters:
i2c : I2C

The I2C bus the ICG20660 is connected to.

address : int

The I2C device address. Defaults to 0x69

Raises:

RuntimeError – if the sensor is not found

Quickstart: Importing and using the device

Here is an example of using the ICG20660 class. First you will need to import the libraries to use the sensor

from machine import Pin, I2C
from micropython_icg20660 import icg20660

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

i2c = I2C(1, sda=Pin(2), scl=Pin(3))
icg20660 = icg20660.ICG20660(i2c)

Now you have access to the attributes

accx, accy, accz = icg20660.acceleration
property acceleration : tuple[float, float, float]

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

Returns:

Acceleration Values

property acceleration_range : str

Sensor acceleration_range

Mode

Value

icg20660.RANGE_2G

0b00

icg20660.RANGE_4G

0b01

icg20660.RANGE_8G

0b10

icg20660.RANGE_16G

0b11

property data_rate

The rate at which sensor measurements are taken in Hz

property data_rate_divisor

Accepted values are:

* 1
* 3
* 4
* 7
* 9
* 15
* 19
* 31
* 63
* 99
* 127
* 255
property gyro

Gyro Property. The x, y, z angular velocity values returned in a 3-tuple and are in \(degrees / second\)

Returns:

Angular velocity Values

property gyro_dlpf_configuration : str

Sensor gyro_dlpf_configuration. For this to have an effect, gyro_dlpf_mode must be enabled. The gyroscope and temperature sensor will be filtered. For more details please refer to the datasheet.

Mode

Value

icg20660.DLPF_CFG_0

0b000

icg20660.DLPF_CFG_1

0b001

icg20660.DLPF_CFG_2

0b010

icg20660.DLPF_CFG_7

0b111

property gyro_dlpf_mode : str

Sensor gyro_dlpf_mode. Enables gyro DLPF

Mode

Value

icg20660.GYRO_DLPF_DISABLED

0b10

icg20660.GYRO_DLPF_ENABLED

0b00

property gyro_full_scale : str

Sensor gyro_full_scale

Mode

Value

icg20660.FS_125_DPS

0b00

icg20660.FS_250_DPS

0b01

icg20660.FS_500_DPS

0b10