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 highly popular microelectromechanical systems (MEMS) sensor module that combines a 3-axis gyroscope and a 3-axis accelerometer. It measures motion in 6 degrees of freedom (6DoF), which makes it ideal for a wide range of applications including robotics, motion detection, and inertial measurement units (IMUs) for drones and other vehicles.

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

Key Features

  • Gyroscope range: ±250, ±500, ±1000, ±2000 degrees/sec
  • Accelerometer range: ±2g, ±4g, ±8g, ±16g
  • Supply voltage: 2.3V to 3.4V
  • Interface: I2C
  • Digital-output temperature sensor
  • Programmable interrupt
  • Built-in 16-bit ADCs for digitizing the gyroscope and accelerometer outputs

Pin Configuration

Pin Number Name Description
1 VCC Power supply (2.3V to 3.4V)
2 GND Ground
3 SCL I2C clock line
4 SDA I2C data line
5 XDA Auxiliary I2C data (optional)
6 XCL Auxiliary I2C clock (optional)
7 AD0 I2C address select (low: 0x68, high: 0x69)
8 INT Interrupt output

Usage Instructions

Integration with a Circuit

To use the MPU-6050 in a circuit:

  1. Connect VCC to a 2.3V to 3.4V power supply.
  2. Connect GND to the ground of the power supply.
  3. Connect SCL and SDA to the I2C clock and data lines, respectively.
  4. If using the auxiliary I2C bus, connect XDA and XCL accordingly.
  5. Set the AD0 pin to high or low to select the I2C address.
  6. The INT pin can be connected to an interrupt-capable GPIO on a microcontroller to handle sensor interrupts.

Best Practices

  • Use pull-up resistors on the I2C lines (typically 4.7kΩ to 10kΩ).
  • Ensure that the power supply is stable and within the specified voltage range.
  • Avoid physical shocks and vibrations that could affect sensor readings.
  • Calibrate the sensor for accurate measurements.

Example Code for Arduino UNO

#include <Wire.h>

// MPU-6050 I2C address (AD0 pin low)
const int MPU_ADDR = 0x68;

void setup() {
  Wire.begin(); // Initialize I2C communication
  Serial.begin(9600); // Start serial communication at 9600 baud
  Wire.beginTransmission(MPU_ADDR);
  Wire.write(0x6B); // PWR_MGMT_1 register
  Wire.write(0); // Set to zero to wake up the MPU-6050
  Wire.endTransmission(true);
}

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

  // Read accelerometer and gyroscope data
  // Each value is a 16-bit signed integer (high byte first)
  int16_t accX = Wire.read() << 8 | Wire.read();
  int16_t accY = Wire.read() << 8 | Wire.read();
  int16_t accZ = Wire.read() << 8 | Wire.read();
  int16_t temp = Wire.read() << 8 | Wire.read();
  int16_t gyroX = Wire.read() << 8 | Wire.read();
  int16_t gyroY = Wire.read() << 8 | Wire.read();
  int16_t gyroZ = Wire.read() << 8 | Wire.read();

  // Print the sensor values
  Serial.print("Accelerometer: ");
  Serial.print("X = "); Serial.print(accX);
  Serial.print(" | Y = "); Serial.print(accY);
  Serial.print(" | Z = "); Serial.println(accZ);

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

  // Print the temperature (in degrees Celsius)
  Serial.print("Temperature: ");
  Serial.print((temp / 340.00) + 36.53); // Formula from datasheet
  Serial.println(" C");

  delay(1000); // Delay a second for next reading
}

Troubleshooting and FAQs

Common Issues

  • Inaccurate Readings: Ensure the sensor is calibrated properly. Avoid any vibrations or movements that are not part of the intended measurement.
  • No Data on Serial Monitor: Check the wiring, especially the I2C connections. Ensure the correct I2C address is used in the code.
  • Sensor Not Detected: Verify that the power supply is within the specified range and that the MPU-6050 is correctly powered.

FAQs

Q: Can the MPU-6050 be used with a 5V microcontroller like Arduino UNO? A: Yes, but ensure that the VCC is connected to a 3.3V output and use a level shifter or voltage divider for the SDA and SCL lines.

Q: How can I change the sensitivity of the accelerometer or gyroscope? A: You can write to the accelerometer and gyroscope configuration registers to set the desired full-scale range.

Q: What is the purpose of the AD0 pin? A: The AD0 pin is used to set the least significant bit (LSB) of the I2C address. This allows for two MPU-6050 sensors on the same I2C bus with different addresses.

Q: How do I calibrate the MPU-6050? A: Calibration involves taking multiple readings while the sensor is stationary and averaging them out to determine offsets. These offsets are then used to adjust the readings in the code.

This documentation provides an overview of the MPU-6050 sensor module, its technical specifications, usage instructions, example code for Arduino UNO, and troubleshooting tips. For more detailed information, refer to the manufacturer's datasheet and application notes.