ICM20948 9DOF IMU on Arduino Uno

Introduction

In previous posts I looked at using the GY-91 as a sensor board for OpenPlotter (Ref.1). This board included an MPU9250 9DOF IMU with a BMP280 temperature/pressure sensor. The MPU9250 stopped being manufactured circa 2018 and the ICM20948 is the suggested replacement. In this post I look at using an ICM20948 proto board with Arduino Uno (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) . The proto board contains a voltage regulator for 3.3VDC/5VDC operation.

Arduino Uno to ICM20948 Connection

Fig.1 ICM20948 Proto Board Ref.2
Fig.2 Arduino Uno to ICM20948 Proto Board Wiring Schematic
Fig.3 ICM20948 Axes Orientation for Gyro/Acc & Magnetommeter (Ref.3)

Figure 1 shows the ICM20948 protoboard with the I2C connections on the LHS (Ref.2). Figure 2 shows the I2C wiring with an Arduino Uno. 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.

Arduino Libraries

FIg.5 i2c_scanner.ino to Detect I2C Address = $69

Figure 4 shows two existing libraries that can be used with the Arduino to give quick access to the ICM20948. They can be easily added using the Library Manager (also install dependencies). Figure 5 shows sketch i2c_scanner.ino that can be used to detect the presence and address of the ICM20948 (Files/Examples/ArduinoUno/Wire/). Default address is $69, it can be changed to $68 by shorting the SDO/ADR jumper on the rear of the pcb.

Arduino Uno Example1_Basics.ino

Fig.6 Sparkfun Library Example1_Basics.ino
Fig.7 Sketch with Acc/Gyro/Temp Print Commented Out
Fig.8 Sparkfun Magnetometer Serial Plot
Fig.9 Comparison of Sparkfun & Adafruit ICM20948 Outputs

A good place to start is with the Sparkfun 9DoF Example1_Basics.ino as shown in Figure 6. The sketch prints out all 10 variables: Acc_xyz, Gyro_xyz, Mag_xyz & Temp. The variables are all on one line, so to simplify you can comment out the print statements of the variables you don’t want to see as in Figure 7. This also makes the Serial Plotter easier to read as in Figure 8.

Figure 9 shows the different acceleration units used in Sparkfun vs. Adafruit. Sparkfun uses mg, where mg means 1/1000 milli of the acceleration of gravity (G = 9.81m/sec). Note that Acc_z is 01020mg which is approx G (axis Z is perpendicular to ground in this case). Adafruit gives Acc_z as 10.07m/sec^2 which is approx G.

Since I covered using a magnetometer in a earlier post (Ref.4), I will demonstrate the following in the YouTube video in Figure 10:

*Acc_x, Acc_y, Acc_z
*Gyro_x, Gyro_y, Gyro_z

Fig.10 YouTube Video ICM20948 9DOF IMU on Arduino Uno


Please send your comments, questions and suggestions to:
contact:

YouTube Channel
YouTube Channel

References

#1. – “OpenPlotter4 on RPi4 -AIS/GNSS/Sensors”
https://jeremyclark.ca/wp/telecom/openplotter4-on-rpi4-ais-gnss-sensors/

#2. – “Adafruit TDK/ICM20948 Protoboard”
https://www.adafruit.com/product/4554

#3. – “ISM20948 Data Sheet”
https://invensense.tdk.com/download-pdf/icm-20948-datasheet/

#4. – “Magnetic Anomaly Detection”
https://jeremyclark.ca/wp/nav/magnetic-anomaly-detection/

By Jeremy Clark

Jeremy Clark is a Senior Telecommunications Engineer and Advanced Amateur Radio Operator VE3PKC. He is the author of E-Books on Telecommunications, Navigation & Electronics.