โœจ DOWNLOAD OUR APP - Use RCAPP
for additional 5% discount! + Redeem RC COINS ๐Ÿ‘‡
Skip to content
All the orders confirmed after 4pm on 31st Oct will only be shipped on 3rd Nov. Store Pick-Up orders to be collected on 3rd Nov 2025
Ph: +91 812 3057 137   |  Support

Interfacing MPU-9250 9-DOF Sensor with Arduino

Introduction

MPU-9250 is a 9-axis Inertial measurement module that is a Micro Electro Mechanical Systems configuration (MEMS). IMUs are used as real-time tracking devices to give acceleration, angular velocity, and magnetic field information on all three dimensions (x, y, and z) with high speed and accuracy. Despite its size, it is rated for high-performance and has an analog to digital converter with 16 bit resolution. It features an I2C interface with a data rate of 400 kHz for the 9- DOF Detector module, a Serial Peripheral Interface for fast mode is provided in the module with a rate up to 20 MHz.ย 


MPU-9250 is perfect for applications where motion and accelerations needs to be tracked like VR headsets or even as an accurate vibration sensor in an industrial environment.

ย 

MPU-9250 9-DOF Sensor

ย 

ย 

Some of the features of the MPU 9-DOF MEMS device Module are listed below

  1. It has a triple axis on accelerometer, gyro and magnetometer as well
  2. Digital-output measuring device with programmable range of ยฑ 2g, ยฑ 4g, ยฑ 8g, and ยฑ 16g for accelerometer.
  3. Digital-output measuring device with programmable range of ยฑ 250, ยฑ 500, ยฑ 1000, and ยฑ 2000 ยฐ/ sec for gyroscope.
  4. 3-axis silicon monolithic Hall-effect magnetic sensor with magnetic concentrator
  5. VDD supply voltage range of 2.4โ€“3.6V

read more :ย How 433MHz RF Module Works & Interfacing With Arduino

Specification:

Features and Peripherals

Availability

Structure

MEMS

SPI Data rate

1 Mz

SPI Fast Data Reading Rate

20Mhz

I2C Data Rate

400 Mhz

Shock tolerance

400 Khz

FIFO buffer

10,000 g

Auxiliary I2C interface

512 Bytes

SPI

1

I2C

1

Operating Voltage

2.4 - 3.6 Volts

Operating current

3.5 mA

Magnetometer output data resolution

14-bit (0.6ยตT/LSB)

low-pass filter and wake-on-motion interrupt

low power mode

VDDIO

Yes

Digital Output Temperature Sensor

Yes

Cross - Sensitivity

Minimum

User - Programmable Digital Filter

Yes

Package Type

QFN

Dimensions

3 x 3 x 1 mm

Gyroscope operating current

3.2mA

Accelerometer Operating current

450ยตA

Magnetometer Operating current:

280ยตA

ย 

ย 

read more :ย Interfacing MAX30100 Pulse Oximeter with Arduino

Constructions

construction of MPU9250

ย 

The MEMS Sensor module consists mainly of five components: I/ O heads, pull- up resistors, a LDO, and a decoupling capacitor.


MPU9250 chip:

Digital Motion Processor is a multi-purpose processor introduced by Asahi Kasei Microdevices Corporation. This is the main IC andย  is equipped with an accelerometer, gyroscope, and magnetometer.

ย 

ย 

ย 

I/ O heads:

The input and output pins will be used to serve the purpose of connectivity and data transmission with the microcontroller unit.

ย 

Pull-up Resistors:

The pull up resistors are placed for I2C machine to source current and establish default state.

ย 

LDO:

An LDO voltage regulator is provided to lower the voltage to 3.3V in order for the IC to function in its rated voltage.

ย 

Decoupling Capacitors:

Depending on the power source (5V, 3.3V, etc.) and ground, decoupling capacitors can temporarily act as power sources. These are known as bypass capacitors. Signals are filtered by these capacitors to remove unwanted noise.

ย 

read more :ย Arduino Interfacing with Ultrasonic Sensor

ย 

Pin Configuration

Pin Configuration MPU9250

ย 

ย 

PIN NAME

FUNCTION

INT

Interrupt pin

ECL

I2C Master Serial Clockย 

AD0/SD0

I2C Address/Serial data out pin

FSYNC

Frame Synchronisation input pin

VCC

Power supply pin

GND

Ground pin

EDA

I2C Serial Data inputย 

nCS

Chip selection pin

SCL/SCLK

I2C Serial Clock/SPI Serial Clock pin

SDA/SDI

I2C Serial Data/SPI Serial Data pin

ย 

ย 

read more :ย How to connect ZMPT101B to Arduino

Interfacing MPU-9250 9-DOF Sensor with Arduino

ย 

Interfacing with Arduino UNO

ย 

Connection:

Arduino of 5 V - Vcc of the MPU-9250

Arduino of GND - GND of the MPU-9250

Arduino of A4 - SDA of the MPU-9250

Arduino of A5 - SCL of the MPU-9250


Connections between the MPU- 9250 detector module and Arduino UNO are shown in above fig.


Arduino Code:

To use the library, first download and install the MPU9250 into the Arduino IDE. After installation, include the library to sketch the code, also follow these way to get code from the library by clicking Files> Examples> MPU 9250> Calibration or you can also copy the below code to your IDE.

