MPU-6050 IMU Reference
A 6-axis inertial measurement unit (3-axis accelerometer + 3-axis gyroscope) communicating over I²C.
Pin names
| Name | Description |
|---|---|
| INT | Interrupt output — signals new data ready |
| AD0 | Address select — tie HIGH/LOW to change the I²C address between 0x68/0x69 |
| XCL | Auxiliary I²C clock (for chaining a magnetometer) |
| XDA | Auxiliary I²C data (for chaining a magnetometer) |
| SDA | I²C data |
| SCL | I²C clock |
| GND | Ground |
| VCC | Power (3.3V–5V) |
Attributes
This component has no configurable attributes.
Usage
Connect VCC to 5V, GND to GND, SDA to the board's SDA pin (A4 on an Uno), and SCL to SCL (A5 on an Uno). Read orientation data with the Adafruit MPU6050 library.
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
Adafruit_MPU6050 mpu;
void setup() {
Serial.begin(9600);
mpu.begin();
}
void loop() {
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);
Serial.print("Accel X: "); Serial.print(a.acceleration.x);
Serial.print(" Gyro X: "); Serial.println(g.gyro.x);
delay(200);
}
Examples
| Description | Attrs |
|---|---|
| Default MPU-6050 | {} |
See also
- Tilt Switch — much simpler mechanical alternative for basic orientation detection
- DS1307 RTC — another common I²C module using the same SDA/SCL wiring pattern