Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Connect the GY-521 to an Arduino over I²C, then read the MPU-6050 sensor’s accelerometer, gyroscope and temperature registers. For a first test, use the four-wire hookup below and either the Adafruit library example or a short raw Wire sketch. Keep the board still when calibrating, and convert raw counts using the sensor’s configured ranges before treating them as physical measurements.

What the GY-521 measures

The GY-521 is a breakout board built around the MPU-6050 sensor IC; it is not the sensor chip itself. The MPU-6050 combines a three-axis accelerometer, a three-axis gyroscope, a temperature sensor and a digital motion processor (DMP). The DMP can process motion algorithms on the chip, but a beginner setup can start by reading raw register values over I²C. Michael Schoeffler’s GY-521 guide describes the breakout and its pins.

The accelerometer responds to acceleration, including gravity. When the module is stationary, its readings should reflect gravity along the axis aligned with it. The gyroscope reports angular rate; if you integrate that rate to estimate angle, error accumulates and the estimate can drift. Raw register counts are not yet acceleration or rotation units: the appropriate conversion depends on the full-scale ranges configured for the sensor.

Wire the GY-521 to an Arduino Uno

Use an Arduino Uno, GY-521, breadboard and jumper wires. Connect the four I²C and power lines as follows:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
HiLetgo 3pcs GY-521 MPU-6050 MPU6050 3 Axis Accelerometer Gyroscope Module 6 DOF 6-axis Accelerometer Gyroscope Sensor Module 16 Bit AD Converter Data Output IIC I2C for Arduino
  • MPU-6050 MPU6050 6-axis Accelerometer Gyroscope Sensor
  • Communication mode: standard IIC communication protocol
  • Chip built-in 16bit AD converter, 16bit data output
  • Gyroscopes range: +/- 250 500 1000 2000 degree/sec
  • Acceleration range: ±2 ±4 ±8 ±16g
GY-521 pin Arduino Uno
VCC 5V on a typical regulator-equipped breakout, or the voltage recommended for your particular board revision
GND GND
SDA SDA, or A4 on Uno boards without dedicated SDA/SCL labels
SCL SCL, or A5 on Uno boards without dedicated SDA/SCL labels

Breakout revisions and clones may differ in their regulator and voltage behavior, so do not assume every board accepts the same supply. Michael Schoeffler’s pinout guide identifies the remaining pins as XDA, XCL, AD0 and INT: XDA and XCL are auxiliary I²C pins, INT is an interrupt output, and AD0 selects the I²C address. For the ordinary four-wire Arduino hookup, leave those auxiliary and interrupt pins unconnected.

Choose between a library and raw I²C

A library is the easier starting point if you want readable output and helper functions. Raw Wire access is useful for learning how the MPU-6050 register map works or confirming basic communication, but it leaves configuration and interpretation to your sketch.

Rank #2
AOICRIE 3pcs GY-521 MPU 6050 MPU6050 3 Axis Accelerometer Gyroscope Module 6 DOF 6-Axis Accelerometer Gyroscope Sensor Module Pre-Soldered for Raspberry Pi Pico and Other Models
  • MPU-6050 MPU6050 Module: adopts the standard IIC communication for communication and is powered by 3V-5V for sustainable use.
  • 3 Axis Accelerometer Gyroscope Module: Gyroscope range: ± 250 500 1000 2000 ° / s; Acceleration range: ± 2 ± 4 ± 8 ± 16 g; Transmission can pass I2C up to 400kHz or SPI up to 20MHz.
  • MPU 6050 Chip built-in: with three 16-bit analog-to-digital converters (ADCs) for digitizing the gyroscope outputs and another three ones for digitizing the accelerometer outputs.
  • Universally Compatible: This sensor is easy to use with just about any microcontroller that has an I2C interface, for Raspberry Pi and ESP32 models.
  • What You Will Get: 3pcs Pre-Soldered GY-521 mpu-6050 mpu6050 3 axis accelerometer sensor. Ready to plug in and go.
Approach What it provides Best fit
Adafruit MPU6050 library Guided setup and a basic readings example that reports acceleration, rotation and temperature. The guide specifies Adafruit BusIO and Adafruit Unified Sensor as dependencies. First readings and a supported library workflow
RobTillaart GY521 library Address support for 0x68 and 0x69, connection checking, sensitivity configuration and calibration helpers. Its README labels the library experimental. Code that needs its calibration-oriented API or sensitivity controls
Raw Wire sketch Direct register access, including waking the chip and reading a register block. Range configuration, scaling and additional processing are your responsibility. Learning I²C and register-level behavior

Use the Adafruit basic-readings example

  1. In the Arduino IDE, open Library Manager and install Adafruit MPU6050, Adafruit BusIO and Adafruit Unified Sensor.
  2. Open File → Examples → Adafruit MPU6050 → basic_readings.
  3. Upload the sketch, open Serial Monitor and set the baud rate to 115200, as specified in the Adafruit guide.
  4. Hold the module still, then tilt and rotate it. Confirm that the reported acceleration, rotation and temperature values appear and respond to movement.

