Introduction
In the previous post I looked at using the ICM20948 9DOF IMU with Arduino Uno (Ref.1). In this post I examine the IMU with RaspberryPi4B using Python. In order to test the IMU, I am using a protoboard with on board voltage regulator (Ref.2).
The ICM20948 contains two dies on a 3x3mm package: an Invensense MEMS 3×3 Gyro & 3×3 Accelerometer + Asahi Kasei 3×3 Magnetometer + Temperature Sensor + DMP Digital Motion Processor (Ref.3)
RaspberryPi4B to ICM20948 Connection



Figure 1 shows the ICM20948 protoboard with the I2C connections on the LHS (Ref.2). Figure 2 shows the I2C wiring with a RaspberryPi4B. Note the chip orientation with pin 1 in the south west corner. Figure 3 shows the orientation of the axes for the Gyro+Acc. & Magnetometer (Ref.3). The X & Y marked on the PCB are for the Magnetometer.
Python Docs


Figure 4 shows the File Manager in the RaspberryPi4B desktop. I am using the Adafruit Python Documents as given in Ref.4. I first created a project folder “icm20948” in my home directory/Documents. Then I created a virtual environment “.venv” and installed the Adafruit Python Documents. Using the Thony Editor, I created a Python file using the basic commands listed “icm20948_basics.py”. Figure 5 shows the output of this file when run giving the Acc/Gyro/Mag readings.
Please send your comments, questions and suggestions to:
contact:

References
#1. – “ICM20948 9DOF IMU on Arduino Uno”
https://jeremyclark.ca/wp/nav/icm20948-9dof-imu-on-arduino-uno/
#2. – “SparkFun Sen-15335 ICM20948 Protoboard”
https://www.sparkfun.com/sparkfun-9dof-imu-breakout-icm-20948-qwiic.html
#3. – “ISM20948 Data Sheet”
https://invensense.tdk.com/download-pdf/icm-20948-datasheet/
#4. – “Adafruit Python Docs Installation RaspberryPi”
https://docs.circuitpython.org/projects/icm20x/en/latest/