qmi8658c

CircuitPython helper library for the QMI8658C 6-DoF Accelerometer and Gyroscope

  • Author(s): Taiki Komoda

Implementation Notes

Software and Dependencies:

class qmi8658c.AccRange

Allowed values for accelerometer_range.

  • AccRange.RANGE_2_G

  • AccRange.RANGE_4_G

  • AccRange.RANGE_8_G

  • AccRange.RANGE_16_G

class qmi8658c.AccRate

Allowed values for accelerometer_rate. Accelerometer low power(LP) mode must be a gyro disabled.

  • AccRate.RATE_8000_HZ

  • AccRate.RATE_4000_HZ

  • AccRate.RATE_2000_HZ

  • AccRate.RATE_1000_HZ

  • AccRate.RATE_500_HZ

  • AccRate.RATE_250_HZ

  • AccRate.RATE_125_HZ

  • AccRate.RATE_62_HZ

  • AccRate.RATE_31_HZ

  • AccRate.RATE_LP_128_HZ

  • AccRate.RATE_LP_21_HZ

  • AccRate.RATE_LP_11_HZ

  • AccRate.RATE_LP_3_HZ

class qmi8658c.GyroRange

Allowed values for gyro_range.

  • GyroRange.RANGE_16_DPS

  • GyroRange.RANGE_32_DPS

  • GyroRange.RANGE_64_DPS

  • GyroRange.RANGE_128_DPS

  • GyroRange.RANGE_256_DPS

  • GyroRange.RANGE_512_DPS

  • GyroRange.RANGE_1024_DPS

  • GyroRange.RANGE_2048_DPS

class qmi8658c.GyroRate

Allowed values for gyro_rate.

  • GyroRate.RATE_G_8000_HZ

  • GyroRate.RATE_G_4000_HZ

  • GyroRate.RATE_G_2000_HZ

  • GyroRate.RATE_G_1000_HZ

  • GyroRate.RATE_G_500_HZ

  • GyroRate.RATE_G_250_HZ

  • GyroRate.RATE_G_125_HZ

  • GyroRate.RATE_G_62_HZ

  • GyroRate.RATE_G_31_HZ

class qmi8658c.QMI8658C(i2c_bus: I2C, address=107)

Driver for the QMI8658C 6-DoF accelerometer and gyroscope.

Parameters:
  • i2c_bus (I2C) – The I2C bus the device is connected to

  • address (int) – The I2C device address. Defaults to 0x68

Quickstart: Importing and using the device

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

import board
import qmi8658c

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 = qmi8658c.QMI8658C(i2c)

Now you have access to the acceleration, gyro and temperature attributes

acc_x, acc_y, acc_z = sensor.acceleration
gyro_x, gyro_y, gyro_z = sensor.gyro
temperature = sensor.temperature
property acceleration: Tuple[float, float, float]

Acceleration X, Y, and Z axis data in \(m/s^2\)

property accelerometer_enable: int

Enable / disable accelerometer

property accelerometer_range: int

The measurement range of all accelerometer axes. Must be a AccRange

property accelerometer_rate: int

The measurement rate of all accelerometer axes. Must be a AccRate

property gyro: Tuple[float, float, float]

Gyroscope X, Y, and Z axis data in \(rad/s\)

property gyro_enable: int

Enable / disable gyroscope

property gyro_range: int

The measurement range of all gyroscope axes. Must be a GyroRange

property gyro_rate: int

The measurement rate of all gyroscope axes. Must be a GyroRate

property raw_acc_gyro: Tuple[int, int, int, int, int, int]

Raw data extraction

property raw_acc_gyro_bytes: Tuple[int, int, int, int, int, int, int, int, int, int, int, int]

Raw bytes extraction

property temperature: float

Chip temperature

property timestamp: int

Timestamp from boot up