MPU-6050
accelerometer + gyroscope (6 axes), I2C
Measures acceleration and rotation on 3 axes. From that you know whether the board is tilted, shaking or falling. Used in drones, self-balancing robots and motion controllers.
Open the course →How it works
Inside there are tiny mechanical structures (MEMS) that move under acceleration. The accelerometer measures gravity, so you can calculate the tilt from it. The gyroscope measures the speed of rotation (°/s). Data is read over I2C (address 0x68). The accelerometer is accurate in the long run, the gyroscope in the short run, so it is best to combine them (complementary filter).
Pins and wiring
| Pin | What it is | Where it connects / why |
|---|---|---|
| VCC | Supply | → 3V3 (the module has a regulator). |
| GND | Ground | → GND. |
| SCL | I2C clock | → GPIO 22. |
| SDA | I2C data | → GPIO 21. |
| XDA / XCL | Auxiliary I2C bus | Not connected. |
| AD0 | Address select | GND/open = 0x68, 3V3 = 0x69. |
| INT | Interrupt (new data) | Optional → GPIO. |
Specifications
Axes3 accelerometer + 3 gyroscope
Accel range±2 / 4 / 8 / 16 g
Gyro range±250 – 2000 °/s
I2C address0x68 / 0x69
Supply3.3 – 5 V (module)
Tips and typical mistakes
- The gyroscope drifts — at start-up measure the value at rest and subtract it.
- It can share the I2C bus with an OLED/LCD: different addresses.