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 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.

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
ESP32-Based Accident Detection and GPS Tracking System with GSM Notifications
Image of hello: A project utilizing MPU 6050 in a practical application
This circuit features an ESP32 microcontroller interfaced with an MPU6050 accelerometer/gyroscope, a Neo 6M GPS module, and a SIM800L GSM module. The ESP32 communicates with the MPU6050 via I2C (SCL and SDA lines) to detect potential accidents based on acceleration thresholds, with the GPS module providing location data via a serial connection (RX0 and TX0). The SIM800L GSM module is connected to the ESP32 through another serial interface (RX2 and TX2) to send SMS alerts with location information in case of an accident detection.
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 hello: A project utilizing MPU 6050 in a practical application
ESP32-Based Accident Detection and GPS Tracking System with GSM Notifications
This circuit features an ESP32 microcontroller interfaced with an MPU6050 accelerometer/gyroscope, a Neo 6M GPS module, and a SIM800L GSM module. The ESP32 communicates with the MPU6050 via I2C (SCL and SDA lines) to detect potential accidents based on acceleration thresholds, with the GPS module providing location data via a serial connection (RX0 and TX0). The SIM800L GSM module is connected to the ESP32 through another serial interface (RX2 and TX2) to send SMS alerts with location information in case of an accident detection.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications:

  • Robotics for motion control and navigation
  • Drones for stabilization and orientation
  • Smartphones for gesture recognition and screen rotation
  • Gaming devices for motion-based controls
  • Wearable devices for fitness tracking and activity monitoring

Technical Specifications

The MPU 6050 is a highly integrated device with the following key specifications:

Parameter Value
Supply Voltage 2.375V to 3.46V
Logic Voltage Level 1.8V to VDD
Gyroscope Range ±250, ±500, ±1000, ±2000 °/s
Accelerometer Range ±2g, ±4g, ±8g, ±16g
Communication Interface I2C (up to 400kHz)
Operating Temperature -40°C to +85°C
Power Consumption 3.9mA (typical)
Package 4x4x0.9mm QFN

Pin Configuration and Descriptions

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

Pin Name Description
1 VDD Power supply input (2.375V to 3.46V).
2 VLOGIC Logic voltage input (1.8V to VDD).
3 GND Ground connection.
4 SCL I2C clock line. Connect to the microcontroller's I2C clock pin.
5 SDA I2C data line. Connect to the microcontroller's I2C data pin.
6 AD0 I2C address select. Connect to GND (address 0x68) or VDD (address 0x69).
7 INT Interrupt output. Can be used to signal data availability or motion detection.
8 RESV Reserved. Leave unconnected.

Usage Instructions

How to Use the MPU 6050 in a Circuit

  1. Power Supply: Connect the VDD pin to a 3.3V power source and the GND pin to ground. If your microcontroller operates at 5V logic, use a level shifter for the I2C lines.
  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 both lines.
  3. Address Selection: Set the AD0 pin to GND for the default I2C address (0x68) or to VDD for the alternate address (0x69).
  4. Interrupt Pin: Optionally, connect the INT pin to a digital input on your microcontroller to handle interrupts.

Important Considerations and Best Practices

  • Use decoupling capacitors (e.g., 0.1µF) near the VDD pin to reduce noise.
  • Ensure proper pull-up resistors are used on the I2C lines for reliable communication.
  • Avoid excessive vibrations or shocks to the sensor, as they may affect accuracy.
  • Calibrate the sensor for your specific application to improve measurement 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); // Start 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 sensor
  Wire.endTransmission();
}

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

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

  // Skip temperature data (2 bytes)
  Wire.read();
  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); // Wait for 500ms before the next reading
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Data or Incorrect Readings:

    • Ensure the MPU 6050 is properly powered and connected to the microcontroller.
    • Verify the I2C address (0x68 or 0x69) matches your configuration.
    • Check for proper pull-up resistors on the I2C lines.
  2. I2C Communication Errors:

    • Confirm the SCL and SDA lines are correctly connected.
    • Use a logic level shifter if your microcontroller operates at 5V logic.
  3. Inconsistent or Noisy Data:

    • Calibrate the sensor to account for offsets and scaling factors.
    • Minimize vibrations and external interference.
  4. Interrupt Pin Not Working:

    • Ensure the INT pin is connected to a digital input on the microcontroller.
    • Configure the interrupt settings in the MPU 6050 registers.

FAQs

Q: Can the MPU 6050 be used with a 5V microcontroller?
A: Yes, but you must use a logic level shifter for the I2C lines, as the MPU 6050 operates at 3.3V logic.

Q: How do I calibrate the MPU 6050?
A: Calibration involves determining and compensating for offsets in the accelerometer and gyroscope readings. This can be done in software by averaging multiple readings when the sensor is stationary.

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

Q: Can I use the MPU 6050 for tilt detection?
A: Yes, the accelerometer data can be used to calculate tilt angles relative to the Earth's gravity.