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 voltage | 3V – 5V (most breakout modules have an onboard regulator; the bare IC needs 2.375V–3.46V) |
| Interface | I2C, up to 400 kHz (Fast Mode) |
| I2C address | 0x68 default, 0x69 if AD0 is pulled HIGH |
| Accelerometer range | Selectable ±2g / ±4g / ±8g / ±16g |
| Gyroscope range | Selectable ±250 / ±500 / ±1000 / ±2000 °/s |
| Resolution | 16-bit ADC per axis (accel and gyro) |
| Extras | Built-in temperature sensor, 1024-byte FIFO buffer, onboard Digital Motion Processor (DMP) for sensor fusion |
MPU-6050 Pinout
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power — 3V to 5V on most breakout boards (onboard regulator steps down to the chip's 3.3V logic) |
| 2 | GND | Ground |
| 3 | SCL | I2C clock line |
| 4 | SDA | I2C data line |
| 5 | XDA | Auxiliary I2C data line — used to chain an external magnetometer/compass through the MPU-6050's I2C master. Leave unconnected for standard projects. |
| 6 | XCL | Auxiliary I2C clock line — pairs with XDA. Leave unconnected for standard projects. |
| 7 | AD0 | I2C address select — leave LOW/unconnected for address 0x68, pull HIGH for 0x69 (needed when running two MPU-6050s on the same bus) |
| 8 | INT | Interrupt 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 pin | Arduino Uno pin | Note |
|---|---|---|
| VCC | 5V | Most GY-521 breakout modules accept 5V and regulate it down internally. |
| GND | GND | — |
| SCL | A5 | Uno's hardware I2C clock pin. |
| SDA | A4 | Uno's hardware I2C data pin. |
| AD0 | — | Leave unconnected for the default 0x68 address. |
Example code
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

Arduino Uno R3 Pinout: Every Pin Explained (Digital, Analog, PWM, Power)
Complete Arduino Uno R3 pinout reference: all 14 digital pins, 6 analog inputs, PWM, UART, SPI, I2C, AREF, and power rails explained with wiring tips and common mistakes.

Ultimate Arduino Mega 2560 Pinout Guide: Complete Power & I/O Reference
Master the Arduino Mega 2560 pinout. Detailed reference for all 54 digital pins, 16 analog inputs, PWM, UARTs, SPI, I2C, interrupts, and power. Includes a printable table and practical wiring tips.

Interfacing HC-SR04 Ultrasonic Sensor with Arduino
Measure distance accurately using ultrasonic sound waves and an Arduino Uno — no complex math, no expensive hardware.
HC‑SR04 Ultrasound Distance Measurement with Arduino – Parking Alert (LCD & Buzzer)
Learn HC‑SR04 ultrasound distance measurement with Arduino Uno. Build a parking alert system with 16x2 LCD and buzzer – shows distance and beeps faster as you approach.