

The MPU 6050, manufactured by ESP32 under the part ID "ESP32 Mikrokontoler," is a 6-axis motion tracking device. It integrates a 3-axis gyroscope and a 3-axis accelerometer on a single chip, enabling precise measurement of orientation, acceleration, and angular velocity. This compact and versatile sensor is widely used in applications such as robotics, drones, gaming devices, and wearable technology.








The MPU 6050 is a high-performance sensor with the following key specifications:
| Parameter | Value |
|---|---|
| Supply Voltage | 2.375V to 3.46V |
| Operating Current | 3.9 mA (typical) |
| Gyroscope Range | ±250, ±500, ±1000, ±2000 °/s |
| Accelerometer Range | ±2g, ±4g, ±8g, ±16g |
| Communication Protocol | I2C (up to 400kHz) or SPI |
| Operating Temperature | -40°C to +85°C |
| Package Type | QFN-24 |
The MPU 6050 has 8 pins, as described in the table below:
| Pin Name | Pin Number | Description |
|---|---|---|
| VCC | 1 | Power supply input (2.375V to 3.46V). |
| GND | 2 | Ground connection. |
| SCL | 3 | I2C clock line. |
| SDA | 4 | I2C data line. |
| AD0 | 5 | I2C address select (connect to GND or VCC). |
| INT | 6 | Interrupt output for motion detection. |
| FSYNC | 7 | Frame synchronization input (optional). |
| RES | 8 | Reserved (leave unconnected). |
To use the MPU 6050 with an Arduino UNO, follow these steps:
Wiring:
Install Required Libraries:
Wire.h library (pre-installed with Arduino IDE).MPU6050 library from the Arduino Library Manager.Sample Code: Use the following code to read accelerometer and gyroscope data:
#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
Wire.begin(); // Initialize I2C communication
// Initialize the MPU 6050
if (!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G)) {
Serial.println("Could not find a valid MPU6050 sensor!");
while (1); // Halt execution if sensor initialization fails
}
Serial.println("MPU6050 initialized successfully!");
}
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
}
0x68. If the AD0 pin is connected to VCC, the address changes to 0x69.No Data from the Sensor:
Unstable or Noisy Readings:
Sensor Not Detected:
Q: Can the MPU 6050 be used with 5V logic?
Q: How do I calibrate the MPU 6050?
Q: Can I use SPI instead of I2C?
By following this documentation, you can effectively integrate the MPU 6050 into your projects and troubleshoot common issues.