Skip to content
A

Motion

Interfacing MPU-6050 Motion with Arduino Uno

What is the MPU-6050?

The MPU-6050 packs a 3-axis MEMS accelerometer and a 3-axis MEMS gyroscope into a single chip, plus an onboard temperature sensor, and exposes all of it over I2C. It's the standard first IMU for balancing robots, drones, motion-gesture input, orientation tracking, and step counting — cheap, well documented, and supported by a mature Adafruit library that also handles unit conversion for you.

Under the hood the chip also has a Digital Motion Processor (DMP) capable of onboard sensor fusion, but most projects never touch it — reading raw accelerometer and gyroscope values and combining them in software (or with a library like a Madgwick/Kalman filter) is more than enough for the majority of use cases and far easier to get running. If a project needs heading/compass data too, look at the pin-compatible MPU-9250 instead — see the variants table below.

Specifications

Operating voltage3V – 5V (most breakout modules have an onboard regulator; the bare IC needs 2.375V–3.46V)
InterfaceI2C, up to 400 kHz (Fast Mode)
I2C address0x68 default, 0x69 if AD0 is pulled HIGH
Accelerometer rangeSelectable ±2g / ±4g / ±8g / ±16g
Gyroscope rangeSelectable ±250 / ±500 / ±1000 / ±2000 °/s
Resolution16-bit ADC per axis (accel and gyro)
ExtrasBuilt-in temperature sensor, 1024-byte FIFO buffer, onboard Digital Motion Processor (DMP) for sensor fusion

MPU-6050 Pinout

PinNameDescription
1VCCPower — 3V to 5V on most breakout boards (onboard regulator steps down to the chip's 3.3V logic)
2GNDGround
3SCLI2C clock line
4SDAI2C data line
5XDAAuxiliary I2C data line — used to chain an external magnetometer/compass through the MPU-6050's I2C master. Leave unconnected for standard projects.
6XCLAuxiliary I2C clock line — pairs with XDA. Leave unconnected for standard projects.
7AD0I2C address select — leave LOW/unconnected for address 0x68, pull HIGH for 0x69 (needed when running two MPU-6050s on the same bus)
8INTInterrupt output — signals data-ready or motion events. Optional; not needed for simple polling code.

Common GY-521 breakout boards already include the pull-up resistors SDA/SCL need for I2C, and those pull-ups are tied to VCC. That means the voltage you feed VCC sets your I2C logic level — power the module from 3.3V on 3.3V-only boards (ESP32, Raspberry Pi, STM32) so the bus never rises above what those GPIOs can tolerate, even though the module itself will happily accept 5V. XDA/XCL and INT can be left disconnected entirely unless you're chaining an external compass or using interrupt-driven reads.

Setting Up MPU-6050 with Arduino Uno

Library

Adafruit MPU6050 by Adafruit

Arduino IDE → Tools → Manage Libraries → search "Adafruit MPU6050" → Install (accept prompts to also install "Adafruit Unified Sensor" and "Adafruit BusIO" dependencies)

Wiring

Component pinArduino Uno pinNote
VCC5VMost GY-521 breakout modules accept 5V and regulate it down internally.
GNDGND
SCLA5Uno's hardware I2C clock pin.
SDAA4Uno's hardware I2C data pin.
AD0Leave unconnected for the default 0x68 address.

Example code

C++
  • mpu.begin() fails immediately if the chip isn't found on the bus — that's almost always a wiring or address issue (check SDA/SCL aren't swapped, and that AD0 matches the address you expect), not a faulty sensor.
  • The library reports acceleration in m/s² and gyro rate in rad/s, not raw g's or °/s — factor that in if you're comparing against a datasheet or another library's output.
  • setFilterBandwidth() trades responsiveness for smoothness; lower bandwidths cut more high-frequency noise but add lag, which matters for anything doing active balancing.

Related Components

Related Guides & Projects