Source: https://mokxi.com/parts/mpu9250
Updated: 2026-11-16

Part

# Nine-axis IMU, MPU-9250

An MPU6050 with a compass inside: set BYPASS_EN and the AK8963 answers at 0x0C. Drag it to tip it.

See every part

- 10 pins
- 4 settings
- In 1 project

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Nine-axis IMU, MPU-9250 in brief

What it is, and every setting the properties panel gives it.

The MPU-9250 packs three sensors into one small package, usually sold on the GY-9250 board: an accelerometer, a gyroscope and a compass. The first two are the same design as the MPU6050 and answer at 0x68. The compass, an AK8963, is a second chip inside the package, hidden behind the first; a sketch sets the bypass bit and it appears on the same two wires at 0x0C. That is why an I2C scan of a fresh module shows only one address. In Mokxi you drag the board on the canvas to tip it and move a slider to turn it, so the accelerometer sees gravity shift between its axes and the compass sees the Earth’s field turn. The model gives WHO_AM_I as 0x71, reads the magnetometer at its datasheet scale, applies its sensitivity adjustment and leaves out the DMP, the FIFO, hard and soft iron effects and magnetic declination.

Family

Sensors

Pins

10

pitch

0

roll

0

heading

0

temperature

25

Pins

## 10 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

Role

What it does

VCC

Input or output

Supply, 3.3 to 5 V (the board has a regulator).

GND

Input or output

Ground.

SCL

Input or output

The I2C bus. The accelerometer and gyroscope answer at 0x68.

SDA

Input or output

The I2C bus. The accelerometer and gyroscope answer at 0x68.

EDA

Input or output

The chip's auxiliary bus. Leave them.

ECL

Input or output

The chip's auxiliary bus. Leave them.

AD0

Input or output

High moves the address to 0x69. Pulled low on the board.

INT

Output

The interrupt output.

NCS

Input or output

SPI select and frame sync. Leave them.

FSYNC

Input or output

SPI select and frame sync. Leave them.

How to use it

## How to read the MPU-9250 compass and tilt on an Arduino

The tilt compass project runs on a Mega, because asukiaaa’s library, its floating point and atan2() together outgrow what Mokxi allows an Uno example. Four wires: VCC to 5 V (the board has a regulator), GND to GND, SDA to the Mega’s SDA (pin 20) and SCL to SCL (pin 21). AD0 stays unwired, so the motion sensor is at 0x68.

imu.beginAccel() starts the accelerometer, and imu.beginMag() sets the bypass so the AK8963 answers. Each loop, accelUpdate() and magUpdate() return 0 when they have fresh numbers. Pitch and roll come from atan2 of the accelerometer axes; magHorizDirection() is the angle of north from the chip’s X axis. Drag the heading slider and the direction follows. Then tip the board: the heading changes too, because the Earth’s field also points down into the ground, and only a tilt-compensated calculation, using the accelerometer, removes that.

Part pin

Board pin

VCC

5 V

GND

GND

SDA

SDA (pin 20 on the Mega)

SCL

SCL (pin 21 on the Mega)

AD0

Not wired: address 0x68

On an ESP32 the same sketch fits with room to spare; Wire uses GPIO 21 and 22 unless you name other pins.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

Tilt and heading, from the tilt compass sketch

Common errors

## Common Nine-axis IMU, MPU-9250 errors and fixes

What goes wrong

The fix

An I2C scan finds only 0x68, and the magnetometer reads nothing.

The AK8963 is behind the motion sensor until BYPASS_EN, bit 1 of register 0x37, is set. beginMag() in asukiaaa’s library does it; with raw Wire calls, write that bit first.

The heading drifts when the board is not flat.

magHorizDirection() assumes a level board. Hold it flat, or compensate the magnetometer reading with pitch and roll from the accelerometer.

Nothing answers at 0x68.

Check AD0. Pulled high it moves the chip to 0x69, and the library has to be told.

The compass points a few degrees off true north.

The chip measures magnetic north. Add your local declination in code; the model does not apply one.

Questions

## Questions and answers

### What is the difference between the MPU-9250 and the MPU6050?

The MPU-9250 adds a three-axis magnetometer, so it can find north as well as down. Its accelerometer and gyroscope registers match the MPU6050’s, and WHO_AM_I reads 0x71 instead of 0x68.

### Which Arduino library reads the MPU-9250 here?

asukiaaa’s MPU9250 library, included as MPU9250_asukiaaa.h, is the one the tilt compass uses. Any library that reaches the compass through the bypass, as most do, finds it the same way.

### Does the simulator run the MPU-9250’s DMP?

No. The digital motion processor, the FIFO and the chip’s own auxiliary I2C master are left out; sketches read the raw registers and do the math themselves.

### Why does the tilt compass project use a Mega and not an Uno?

The library, floating point and atan2() make the program larger than Mokxi allows a built-in Uno example. A real Uno can run a trimmed version; the wiring is the same.

How it is modeled

## What is true about the Nine-axis IMU, MPU-9250, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

From the MPU-9250 register map: the MPU-6050's accelerometer, gyroscope and
temperature registers, WHO_AM_I reading 0x71, and the chip awake at power-up.
From the AK8963 datasheet: WIA 0x48, the field low byte first at 0.15 uT a count
(0.6 at 14 bits), DRDY, single and continuous modes, ST2 ending a read, and
the fuse ROM's sensitivity adjustment. The magnetometer's axes are turned from
the accelerometer's as the register map draws them, and the Earth's field is
20 uT north and 45 uT down.

### Not modeled

The DMP and the FIFO, the auxiliary I2C master (use the bypass, as every Arduino
library does), SPI, self test, noise, bias, hard and soft iron, and magnetic
declination. The adjustment values are 128, a factor of one.

From MPU-9250 nine-axis IMU, in full.

Projects

## See the Nine-axis IMU, MPU-9250 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

## The boards it is shown on

This board has a built-in project with the Nine-axis IMU, MPU-9250 in it.

- Arduino Mega 2560

Keep going

## Keep going

- I2C Scanner for Arduino and ESP32, and Fixes
- I2C Explained: Addresses, Acknowledges and Pull-Ups
- Accelerometer and gyroscope, MPU6050
- Accelerometer, ADXL345
- Accelerometer, ADXL335 analog

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Nine-axis IMU, MPU-9250

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
