Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use MPU-6050: Examples, Pinouts, and Specs

Image of MPU-6050
Cirkit Designer LogoDesign with MPU-6050 in Cirkit Designer

Introduction

The MPU-6050 is a 6-axis motion tracking device manufactured by MPU, with the part ID 6050. It integrates a 3-axis gyroscope and a 3-axis accelerometer into a single chip, making it a compact and versatile solution for motion sensing and orientation detection. The device is widely used in applications such as robotics, drones, smartphones, gaming devices, and wearable technology. Its ability to measure angular velocity and linear acceleration makes it ideal for projects requiring precise motion tracking and stabilization.

Explore Projects Built with MPU-6050

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
ESP32-Controlled Multi-MPU6050 and MPU9250 IMU Data Aggregator
Image of gant vr: A project utilizing MPU-6050 in a practical application
This circuit features an ESP32 microcontroller interfaced with multiple MPU-6050 sensors and a single MPU-9250 sensor through an Adafruit TCA9548A I2C multiplexer, allowing for the reading of multiple inertial measurement units (IMUs) over the same I2C bus. The ESP32 collects and processes acceleration and gyroscopic data from the sensors to calculate angles in the X and Y axes. Power management is handled by a TP4056 charging module and an AMS1117 voltage regulator, which together with two 18650 Li-ion batteries, provide a stable power supply for the microcontroller and sensors.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO and MPU-6050 Based Motion Sensing System
Image of mi: A project utilizing MPU-6050 in a practical application
This circuit uses an Arduino UNO to interface with an MPU-6050 accelerometer and gyroscope sensor. The Arduino reads motion data from the MPU-6050 via I2C communication and outputs the processed data to the serial monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO and MPU-6050 Based Motion Sensing System with I2C Interface
Image of mpu6050new: A project utilizing MPU-6050 in a practical application
This circuit features an Arduino UNO connected to an MPU-6050 accelerometer and gyroscope sensor via an I2C module. The Arduino UNO provides power to the sensor and communicates with it using the I2C protocol, enabling the collection of motion and orientation data.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO and MPU6050 Accelerometer-Gyroscope Sensor for Motion Tracking
Image of MPU-6050 sensor: A project utilizing MPU-6050 in a practical application
This circuit consists of an Arduino UNO microcontroller connected to an MPU6050 accelerometer and gyroscope sensor. The Arduino reads acceleration and gyroscopic data from the MPU6050 via the I2C interface and outputs the sensor readings to the serial monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with MPU-6050

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of gant vr: A project utilizing MPU-6050 in a practical application
ESP32-Controlled Multi-MPU6050 and MPU9250 IMU Data Aggregator
This circuit features an ESP32 microcontroller interfaced with multiple MPU-6050 sensors and a single MPU-9250 sensor through an Adafruit TCA9548A I2C multiplexer, allowing for the reading of multiple inertial measurement units (IMUs) over the same I2C bus. The ESP32 collects and processes acceleration and gyroscopic data from the sensors to calculate angles in the X and Y axes. Power management is handled by a TP4056 charging module and an AMS1117 voltage regulator, which together with two 18650 Li-ion batteries, provide a stable power supply for the microcontroller and sensors.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of mi: A project utilizing MPU-6050 in a practical application
Arduino UNO and MPU-6050 Based Motion Sensing System
This circuit uses an Arduino UNO to interface with an MPU-6050 accelerometer and gyroscope sensor. The Arduino reads motion data from the MPU-6050 via I2C communication and outputs the processed data to the serial monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of mpu6050new: A project utilizing MPU-6050 in a practical application
Arduino UNO and MPU-6050 Based Motion Sensing System with I2C Interface
This circuit features an Arduino UNO connected to an MPU-6050 accelerometer and gyroscope sensor via an I2C module. The Arduino UNO provides power to the sensor and communicates with it using the I2C protocol, enabling the collection of motion and orientation data.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of MPU-6050 sensor: A project utilizing MPU-6050 in a practical application
Arduino UNO and MPU6050 Accelerometer-Gyroscope Sensor for Motion Tracking
This circuit consists of an Arduino UNO microcontroller connected to an MPU6050 accelerometer and gyroscope sensor. The Arduino reads acceleration and gyroscopic data from the MPU6050 via the I2C interface and outputs the sensor readings to the serial monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer

Technical Specifications

The following are the key technical details of the MPU-6050:

  • Manufacturer: MPU
  • Part ID: 6050
  • Supply Voltage: 2.375V to 3.46V (typical 3.3V)
  • Communication Interface: I2C (up to 400kHz)
  • Gyroscope Range: ±250, ±500, ±1000, ±2000 degrees/second
  • Accelerometer Range: ±2g, ±4g, ±8g, ±16g
  • Operating Temperature: -40°C to +85°C
  • Power Consumption: 3.9mA (typical) in active mode
  • Package: 24-pin QFN

Pin Configuration and Descriptions

The MPU-6050 has 24 pins, but the most commonly used pins for basic operation are listed below:

