

The MPU6050 is a 6-axis motion tracking device that combines a 3-axis gyroscope and a 3-axis accelerometer on a single chip. This integration enables the measurement of angular velocity and acceleration in three-dimensional space, making it a versatile and widely used sensor in motion tracking and orientation detection applications.








The MPU6050 is a highly integrated sensor with the following key technical details:
The MPU6050 comes in a 24-pin QFN package. Below is the pin configuration for common breakout boards:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply input (2.375V to 3.46V, typically 3.3V). |
| 2 | GND | Ground connection. |
| 3 | SCL | I2C clock line. Connect to the microcontroller's I2C clock pin. |
| 4 | SDA | I2C data line. Connect to the microcontroller's I2C data pin. |
| 5 | AD0 | I2C address select. Connect to GND for address 0x68 or VCC for 0x69. |
| 6 | INT | Interrupt pin. Outputs interrupt signals for motion detection or data ready. |
0x68 or to VCC for 0x69.Below is an example of how to interface the MPU6050 with an Arduino UNO using the I2C protocol:
#include <Wire.h>
#include <MPU6050.h>
// Create an MPU6050 object
MPU6050 mpu;
// Setup function
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
Wire.begin(); // Initialize I2C communication
// Initialize the MPU6050
if (!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G)) {
Serial.println("Could not find a valid MPU6050 sensor, check connections!");
while (1); // Halt execution if sensor initialization fails
}
// Calibrate the sensor
mpu.calibrateGyro();
mpu.setThreshold(3); // Set motion detection threshold
Serial.println("MPU6050 initialized and calibrated.");
}
// Loop function
void loop() {
Vector rawAccel = mpu.readRawAccel(); // Read raw accelerometer data
Vector rawGyro = mpu.readRawGyro(); // Read raw gyroscope data
// Print accelerometer data
Serial.print("Accel X: "); Serial.print(rawAccel.XAxis);
Serial.print(" | Y: "); Serial.print(rawAccel.YAxis);
Serial.print(" | Z: "); Serial.println(rawAccel.ZAxis);
// Print gyroscope data
Serial.print("Gyro X: "); Serial.print(rawGyro.XAxis);
Serial.print(" | Y: "); Serial.print(rawGyro.YAxis);
Serial.print(" | Z: "); Serial.println(rawGyro.ZAxis);
delay(500); // Wait for 500ms before the next reading
}
Sensor Not Detected on I2C Bus:
0x68 or 0x69) is being used.Inaccurate Readings:
No Data from Sensor:
Q: Can the MPU6050 be powered with 5V?
A: No, the MPU6050 operates at a maximum voltage of 3.46V. Use a voltage regulator or level shifter if interfacing with a 5V system.
Q: How do I reset the MPU6050?
A: You can reset the MPU6050 by writing 0x80 to the PWR_MGMT_1 register via I2C.
Q: Can I use the MPU6050 without the DMP?
A: Yes, you can directly read raw accelerometer and gyroscope data without using the DMP.
This concludes the documentation for the MPU6050.