Code Monkey home page Code Monkey logo

qwiic_9dof_imu_icm20948_py's Introduction

Qwiic_9DoF_IMU_ICM20948_Py

follow on Twitter

SparkFun 9DoF IMU Breakout - ICM-20948 (Qwiic)

Python module for the qwiic ICM-20948 sensor, which is included on the SparkFun 9DoF IMU Breakout - ICM-20948 (Qwiic)

This python package is a port of the existing SparkFun ICM-20948 Arduino Library

This package can be used in conjunction with the overall SparkFun qwiic Python Package

New to qwiic? Take a look at the entire SparkFun qwiic ecosystem.

Contents

Supported Platforms

The qwiic ICM20948 Python package current supports the following platforms:

Dependencies

This driver package depends on the qwiic I2C driver: Qwiic_I2C_Py

Documentation

The SparkFun qwiic ICM20948 module documentation is hosted at ReadTheDocs

Installation

PyPi Installation

This repository is hosted on PyPi as the sparkfun-qwiic-icm20948 package. On systems that support PyPi installation via pip, this library is installed using the following commands

For all users (note: the user must have sudo privileges):

sudo pip install sparkfun-qwiic-icm20948

For the current user:

pip install sparkfun-qwiic-icm20948

Local Installation

To install, make sure the setuptools package is installed on the system.

Direct installation at the command line:

python setup.py install

To build a package for use with pip:

python setup.py sdist

A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.

cd dist
pip install sparkfun_qwiic_icm20948-<version>.tar.gz
  

Example Use

See the examples directory for more detailed use examples.

from __future__ import print_function
import qwiic_icm20948
import time
import sys

def runExample():

	print("\nSparkFun 9DoF ICM-20948 Sensor  Example 1\n")
	IMU = qwiic_icm20948.QwiicIcm20948()

	if IMU.connected == False:
		print("The Qwiic ICM20948 device isn't connected to the system. Please check your connection", \
			file=sys.stderr)
		return

	IMU.begin()

	while True:
		if IMU.dataReady():
			IMU.getAgmt() # read all axis and temp from sensor, note this also updates all instance variables
			print(\
			 '{: 06d}'.format(IMU.axRaw)\
			, '\t', '{: 06d}'.format(IMU.ayRaw)\
			, '\t', '{: 06d}'.format(IMU.azRaw)\
			, '\t', '{: 06d}'.format(IMU.gxRaw)\
			, '\t', '{: 06d}'.format(IMU.gyRaw)\
			, '\t', '{: 06d}'.format(IMU.gzRaw)\
			, '\t', '{: 06d}'.format(IMU.mxRaw)\
			, '\t', '{: 06d}'.format(IMU.myRaw)\
			, '\t', '{: 06d}'.format(IMU.mzRaw)\
			)
			time.sleep(0.03)
		else:
			print("Waiting for data")
			time.sleep(0.5)

if __name__ == '__main__':
	try:
		runExample()
	except (KeyboardInterrupt, SystemExit) as exErr:
		print("\nEnding Example 1")
		sys.exit(0)

SparkFun - Start Something

qwiic_9dof_imu_icm20948_py's People

Contributors

lewispg228 avatar santaimpersonator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qwiic_9dof_imu_icm20948_py's Issues

DMP

Hi,
I couldnt find dmp part of the code in the repo.
Whats the plan is it coming soon or can someone please direct me to an existing python code.
Thanks

Units of measurement is not documented

Hello,

I'm unable to find documentation indicating what units values are reported in. I tried finding the values by making some measurements, and although I'm definitely getting values, they don't line up with anything I can make sense of: for example, I'm expecting acceleration due to gravity to be either ~9.8m/s^2 or ~32.2ft/s^2, but I'm actually getting ~1600. I understand I may need to do some calibrating, but without knowing what units are being used, I'm not sure where to go with that. I believe that documenting what units are being used, and potentially what steps can be taken to calibrate the device in custom code, would resolve this issue.

Wrong values for accelerometer configuration

Subject of the issue

Wrong values for accelerometer configuration

Your workbench

  • Raspberry pi 4
  • I2C. IMU address is 0x68
  • Via i2c connection on Raspberry pi 4

Steps to reproduce

Using the following code :

from __future__ import print_function
import qwiic_icm20948
import time
import sys


if __name__ == "__main__":

    IMU = qwiic_icm20948.QwiicIcm20948(address=0x68)
    IMU.setBank(2)
    IMU._i2c.writeByte(IMU.address, IMU.AGB2_REG_ACCEL_CONFIG_1, 0x23)	
    register = IMU._i2c.readByte(IMU.address, IMU.AGB2_REG_ACCEL_CONFIG_1)
    print(register)

Expected behaviour

The return value should be 0x23

Actual behaviour

The return value is 0x01

image

Error connecting to Device: 69, [Errno 6] No such device or address

Hi,
I am running the example in Renesas RZV2L SBC.
When i run i2cdetect -y 3 , I see the device listed in the adress 68.

P.S : The Renesas RZV2L board is booted with yocto image. I am right now running the example inside a docker container of ubuntu focal. I had tested the same code in a docker container in RPi and it works. I get the error when running it in RZV2L SBC.

MicrosoftTeams-image (1)

But when i run the example code, I see the terminal log as :

SparkFun 9DoF ICM-20948 Sensor Example 1 Error connecting to Device: 69, [Errno 6] No such device or address The Qwiic ICM20948 device isn't connected to the system. Please check your connection

More Example

Is there any plan to make more example code for Python just like the Arduino version?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.