#include "MPU9250.h"

MPU9250 mpu;

ย 

void setup() {

ย ย ย ย Serial.begin(115200);

ย ย ย ย Wire.begin();

ย ย ย ย delay(2000);

ย 

ย ย ย ย if (!mpu.setup(0x68)) {ย  // change to your own address

ย ย ย ย ย ย ย ย while (1) {

ย ย ย ย ย ย ย ย ย ย ย ย Serial.println("There was a problem connecting to MPU. If you are not sure about your connection, please check it with *connection_check*.");

ย ย ย ย ย ย ย ย ย ย ย ย delay(5000);

ย ย ย ย ย ย ย ย }

ย ย ย ย }

ย 

ย ย ย ย // calibrate anytime you want to

ย ย ย ย Serial.println("wait 5sec it will start.");

ย ย ย ย Serial.println("The device should not be moved from the flat plane.");

ย ย ย ย mpu.verbose(true);

ย ย ย ย delay(5000);

ย ย ย ย mpu.calibrateAccelGyro();

ย 

ย ย ย ย Serial.println("Mag calibration will start in 5sec.");

ย ย ย ย Serial.println("Wave the device in a figure eight until it is finished");

ย ย ย ย delay(5000);

ย ย ย ย mpu.calibrateMag();

ย 

ย ย ย ย print_calibration();

ย ย ย ย mpu.verbose(false);

}

ย 

void loop() {

}

ย 

void print_calibration() {

ย ย ย ย Serial.println("< calibration parameters >");

ย ย ย ย Serial.println("accel bias [g]: ");

ย ย ย ย Serial.print(mpu.getAccBiasX() * 1000.f / (float)MPU9250::CALIB_ACCEL_SENSITIVITY);

ย ย ย ย Serial.print(", ");

ย ย ย ย Serial.print(mpu.getAccBiasY() * 1000.f / (float)MPU9250::CALIB_ACCEL_SENSITIVITY);

ย ย ย ย Serial.print(", ");

ย ย ย ย Serial.print(mpu.getAccBiasZ() * 1000.f / (float)MPU9250::CALIB_ACCEL_SENSITIVITY);

ย ย ย ย Serial.println();

ย ย ย ย Serial.println("gyro bias [deg/s]: ");

ย ย ย ย Serial.print(mpu.getGyroBiasX() / (float)MPU9250::CALIB_GYRO_SENSITIVITY);

ย ย ย ย Serial.print(", ");

ย ย ย ย Serial.print(mpu.getGyroBiasY() / (float)MPU9250::CALIB_GYRO_SENSITIVITY);

ย ย ย ย Serial.print(", ");

ย ย ย ย Serial.print(mpu.getGyroBiasZ() / (float)MPU9250::CALIB_GYRO_SENSITIVITY);

ย ย ย ย Serial.println();

ย ย ย ย Serial.println("mag bias [mG]: ");

ย ย ย ย Serial.print(mpu.getMagBiasX());

ย ย ย ย Serial.print(", ");

ย ย ย ย Serial.print(mpu.getMagBiasY());

ย ย ย ย Serial.print(", ");

ย ย ย ย Serial.print(mpu.getMagBiasZ());

ย ย ย ย Serial.println();

ย ย ย ย Serial.println("mag scale []: ");

ย ย ย ย Serial.print(mpu.getMagScaleX());

ย ย ย ย Serial.print(", ");

ย ย ย ย Serial.print(mpu.getMagScaleY());

ย ย ย ย Serial.print(", ");

ย ย ย ย Serial.print(mpu.getMagScaleZ());

ย ย ย ย Serial.println();

}

Conclusion

In this blog post, we have learned that Interfacing the MPU-9250 9-DOF sensor with Arduino opens up a world of possibilities for building innovative projects that require precise motion tracking and orientation sensing. With its easy-to-use library and robust capabilities, the MPU-9250 sensor can be integrated into a wide range of applications, from drones and robotics to virtual reality and gaming. By following the simple steps outlined in this guide, you can get started on your journey to creating your own sensor-based projects and taking your skills to the next level. So, grab your Arduino and MPU-9250 sensor and get ready to unleash your creativity!

ย 

ย 

If you appreciate our work don't forget to share this post and leave your opinion in the comment box.

ย 

Please do check out otherย blog posts aboutย Interfacing ACS712 with Arduinoย ,ย Arduino Interfacing with Ultrasonic Sensorย ,ย LED Interfacing with Arduinoย ,ย Interfacing GSM Module with Arduinoย ,ย Interfacing MAX30100 Pulse Oximeter with Arduinoย ,ย IR Sensor Interfacing with Arduinoย ,ย How to connect ZMPT101B to Arduinoย andย ย How to use Buzzer with Arduino.

ย 

Make sure you check out our wide range ofย products and collectionsย (we offer some excitingย deals!)

Prev Post
Next Post

Leave a comment

Please note, comments need to be approved before they are published.

Thanks for subscribing!

This email has been registered!

Shop the look

Choose Options

Edit Option
Back In Stock Notification
Compare
Product SKU Description Collection Availability Product Type Other Details

Choose Options

this is just a warning
Login
Shopping Cart
0 items
FREE SHIPPING!
โ‚น100 OFF
โ‚น200 OFF
WhatsApp Chat Chat