

The SparkFun IMU Breakout - MPU-9250 (Manufacturer Part ID: SEN-13762) is a compact and versatile inertial measurement unit (IMU) designed for motion tracking and orientation detection. It integrates a 3-axis accelerometer, 3-axis gyroscope, and 3-axis magnetometer into a single package, making it ideal for applications requiring precise motion sensing and spatial awareness.








The following table outlines the key technical details of the MPU-9250:
| Parameter | Value |
|---|---|
| Supply Voltage | 2.4V to 3.6V (3.3V recommended) |
| Communication Interface | I2C (up to 400kHz) and SPI (up to 1MHz) |
| Accelerometer Range | ±2g, ±4g, ±8g, ±16g (configurable) |
| Gyroscope Range | ±250°/s, ±500°/s, ±1000°/s, ±2000°/s |
| Magnetometer Range | ±4800µT |
| Operating Temperature | -40°C to +85°C |
| Dimensions | 0.8" x 0.8" (20.3mm x 20.3mm) |
The MPU-9250 breakout board has the following pin layout:
| Pin | Name | Description |
|---|---|---|
| 1 | GND | Ground |
| 2 | VCC | Power supply (3.3V recommended) |
| 3 | SDA | I2C data line |
| 4 | SCL | I2C clock line |
| 5 | CS | Chip select for SPI communication |
| 6 | SDO | SPI data output |
| 7 | INT | Interrupt pin for motion detection |
| 8 | NCS | Not connected (optional for SPI configuration) |
To use the MPU-9250 with an Arduino UNO, follow these steps:
Wiring:
Install Required Libraries:
Example Code: Use the following example code to read accelerometer, gyroscope, and magnetometer data:
#include <Wire.h>
#include <SparkFunMPU9250-DMP.h> // Include the SparkFun MPU-9250 library
MPU9250_DMP imu; // Create an instance of the MPU-9250 class
void setup() {
Serial.begin(115200); // Initialize serial communication
Wire.begin(); // Initialize I2C communication
// Initialize the MPU-9250
if (imu.begin() != INV_SUCCESS) {
Serial.println("Failed to initialize MPU-9250!");
while (1); // Halt the program if initialization fails
}
Serial.println("MPU-9250 initialized successfully!");
}
void loop() {
if (imu.dataReady()) { // Check if new data is available
imu.update(); // Update sensor readings
// Print accelerometer data
Serial.print("Accel (g): ");
Serial.print(imu.calcAccel(imu.ax), 2);
Serial.print(", ");
Serial.print(imu.calcAccel(imu.ay), 2);
Serial.print(", ");
Serial.println(imu.calcAccel(imu.az), 2);
// Print gyroscope data
Serial.print("Gyro (°/s): ");
Serial.print(imu.calcGyro(imu.gx), 2);
Serial.print(", ");
Serial.print(imu.calcGyro(imu.gy), 2);
Serial.print(", ");
Serial.println(imu.calcGyro(imu.gz), 2);
// Print magnetometer data
Serial.print("Mag (µT): ");
Serial.print(imu.calcMag(imu.mx), 2);
Serial.print(", ");
Serial.print(imu.calcMag(imu.my), 2);
Serial.print(", ");
Serial.println(imu.calcMag(imu.mz), 2);
delay(100); // Delay for readability
}
}
No Data Output:
Inaccurate Readings:
Library Errors:
Q: Can the MPU-9250 be used with a 5V microcontroller?
A: Yes, but you must use a logic level shifter to convert the 5V signals to 3.3V for the MPU-9250.
Q: How do I switch between I2C and SPI communication?
A: By default, the MPU-9250 uses I2C. To use SPI, connect the CS pin to GND and configure the SPI pins accordingly in your code.
Q: What is the maximum sampling rate of the MPU-9250?
A: The maximum sampling rate is 1kHz for the accelerometer and gyroscope, and 100Hz for the magnetometer.