Component guide · Intermediate · 4 min read
MPU9250 9-Axis IMU

Pinout, Wiring and Code
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The MPU9250 is a 9-axis motion sensor: a 3-axis accelerometer and gyroscope (the MPU6500 core) plus an AK8963 3-axis magnetometer in one package. It talks I2C at address 0x68 or SPI. Use it for tilt, heading and orientation in robots, drones and wearables, and check the WHO_AM_I register first, because many modules sold as MPU9250 carry a different chip.
Key specs at a glance
- Sensors
- 3-axis accelerometer, 3-axis gyroscope, 3-axis magnetometer (AK8963)
- Accelerometer range
- ±2, ±4, ±8 or ±16 g
- Gyroscope range
- ±250 to ±2000 °/s
- Magnetometer
- ±4800 µT, 14 or 16-bit
- Interface
- I2C (0x68, or 0x69 with AD0 high) up to 400 kHz, SPI up to 1 MHz (20 MHz for data reads)
- Supply
- Chip 2.4 to 3.6 V; most modules have a regulator for 3.3 to 5 V
- WHO_AM_I
- 0x71 (an MPU6500 answers 0x70)
What the MPU9250 is
The MPU9250 from InvenSense (now TDK) combines the motion core of the MPU6500 with an AK8963 compass die. The accelerometer measures gravity and movement, the gyroscope measures rotation speed and the magnetometer measures the Earth's magnetic field, so together they can give a heading that does not drift.
The magnetometer sits behind the main chip: in I2C bypass mode it appears as a second device at address 0x0C. The part is no longer made, so some boards sold under this name carry an MPU6500 (no compass) or an MPU9255; reading WHO_AM_I tells you which one you have. For a new design the ICM-20948 is the current 9-axis part.
MPU9250 pinout
The pins on the MPU9250 and what each one does.
| Pin | Function |
|---|---|
| VCC | Supply, 3.3 to 5 V on modules with a regulator |
| GND | Ground |
| SCL / SCLK | I2C clock, or SPI clock |
| SDA / SDI | I2C data, or SPI data in |
| EDA / ECL | Auxiliary I2C bus for an external sensor (leave open) |
| AD0 / SDO | I2C address select (GND 0x68, VCC 0x69), or SPI data out |
| INT | Interrupt output (data ready, motion) |
| NCS | SPI chip select; leave high for I2C |
| FSYNC | Frame sync input; tie to GND if unused |
- VCC
- Supply, 3.3 to 5 V on modules with a regulator
- GND
- Ground
- SCL / SCLK
- I2C clock, or SPI clock
- SDA / SDI
- I2C data, or SPI data in
- EDA / ECL
- Auxiliary I2C bus for an external sensor (leave open)
- AD0 / SDO
- I2C address select (GND 0x68, VCC 0x69), or SPI data out
- INT
- Interrupt output (data ready, motion)
- NCS
- SPI chip select; leave high for I2C
- FSYNC
- Frame sync input; tie to GND if unused
Wiring the MPU9250
Most blue MPU9250 boards have a 3.3 V regulator and pull-up resistors, so they run from the Uno's 5 V pin. The I2C lines are pulled up to 3.3 V, which an Uno reads correctly.
| MPU9250 pin | Arduino Uno | ESP32 |
|---|---|---|
| VCC | 5V (or 3.3V) | 3V3 |
| GND | GND | GND |
| SDA | A4 | GPIO 21 |
| SCL | A5 | GPIO 22 |
| AD0 | GND (address 0x68) | GND (address 0x68) |
| INT | D2 (optional) | GPIO 4 (optional) |
- VCC
- Arduino Uno:
- 5V (or 3.3V)
- ESP32:
- 3V3
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
- SDA
- Arduino Uno:
- A4
- ESP32:
- GPIO 21
- SCL
- Arduino Uno:
- A5
- ESP32:
- GPIO 22
- AD0
- Arduino Uno:
- GND (address 0x68)
- ESP32:
- GND (address 0x68)
- INT
- Arduino Uno:
- D2 (optional)
- ESP32:
- GPIO 4 (optional)
Example code
Lying flat, the Z axis should read about 1.00 g. For heading and fused angles use a library such as MPU9250 by hideakitai or the Bolder Flight MPU9250 library.
#include <Wire.h>
const uint8_t MPU = 0x68;
uint8_t readReg(uint8_t reg) {
Wire.beginTransmission(MPU); Wire.write(reg); Wire.endTransmission(false);
Wire.requestFrom(MPU, (uint8_t)1);
return Wire.read();
}
void setup() {
Serial.begin(115200);
Wire.begin();
Wire.beginTransmission(MPU); Wire.write(0x6B); Wire.write(0); Wire.endTransmission(); // wake up
Serial.print("WHO_AM_I: 0x"); Serial.println(readReg(0x75), HEX); // 0x71 = MPU9250
}
void loop() {
Wire.beginTransmission(MPU); Wire.write(0x3B); Wire.endTransmission(false);
Wire.requestFrom(MPU, (uint8_t)6);
int16_t ax = Wire.read() << 8 | Wire.read();
int16_t ay = Wire.read() << 8 | Wire.read();
int16_t az = Wire.read() << 8 | Wire.read();
// default range is ±2 g: 16384 counts per g
Serial.print(ax / 16384.0); Serial.print(" ");
Serial.print(ay / 16384.0); Serial.print(" ");
Serial.println(az / 16384.0);
delay(200);
}Setup and tuning
run an I2C scanner. 0x68 or 0x69 is the motion core; 0x0C appears only after bypass mode is enabled.
keep the board still for a few seconds at start-up and average the gyro readings to remove the zero offset.
turn the board slowly through every direction (a figure of eight) and record the minimum and maximum of each axis; centre the readings on those values. Recalibrate after you mount it.
keep it away from motors, magnets, speakers and steel screws, which bend the magnetic field.
set the digital low-pass filter to cut vibration noise on robots and drones.
What you need
Shop this list4 of 5 found in our store · ₹2,946
MPU9250 9-axis sensor module: the sensor this guide coversMPU9250 9-Axis Gyro Accelerometer Magnetometer Sensor Module with I2C Interface₹2,369Closest match, check the specs- Uno R3 development board: the controller used in the wiring tableFind this part
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
0.96 inch OLED display 128x64: to show readings without a computer0.96" OLED Display 128x64₹139Closest match, check the specs
Dupont jumper wires: for the connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
Alternatives and when to choose them
- MPU6050: 6-axis only (no compass), cheaper and very well documented.
- BNO055: does the sensor fusion on the chip and outputs angles directly.
- ICM-20948: the current-production 9-axis successor.
- Magnetometers and 9-axis IMUs: how compass calibration works.
Try it: I2c pullup calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Reading the compass at 0x0C without enabling I2C bypass first.
- Expecting a heading from a board that turns out to be an MPU6500 (WHO_AM_I 0x70).
- Mounting it next to a motor or a steel screw and getting a wrong heading.
- Using the raw gyro angle without fusion, so it drifts within seconds.
Frequently asked questions
What is the I2C address of the MPU9250?
0x68 with AD0 to GND, 0x69 with AD0 to VCC. The AK8963 compass is at 0x0C in bypass mode.
Does the MPU9250 work with 3.3 V boards?
Yes. The chip is a 3.3 V part, and modules with a regulator also accept 5 V.
Why does my MPU9250 show no magnetometer?
Either bypass mode is off, or the board carries an MPU6500 or MPU6515. Check WHO_AM_I: 0x71 is a genuine MPU9250.
Can it give yaw without drift?
Yes, when you fuse the calibrated magnetometer with the gyro, for example with a Madgwick or Mahony filter.
MPU9250 or MPU6050?
Choose the MPU6050 for tilt and balance; choose the MPU9250 when you need a compass heading.
Is the MPU9250 still made?
No, it is end of life. The ICM-20948 is the recommended replacement for new designs.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 1 step-by-step build in our project library uses parts from this guide.
Keep learning
Sources
- MPU-9250 product specification and register map (InvenSense)
- AK8963 3-axis electronic compass datasheet (AKM)
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

