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

How to Use MPU6050: Examples, Pinouts, and Specs

Image of MPU6050
Cirkit Designer LogoDesign with MPU6050 in Cirkit Designer

Introduction

The MPU6050 is a 6-axis motion tracking device that combines a 3-axis gyroscope and a 3-axis accelerometer on a single chip. This compact and versatile sensor is widely used in applications requiring motion sensing and orientation detection. Its ability to measure angular velocity and linear acceleration makes it ideal for robotics, drones, smartphones, gaming devices, and wearable technology. Additionally, the MPU6050 features a Digital Motion Processor (DMP) that can process complex motion algorithms internally, reducing the computational load on the host microcontroller.

Explore Projects Built with MPU6050

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 MPU6050 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 MPU6050 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 MPU6050 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-Based Motion Sensing System
Image of SENSORS LAB: A project utilizing MPU6050 in a practical application
This circuit interfaces an MPU6050 Accelerometer and Gyroscope with an Arduino UNO. The MPU6050 is powered by the Arduino's 3.3V and GND pins, and communicates with the Arduino via the I2C protocol using the SDA and SCL lines connected to the Arduino's A4 and A5 pins, respectively.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with MPU6050

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 MPU6050 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 MPU6050 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 MPU6050 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 SENSORS LAB: A project utilizing MPU6050 in a practical application
Arduino UNO and MPU6050-Based Motion Sensing System
This circuit interfaces an MPU6050 Accelerometer and Gyroscope with an Arduino UNO. The MPU6050 is powered by the Arduino's 3.3V and GND pins, and communicates with the Arduino via the I2C protocol using the SDA and SCL lines connected to the Arduino's A4 and A5 pins, respectively.
Cirkit Designer LogoOpen Project in Cirkit Designer

Technical Specifications

The following are the key technical details of the MPU6050:

  • Supply Voltage: 2.375V to 3.46V (typically 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: 4x4x0.9mm QFN

Pin Configuration and Descriptions

The MPU6050 has 8 pins, as described in the table below:

Pin Number Pin Name Description
1 VDD Power supply input (2.375V to 3.46V)
2 VLOGIC Logic voltage level input (1.8V to VDD)
3 GND Ground connection
4 SCL I2C clock input
5 SDA I2C data input/output
6 AD0 I2C address select (connect to GND for 0x68 or VDD for 0x69)
7 INT Interrupt output (active high, used for motion detection or data ready)
8 FSYNC Frame synchronization input (optional, used for external sync signals)

Usage Instructions

Connecting the MPU6050 to a Circuit

  1. Power Supply: Connect the VDD pin to a 3.3V power source and the GND pin to ground.
  2. Logic Level: If your microcontroller operates at 5V logic, use a level shifter for the I2C lines (SCL and SDA).
  3. I2C Communication: Connect the SCL and SDA pins to the corresponding I2C pins on your microcontroller. Pull-up resistors (typically 4.7kΩ) are required on the SCL and SDA lines.
  4. Address Selection: Connect the AD0 pin to GND for the default I2C address (0x68) or to VDD for an alternate address (0x69).
  5. Interrupt Pin: Optionally, connect the INT pin to a GPIO pin on your microcontroller to handle interrupts.

Example Code for Arduino UNO

Below is an example of how to interface the MPU6050 with an Arduino UNO using the Wire library:

#include <Wire.h>

// MPU6050 I2C address (default is 0x68 when AD0 is connected to GND)
const int MPU6050_ADDR = 0x68;

// MPU6050 register addresses
const int PWR_MGMT_1 = 0x6B; // Power management register
const int ACCEL_XOUT_H = 0x3B; // Accelerometer X-axis high byte

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

  // Wake up the MPU6050 (it starts in sleep mode)
  Wire.beginTransmission(MPU6050_ADDR);
  Wire.write(PWR_MGMT_1); // Access power management register
  Wire.write(0); // Set to 0 to wake up the sensor
  Wire.endTransmission();

  Serial.println("MPU6050 initialized");
}

void loop() {
  // Request accelerometer data
  Wire.beginTransmission(MPU6050_ADDR);
  Wire.write(ACCEL_XOUT_H); // Start reading from ACCEL_XOUT_H register
  Wire.endTransmission(false); // Send repeated start condition
  Wire.requestFrom(MPU6050_ADDR, 6); // Request 6 bytes (X, Y, Z high and low)

  if (Wire.available() == 6) {
    int16_t accelX = (Wire.read() << 8) | Wire.read(); // Combine high and low bytes
    int16_t accelY = (Wire.read() << 8) | Wire.read();
    int16_t accelZ = (Wire.read() << 8) | Wire.read();

    // Print accelerometer values
    Serial.print("Accel X: "); Serial.print(accelX);
    Serial.print(" | Accel Y: "); Serial.print(accelY);
    Serial.print(" | Accel Z: "); Serial.println(accelZ);
  }

  delay(500); // Wait 500ms before the next reading
}

Important Considerations

  • Power Supply: Ensure the MPU6050 is powered within its specified voltage range to avoid damage.
  • I2C Pull-Up Resistors: Use appropriate pull-up resistors on the SCL and SDA lines for reliable communication.
  • Mounting Orientation: Properly align the sensor on your PCB to ensure accurate motion readings.
  • Interrupts: Use the INT pin for applications requiring real-time motion detection or data-ready signals.

Troubleshooting and FAQs

Common Issues

  1. No I2C Communication:

    • Ensure the MPU6050 is powered correctly and the I2C lines have pull-up resistors.
    • Verify the I2C address (0x68 or 0x69) matches your configuration.
    • Check for loose or incorrect wiring.
  2. Incorrect or No Data:

    • Confirm the MPU6050 is initialized properly (e.g., wake-up command sent to PWR_MGMT_1).
    • Ensure the sensor is not in sleep mode.
  3. Unstable Readings:

    • Minimize vibrations and noise in the environment.
    • Use filtering techniques or the DMP for more stable data.

FAQs

Q: Can the MPU6050 be used with a 5V microcontroller?
A: Yes, but you must use a logic level shifter for the I2C lines (SCL and SDA) to avoid damaging the sensor.

Q: How do I calibrate the MPU6050?
A: Calibration involves determining and compensating for sensor offsets. This can be done by averaging readings when the sensor is stationary and subtracting the offsets from subsequent measurements.

Q: What is the purpose of the DMP?
A: The Digital Motion Processor (DMP) offloads complex motion processing tasks from the microcontroller, enabling features like sensor fusion and gesture recognition.

Q: Can I use the MPU6050 without the DMP?
A: Yes, you can directly read raw accelerometer and gyroscope data and process it in your microcontroller.