Skip to content
Motion

MPU-6050 6-Axis Accelerometer & Gyroscope

The standard 6-axis IMU for balancing robots, drones, and orientation tracking — cheap and well-supported.

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

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.

Variants

The plain MPU-6050 covers the large majority of motion-sensing projects — tilt, motion detection, basic orientation, step/impact detection. If a project needs true compass heading (not just relative rotation from the gyro, which drifts over time), move up to the pin-compatible MPU-9250 or the newer ICM-20948, both of which add a magnetometer on the same I2C bus.

VariantTemp rangeHum rangeAccuracyProtocolPrice
MPU-6050~$2–4
MPU-6500~$3–5
MPU-9250~$4–7
ICM-20948~$5–9

Board Integration

Library

Adafruit MPU6050by Adafruit

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

Wiring

Component pinBoard 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.

Code

C++

Notes

  • 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.