
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.
Β

Β
Β
Some of the features of the MPU 9-DOF MEMS device Module are listed below
- It has a triple axis on accelerometer, gyro and magnetometer as well
- Digital-output measuring device with programmable range of Β± 2g, Β± 4g, Β± 8g, and Β± 16g for accelerometer.
- Digital-output measuring device with programmable range of Β± 250, Β± 500, Β± 1000, and Β± 2000 Β°/ sec for gyroscope.
- 3-axis silicon monolithic Hall-effect magnetic sensor with magnetic concentrator
- 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
Β
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 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
Β
Β
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!)
Frequently Asked Questions
1. What is a MPU-9250?
MPU-9250 is a dope little piece of tech that's got everything you need for motion tracking in one package. It's got a 3-axis gyroscope, a 3-axis accelerometer, and a 3-axis magnetometer all rolled up into a single chip. People are using it in all kinds of sick applications, from drones to VR headsets to gaming devices that use motion control. And the best part? It's small and low-power, so you can take it with you anywhere without worrying about it draining your battery.
read more : IR Sensor Interfacing with Arduino
2. What is the use of MPU-9250?
The MPU-9250 sensor module is a combination of a 3-axis accelerometer, a 3-axis gyroscope, and a 3-axis magnetometer in one compact package. This thing is perfect for projects that need precise motion tracking and orientation sensing, like drones, robots, and virtual reality systems. It gives you super accurate data and can connect to microcontrollers using interfaces like SPI or I2C. No wonder it's a go-to choice for a lot of projects.
read more : ROBOCRAZE DIY LINE FOLLOWER KIT
Components and Supplies
Frequently Asked Questions
1. What is a MPU-9250?
MPU-9250 is a dope little piece of tech that's got everything you need for motion tracking in one package. It's got a 3-axis gyroscope, a 3-axis accelerometer, and a 3-axis magnetometer all rolled up into a single chip. People are using it in all kinds of sick applications, from drones to VR headsets to gaming devices that use motion control. And the best part? It's small and low-power, so you can take it with you anywhere without worrying about it draining your battery.
read more : IR Sensor Interfacing with Arduino
2. What is the use of MPU-9250?
The MPU-9250 sensor module is a combination of a 3-axis accelerometer, a 3-axis gyroscope, and a 3-axis magnetometer in one compact package. This thing is perfect for projects that need precise motion tracking and orientation sensing, like drones, robots, and virtual reality systems. It gives you super accurate data and can connect to microcontrollers using interfaces like SPI or I2C. No wonder it's a go-to choice for a lot of projects.
read more : ROBOCRAZE DIY LINE FOLLOWER KIT