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 versatile and powerful 6-axis motion tracking device that combines a 3-axis gyroscope, 3-axis accelerometer, and a temperature sensor. This microelectromechanical system (MEMS) is widely used in various applications, including drones, robotics, gaming devices, and virtual reality systems, to detect and measure motion, orientation, and acceleration.

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

Key Features

  • Gyroscope Range: ±250, ±500, ±1000, ±2000 degrees/sec
  • Accelerometer Range: ±2g, ±4g, ±8g, ±16g
  • Supply Voltage: 2.3V to 3.4V
  • Digital Output: I2C
  • Built-in 16-bit Analog to Digital Converters
  • Built-in Digital Motion Processor™ (DMP)
  • Operating Temperature Range: -40°C to +85°C

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 line (optional)
6 XCL Auxiliary I2C clock line (optional)
7 AD0 I2C address selection pin
8 INT Interrupt output

Usage Instructions

Integration with a Circuit

  1. Connect the VCC pin to a 3.3V supply from your microcontroller board.
  2. Connect the GND pin to the ground of your microcontroller board.
  3. Connect the SCL and SDA pins to the I2C clock and data lines on your microcontroller.
  4. If using the auxiliary I2C bus, connect XDA and XCL to the respective lines.
  5. The AD0 pin can be used to change the I2C address if multiple devices are used.
  6. The INT pin can be connected to an interrupt pin on your microcontroller to handle motion detection 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.
  • When using multiple MPU6050s, make sure to set different I2C addresses by configuring the AD0 pin.

Example Code for Arduino UNO

#include <Wire.h>

// MPU6050 I2C address (AD0 pin low is 0x68, high is 0x69)
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); // Write to the power management register
  Wire.write(0); // Set to zero to wake the MPU6050
  Wire.endTransmission(true);
}

void loop() {
  Wire.beginTransmission(MPU_ADDR);
  Wire.write(0x3B); // Start with register 0x3B (ACCEL_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_ADDR, 14, true); // Request 14 registers
  
  // Read accelerometer and gyroscope values
  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 out the 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);
  
  Serial.print("Temperature: ");
  Serial.println(temp / 340.00 + 36.53); // Calculate and print temperature
  
  delay(1000); // Delay for readability
}

Troubleshooting and FAQs

Common Issues

  • No data from the sensor: Ensure that the I2C connections are correct and that the MPU6050 is powered.
  • Inaccurate readings: Calibrate the sensor by taking multiple readings at a known orientation and adjusting the offsets.
  • I2C communication errors: Check for proper pull-up resistors and that no other device on the bus is causing conflicts.

FAQs

Q: How do I change the I2C address of the MPU6050? A: The I2C address can be changed by altering the logic level of the AD0 pin. If AD0 is low (connected to GND), the address is 0x68. If high (connected to VCC), the address is 0x69.

Q: Can the MPU6050 be used with a 5V microcontroller? A: Yes, but a level shifter is recommended for the I2C lines, and the VCC should be supplied with 3.3V.

Q: How can I reduce noise in the sensor readings? A: Implementing a digital low-pass filter or a complementary filter can help reduce noise. Additionally, ensure the MPU6050 is mounted securely without vibrations.

This documentation provides a comprehensive guide to integrating and using the MPU6050 sensor with an Arduino UNO. For further assistance or advanced applications, refer to the manufacturer's datasheet and additional resources.