CNAP

MPU-6050 IMU Reference

A 6-axis inertial measurement unit (3-axis accelerometer + 3-axis gyroscope) communicating over I²C.

Pin names

NameDescription
INTInterrupt output — signals new data ready
AD0Address select — tie HIGH/LOW to change the I²C address between 0x68/0x69
XCLAuxiliary I²C clock (for chaining a magnetometer)
XDAAuxiliary I²C data (for chaining a magnetometer)
SDAI²C data
SCLI²C clock
GNDGround
VCCPower (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

DescriptionAttrs
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