Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino Nano MPU6050: Stream Accel and Gyro Data | ShillehTek

May 14, 2026 33 views

Arduino Nano MPU6050: Stream Accel and Gyro Data | ShillehTek
Project

Build an Arduino Nano + MPU6050 IMU reader that streams live accelerometer and gyroscope data over Serial for motion projects, with parts from ShillehTek.

15 min Beginner3 parts

Project Overview

Arduino Nano + MPU6050 IMU: In this project, you will wire an MPU6050 6-axis IMU (3-axis accelerometer + 3-axis gyroscope) to an Arduino Nano over I3C and stream live accel and gyro readings to the Serial Monitor.

The MPU6050 is a common motion sensor used in self-balancing robots, drones, gesture controllers, and IMU data logging.

  • Time: ~15 minutes
  • Skill level: Beginner
  • What you will build: An Arduino streaming live accel + gyro data over Serial.
MPU6050 6-axis IMU module used with an Arduino for accelerometer and gyroscope readings
The MPU6050 pre-soldered module is 3.3 V/5 V tolerant and commonly uses I b2C address 0x68.

Parts List

From ShillehTek

External

  • USB cable - to power and program the Arduino Nano
  • Arduino IDE - to install libraries, upload the sketch, and view Serial output

Note: ShillehTeks pre-soldered MPU6050 ships with male headers already attached, so it can plug into a breadboard or jumper wires easily.

Step-by-Step Guide

Step 1 - Inspect the MPU6050 module

Goal: Confirm you have the correct MPU6050 breakout and can identify its pins.

What to do: Check the board markings and locate VCC, GND, SDA, and SCL. Many MPU6050 boards are sold on a GY-521 style carrier that includes supporting components to make I b2C wiring easy.

Front of an MPU6050 GY-521 breakout board with labeled I2C pins for Arduino wiring
A typical GY-521 carrier includes the MPU6050 plus supporting circuitry.
Back side of the MPU6050 breakout showing the sensor IC package used for Arduino motion sensing
The breakout makes the small QFN sensor package easy to use.

Expected result: You can clearly identify the four I b2C and power pins needed for the next step.

Step 2 - Wire the MPU6050 to the Arduino using I b2C

Goal: Connect power and the I b2C data lines so the Arduino can communicate with the sensor.

What to do: Make the four connections below, then double-check that SDA and SCL are not swapped.

MPU6050 wired to Arduino Nano over I2C with VCC, GND, SDA, and SCL connections
I b2C only needs four wires: VCC, GND, SDA, and SCL.
  • VCC d2 5 V (the on-board regulator drops it to 3.3 V)
  • GND d2 GND
  • SDA d2 A4 (Uno/Nano) / GPIO 21 (ESP32) / GPIO 4 (Pi Pico)
  • SCL d2 A5 (Uno/Nano) / GPIO 22 (ESP32) / GPIO 5 (Pi Pico)

Expected result: The MPU6050 is powered and connected to the Arduinos I b2C pins.

Step 3 - Install the library and upload the sketch

Goal: Load a known-good example that prints accelerometer and gyroscope readings.

What to do: In the Arduino IDE, open Library Manager and install Adafruit MPU6050. Then upload the following sketch to your board.

Code:

#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>

Adafruit_MPU6050 mpu;

void setup() {
  Serial.begin(115200);
  if (!mpu.begin()) {
    Serial.println("MPU6050 not found!");
    while (1) delay(10);
  }
  mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
  mpu.setGyroRange(MPU6050_RANGE_500_DEG);
  mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);
}

void loop() {
  sensors_event_t a, g, t;
  mpu.getEvent(&a, &g, &t);
  Serial.print("aX=");  Serial.print(a.acceleration.x, 2);
  Serial.print(" aY="); Serial.print(a.acceleration.y, 2);
  Serial.print(" aZ="); Serial.print(a.acceleration.z, 2);
  Serial.print(" | gX=");  Serial.print(g.gyro.x, 2);
  Serial.print(" gY="); Serial.print(g.gyro.y, 2);
  Serial.print(" gZ="); Serial.println(g.gyro.z, 2);
  delay(100);
}

Expected result: The sketch uploads successfully. If the sensor is not detected, the Serial output will show MPU6050 not found!.

Step 4 - View live accel and gyro data in Serial Monitor

Goal: Confirm the MPU6050 is reporting motion on all six axes.

What to do: Open the Serial Monitor at 115200 baud. Gently tilt and shake the sensor to see the accelerometer and gyroscope values change.

Arduino Serial Monitor displaying live MPU6050 accelerometer and gyroscope readings
Readings update at about 10 Hz based on the delay in the sketch.
MPU6050 axis direction diagram for interpreting X, Y, and Z accelerometer and gyroscope values
Use the printed axis convention to interpret which direction is X, Y, and Z.

Expected result: You see changing aX, aY, aZ and gX, gY, gZ values as the board moves.

Step 5 - Decide how to extend the project

Goal: Identify a next step that fits your application.

What to do: Choose an upgrade path based on your end goal:

  • Apply a complementary filter to fuse accel + gyro into pitch/roll
  • Build a self-balancing robot when paired with a motor driver
  • Stream over BLE to a phone and mirror motion into a game
  • Combine with an HX711 for industrial vibration logging

Expected result: You have a clear direction for building on top of the working sensor readout.

Conclusion

You wired an Arduino Nano to an MPU6050 6-axis IMU over I b2C and streamed live accelerometer and gyroscope data to the Serial Monitor. With reliable motion readings working, you can move on to filtering, orientation estimation, or real-world motion-controlled projects.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.

Credit: The MPU6050 photos and wiring diagrams used here are credited to Instructables.