IMU / Accelerometer
Interfacing MPU9250 IMU / Accelerometer with Arduino Uno
What is the MPU9250?
The MPU9250 combines a 3-axis gyroscope, 3-axis accelerometer, and a 3-axis AK8963 magnetometer into one package, giving full 9-degrees-of-freedom orientation sensing in a single I2C or SPI device. The gyro and accelerometer are read directly from the main MPU9250 registers, while the magnetometer is technically a separate chip wired internally as an auxiliary I2C slave — most libraries handle this transparently, but it's worth knowing if you ever need to talk to the magnetometer at its own address (0x0C) directly.
It's the standard choice for drones, robotics balancing, and any project needing full orientation (not just tilt) via sensor-fusion algorithms like a Madgwick or Mahony filter. The catch that trips people up is calibration: the accelerometer and especially the magnetometer carry real per-unit offset and scale errors out of the box, and skipping a calibration routine (recording min/max readings while rotating the sensor through all axes) will make yaw heading drift or read wildly wrong.
Specifications
| Interface | I2C (400kHz) or SPI (1MHz register config, 20MHz data reads) |
| I2C address | 0x68 (AD0 to GND) or 0x69 (AD0 to VCC) |
| Operating voltage | 2.4–3.6V (breakout boards commonly add a 5V-tolerant regulator) |
| Gyroscope range | ±250/500/1000/2000 °/s, selectable |
| Accelerometer range | ±2/4/8/16 g, selectable |
| Magnetometer (AK8963) | ±4800 µT, 14 or 16-bit resolution |
| Auxiliary I2C address | Magnetometer accessible directly at 0x0C when bypass mode is enabled |
| Output data rate | Up to 1kHz for gyro/accel via internal digital low-pass filter |
MPU9250 Pinout
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power, 2.4–3.6V (check breakout for 5V tolerance) |
| 2 | GND | Ground |
| 3 | SCL | I2C clock (or SPI SCK) |
| 4 | SDA | I2C data (or SPI SDI/MOSI) |
| 5 | AD0 | I2C address select (GND = 0x68, VCC = 0x69) — also SPI SDO/MISO |
| 6 | NCS | SPI chip select — tie HIGH to force I2C mode |
| 7 | INT | Interrupt output — configurable for data-ready or motion events |
For I2C mode (the common case), tie NCS to VCC. AD0 sets the I2C address. INT is optional and only needed if you want interrupt-driven reads instead of polling.
Setting Up MPU9250 with Arduino Uno
Library
MPU9250_WE by Wolfgang Ewald
Arduino IDE → Library Manager → search "MPU9250_WE"
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| VCC | 5V (if module has onboard regulator) or 3.3V | — |
| GND | GND | — |
| SCL | A5 | — |
| SDA | A4 | — |
| AD0 | GND (sets address to 0x68) | — |
| NCS | VCC (forces I2C mode) | — |
Example code
Keep the board perfectly still during autoOffsets() at startup — it calibrates gyro/accel zero-offsets from that initial reading.
Related Guides & Projects

Arduino Uno R3 Pinout: Every Pin Explained (Digital, Analog, PWM, Power)
Complete Arduino Uno R3 pinout reference: all 14 digital pins, 6 analog inputs, PWM, UART, SPI, I2C, AREF, and power rails explained with wiring tips and common mistakes.

Ultimate Arduino Mega 2560 Pinout Guide: Complete Power & I/O Reference
Master the Arduino Mega 2560 pinout. Detailed reference for all 54 digital pins, 16 analog inputs, PWM, UARTs, SPI, I2C, interrupts, and power. Includes a printable table and practical wiring tips.

Interfacing HC-SR04 Ultrasonic Sensor with Arduino
Measure distance accurately using ultrasonic sound waves and an Arduino Uno — no complex math, no expensive hardware.
HC‑SR04 Ultrasound Distance Measurement with Arduino – Parking Alert (LCD & Buzzer)
Learn HC‑SR04 ultrasound distance measurement with Arduino Uno. Build a parking alert system with 16x2 LCD and buzzer – shows distance and beeps faster as you approach.