An Inertial Measurement Unit (IMU) is a sensor device that measures and reports motion, orientation, and gravitational forces. IMUs combine multiple sensors to provide comprehensive motion tracking capabilities, making them essential for applications such as robotics, drone stabilization, motion sensing, orientation tracking, and navigation systems. Modern IMUs typically integrate a 3-axis accelerometer (measuring linear acceleration), a 3-axis gyroscope (measuring angular velocity), and often a 3-axis magnetometer (measuring magnetic field) to create a complete 9-axis motion tracking solution.Documentation Index
Fetch the complete documentation index at: https://docs.t3gemstone.org/llms.txt
Use this file to discover all available pages before exploring further.
1. ICM-20948 IMU
Your board is equipped with the InvenSense ICM-20948, a high-performance 9-axis motion tracking device. The sensor combines a 3-axis gyroscope, 3-axis accelerometer, and 3-axis magnetometer in a single package.1.1. Key Features
- 3-Axis Gyroscope with programmable full-scale ranges: ±250, ±500, ±1000, ±2000 DPS
- 3-Axis Accelerometer with programmable full-scale ranges: ±2g, ±4g, ±8g, ±16g
- 3-Axis Magnetometer (AK09916) for compass functionality
- Digital-output temperature sensor for temperature compensation
- User-programmable interrupts for motion detection and data ready signals
- Low-power modes for battery-powered applications
- Digital Low Pass Filter (DLPF) for noise reduction
1.2. Hardware Connection
The ICM-20948 on your board is connected via SPI interface at/dev/spidev0.3.
2. Example Application
imu project included in t3gemstone/examples
repository provides a complete C library and test application to interact with the IMU sensor.
The library handles all low-level communication and provides an API for reading sensor data.
2.1. Test Application
The test application performs the following sequence:- Initialization - Opens the SPI device at
/dev/spidev0.3and initializes the sensor - Configuration - Sets accelerometer to ±8g and gyroscope to ±2000 DPS range
- Information - Prints configuration values and temperature at start
- Continuous monitoring - Reads accelerometer and gyroscope data every 10ms and prints calculated angles
- Angle calculation - Applies Kalman filtering to compute orientation angles
- Auto-recovery - Monitors sensor connectivity and reconfigures if needed
2.2. API Reference
Theicm20948 library provides:
- Bus initialization for both I2C and SPI interfaces
- Sensor configuration with customizable full-scale ranges
- Raw data reading for accelerometer, gyroscope, and temperature
- Angle calculation using Kalman filtering for smooth orientation tracking
- Auto-recovery with online status checking and reconfiguration
- Flexible data access through a structured data interface
2.2.1. Initialization
2.2.2. Data Reading
2.2.3. Configuration
2.2.4. Utility
2.2.5. Data Structure
The sensor data is accessed through theicm20948_data_t structure:

