The SparkFun IMU Breakout ICM-20948 is a versatile and powerful inertial measurement unit (IMU) breakout board that features the ICM-20948 chip. This IMU combines a 3-axis gyroscope, 3-axis accelerometer, and 3-axis magnetometer into one compact package, making it ideal for applications such as drone flight control, motion tracking, and navigation systems.
Pin Number | Pin Name | Description |
---|---|---|
1 | VDD | Power supply (1.71V to 3.6V) |
2 | GND | Ground |
3 | SDA | I2C Data Line / SPI Serial Data In (SDI) |
4 | SCL | I2C Clock Line / SPI Serial Clock (SCK) |
5 | NCS | SPI Chip Select (Active Low) |
6 | AUX_DA | Auxiliary I2C Data Line |
7 | AUX_CL | Auxiliary I2C Clock Line |
8 | FSYNC | Frame Synchronization (Active Low) |
9 | INT | Interrupt (Active Low) |
Q: Can I use multiple ICM-20948 IMUs on the same I2C bus? A: Yes, the ICM-20948 has an I2C address selection pin that allows for multiple devices on the same bus.
Q: How do I calibrate the magnetometer? A: Calibration typically involves rotating the IMU in various orientations and using software to compute the calibration parameters.
Q: What is the default I2C address of the ICM-20948? A: The default I2C address is 0x69, which can be changed to 0x68 when the AD0 pin is grounded.
Below is a simple example of how to initialize the ICM-20948 using the I2C protocol with an Arduino UNO. This code assumes the use of a library that handles the low-level communication and sensor fusion.
#include <Wire.h>
#include <SparkFun_ICM-20948_IMU.h>
ICM_20948_I2C myIMU; // Create an ICM-20948 object
void setup() {
Wire.begin();
Serial.begin(115200);
// Initialize the IMU
if (myIMU.begin() != ICM_20948_Stat_Ok) {
Serial.println("ICM-20948 initialization failed");
while (1);
}
Serial.println("ICM-20948 initialization successful");
}
void loop() {
// Check if new data is available
if (myIMU.dataReady()) {
myIMU.getAGMT(); // Get accelerometer, gyroscope, magnetometer, and temperature data
// Print the accelerometer values
Serial.print("Accel X: ");
Serial.print(myIMU.accX());
Serial.print(" Y: ");
Serial.print(myIMU.accY());
Serial.print(" Z: ");
Serial.println(myIMU.accZ());
// Add similar statements to print gyroscope and magnetometer data
}
delay(100); // Adjust the delay as needed
}
Note: This example assumes the existence of a library named SparkFun_ICM-20948_IMU.h
which provides the necessary functions to interact with the ICM-20948. You will need to install the appropriate library through the Arduino Library Manager before compiling this code.