See the Adafruit MPU6050 Arduino guide for the library setup and example path.

Read raw values with Wire

The minimal register workflow below reads acceleration, temperature and gyroscope data. It assumes AD0 is low, making the address 0x68. If you only need the three accelerometer and three gyroscope axes, the Arduino Project Hub example reads 12 bytes; requesting 14 also includes the two-byte temperature value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
hiBCTR 6-Pack GY-521 MPU-6050 6-Axis Accelerometer Gyroscope
  • Product Name MPU-6050 MPU6050 6-Axis Accelerometer Gyro Sensor, which is a key component for motion sensing applications.
  • Communication Protocol Utilizes the standard IIC communication protocol, enabling reliable data transfer between the sensor and other connected devices.
  • AD Converter and Data Output Incorporates a built-in 16-bit AD converter, providing precise 16-bit data output for accurate measurement and analysis.
  • Gyroscope Range Offers a gyroscope range of +/- 250, 500, 1000, and 2000 degrees per second, allowing for the detection of various rotational speeds and movements.
  • Acceleration Range The acceleration range spans ±2, ±4, ±8, and ±16 grams, facilitating the measurement of different levels of linear acceleration in various applications such as inertial navigation and motion tracking.
  1. Include Wire.h, set the device address to 0x68 (or 0x69 if AD0 is high), and call Wire.begin().
  2. Wake the sensor by writing 0 to register 0x6B (PWR_MGMT_1).
  3. Set the register pointer to 0x3B (ACCEL_XOUT_H).
  4. Request 14 bytes. Combine each high and low byte into a signed 16-bit value: accelerometer X, Y and Z; temperature; then gyroscope X, Y and Z.
  5. Print the values to Serial Monitor and move or rotate the board to verify that they change.

The Arduino Project Hub GY-521 example demonstrates reading the sensor over I²C, while Schoeffler’s Uno tutorial includes the 14-byte read with temperature. Neither raw byte values nor combined signed integers should be labelled as physical units until you have accounted for the selected accelerometer and gyroscope ranges and their sensitivity factors.

Find the I²C address

The MPU-6050 address depends on the AD0 pin: AD0 low selects 0x68, and AD0 high selects 0x69. The Uno examples commonly use 0x68. If the sketch cannot find the sensor, check AD0 and run an I²C scanner, or call isConnected() when using the RobTillaart library. Its GY521 README documents both supported addresses and the connection check.

Rank #4
KEAcvise 6-Pack GY-521 MPU6050 Sensor Module, 6-Axis IMU
  • Product Name MPU-6050 MPU6050 6-Axis Accelerometer Gyro Sensor, which is a key component for motion sensing applications.
  • Communication Protocol Utilizes the standard IIC communication protocol, enabling reliable data transfer between the sensor and other connected devices.
  • AD Converter and Data Output Incorporates a built-in 16-bit AD converter, providing precise 16-bit data output for accurate measurement and analysis.
  • Gyroscope Range Offers a gyroscope range of +/- 250, 500, 1000, and 2000 degrees per second, allowing for the detection of various rotational speeds and movements.
  • Acceleration Range The acceleration range spans ±2, ±4, ±8, and ±16 grams, facilitating the measurement of different levels of linear acceleration in various applications such as inertial navigation and motion tracking.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Calibrate and interpret readings

Keep the module motionless during calibration. The RobTillaart library’s calibrate(times, angleX, angleY, inverted) routine writes accelerometer and gyroscope offsets; its README says times values of 100 or more are typical and warns that calibration can take time. Repeat calibration after changing sensitivity settings. The maintainer’s guidance is explicit: “To improve the quality of the error offsets, the GY521 sensor should not move during the calibration.”

  • Accelerometer: readings include gravity. At rest, expect gravity to appear primarily on the axis aligned with it, after applying the correct conversion and calibration.
  • Gyroscope: readings represent angular rate. Integrating them to estimate orientation will normally drift; the cited beginner examples do not establish a universal drift or accuracy figure.
  • Raw counts: use the selected full-scale range and corresponding sensitivity factor before converting counts to physical units.

Troubleshoot missing or unstable readings

  • No device detected: verify whether AD0 is low or high, then check for address 0x68 or 0x69 with a scanner or isConnected().
  • Bus communication fails: confirm GY-521 and Arduino share ground, and recheck SDA and SCL. On an Uno without dedicated labels, use A4 for SDA and A5 for SCL.
  • Power or board behavior is inconsistent: check the voltage guidance for your specific breakout revision. Regulator and input-voltage behavior should not be assumed identical across clones.
  • Calibration offsets are poor: place the module on a stable surface and leave it still for the calibration call; repeat after changing sensitivity.
  • Values move but orientation is noisy or drifts: raw register reads are a connectivity and learning test, not a complete orientation solution. Use a library when you need range configuration, filtering or orientation helpers, and account for gyroscope drift.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.