Pin Name Pin Number Description
VDD 1 Power supply input (2.375V to 3.46V).
GND 2 Ground connection.
SCL 6 I2C clock line. Used for communication with the microcontroller.
SDA 7 I2C data line. Used for communication with the microcontroller.
AD0 9 I2C address select. Connect to GND for address 0x68 or VDD for address 0x69.
INT 12 Interrupt output. Signals when data is ready or an event occurs.
FSYNC 10 Frame synchronization input. Optional for advanced synchronization features.

For a complete pinout, refer to the MPU-6050 datasheet.

Usage Instructions

How to Use the MPU-6050 in a Circuit

  1. Power the Device: Connect the VDD pin to a 3.3V power source and the GND pin to ground.
  2. I2C Communication: Connect the SCL and SDA pins to the corresponding I2C pins on your microcontroller. Use pull-up resistors (typically 4.7kΩ) on the SCL and SDA lines if not already present.
  3. Address Selection: Set the I2C address by connecting the AD0 pin to GND (address 0x68) or VDD (address 0x69).
  4. Interrupts (Optional): Connect the INT pin to a digital input pin on your microcontroller if you want to use interrupt-driven data handling.
  5. Initialize the Device: Use your microcontroller to configure the MPU-6050 registers via I2C. This includes setting the gyroscope and accelerometer ranges, enabling interrupts, and configuring the sampling rate.

Important Considerations and Best Practices

  • Power Supply: Ensure a stable 3.3V power supply to avoid erratic behavior.
  • Bypass Capacitor: Place a 0.1µF ceramic capacitor close to the VDD pin for noise filtering.
  • I2C Pull-Up Resistors: Verify that pull-up resistors are present on the I2C lines to ensure proper communication.
  • Mounting Orientation: Mount the MPU-6050 on your PCB in the correct orientation to match your application's coordinate system.
  • Calibration: Perform gyroscope and accelerometer calibration to improve accuracy.

Example Code for Arduino UNO

Below is an example of how to interface the MPU-6050 with an Arduino UNO using the I2C protocol:

#include <Wire.h>

// MPU-6050 I2C address (default is 0x68 when AD0 is connected to GND)
const int MPU_ADDR = 0x68;

// Variables to store raw accelerometer and gyroscope data
int16_t accelX, accelY, accelZ;
int16_t gyroX, gyroY, gyroZ;

void setup() {
  Wire.begin(); // Initialize I2C communication
  Serial.begin(9600); // Initialize serial communication for debugging

  // Wake up the MPU-6050 (it starts in sleep mode)
  Wire.beginTransmission(MPU_ADDR);
  Wire.write(0x6B); // Access the power management register
  Wire.write(0);    // Set to 0 to wake up the MPU-6050
  Wire.endTransmission();
}

void loop() {
  // Request 14 bytes of data from the MPU-6050
  Wire.beginTransmission(MPU_ADDR);
  Wire.write(0x3B); // Starting register for accelerometer data
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_ADDR, 14, true);

  // Read accelerometer data
  accelX = Wire.read() << 8 | Wire.read();
  accelY = Wire.read() << 8 | Wire.read();
  accelZ = Wire.read() << 8 | Wire.read();

  // Read gyroscope data
  gyroX = Wire.read() << 8 | Wire.read();
  gyroY = Wire.read() << 8 | Wire.read();
  gyroZ = Wire.read() << 8 | Wire.read();

  // Print the data to the Serial Monitor
  Serial.print("Accel X: "); Serial.print(accelX);
  Serial.print(" | Accel Y: "); Serial.print(accelY);
  Serial.print(" | Accel Z: "); Serial.println(accelZ);

  Serial.print("Gyro X: "); Serial.print(gyroX);
  Serial.print(" | Gyro Y: "); Serial.print(gyroY);
  Serial.print(" | Gyro Z: "); Serial.println(gyroZ);

  delay(500); // Delay for readability
}

Troubleshooting and FAQs

Common Issues

  1. No Data from MPU-6050:

    • Cause: Incorrect I2C address or wiring.
    • Solution: Verify the AD0 pin connection and ensure the correct I2C address is used in your code. Check the SCL and SDA connections.
  2. Erratic or Noisy Readings:

    • Cause: Lack of calibration or unstable power supply.
    • Solution: Perform gyroscope and accelerometer calibration. Use a stable 3.3V power source and add a bypass capacitor near the VDD pin.
  3. I2C Communication Failure:

    • Cause: Missing pull-up resistors on the I2C lines.
    • Solution: Add 4.7kΩ pull-up resistors to the SCL and SDA lines.

FAQs

  • Q: Can the MPU-6050 operate at 5V?
    A: No, the MPU-6050 requires a supply voltage between 2.375V and 3.46V. Use a voltage regulator if your system operates at 5V.

  • Q: How do I calibrate the MPU-6050?
    A: Calibration involves reading the raw sensor data when the device is stationary and calculating offsets for the gyroscope and accelerometer. These offsets can then be subtracted from subsequent readings.

  • Q: What is the maximum sampling rate of the MPU-6050?
    A: The maximum sampling rate is 1kHz for both the gyroscope and accelerometer.

By following this documentation, you can effectively integrate the MPU-6050 into your projects and troubleshoot common issues.