The MPU6050 is a 6-axis motion tracking device made by InvenSense. It combines:
โ 3-axis accelerometer (measures acceleration)
โ 3-axis gyroscope (measures rotation)
โ Communicates via I2C protocol
โ Built-in Digital Motion Processor (DMP)
| Sensor | Measures | Unit |
|---|---|---|
| Accelerometer | Acceleration on X, Y, Z | m/s² or g |
| Gyroscope | Rotation on X, Y, Z axes | °/sec |
| DMP | Calculates pitch, roll, yaw | Degrees |
| Component | Description |
|---|---|
| ESP32 Board | (Any Devkit) |
| MPU6050 Module | GY-521 or equivalent |
| Jumper Wires | Male-to-female preferred |
| Arduino IDE | With libraries installed |
| MPU6050 Pin | ESP32 Pin | Function |
|---|---|---|
| VCC | 3.3V | Power |
| GND | GND | Ground |
| SDA | GPIO 21 | I2C Data |
| SCL | GPIO 22 | I2C Clock |
MPU6050 works with 3.3V and 5V, but use 3.3V for safety with ESP32.
Open Arduino IDE
Go to Sketch > Include Library > Manage Libraries
Install:
MPU6050 by Electronic Cats or Jeff Rowberg (both work)
Wire (already built-in)
| Application | Usage |
|---|---|
| ๐ Vehicle tracking | Detect tilts, crashes, movement |
| ๐ฎ Game controllers | Detect hand motion |
| ๐ค Robotics | Balancing bots, orientation sensing |
| ๐ Drones | Flight control and stabilization |
| ๐งโ๏ธ Gesture control | Detect specific hand/head movements |
| Issue | Solution |
|---|---|
| All values zero | Check wiring, power, I2C pins |
| MPU not found | Use I2C scanner, change address |
| No output | Confirm Wire.begin(21, 22); is used |
| Values jump too much | Use averaging or DMP |
HOW TO OPERATE