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

How to Use MPU6050 Accelerometer + Gyroscope (Wokwi Compatible): Examples, Pinouts, and Specs

Image of MPU6050 Accelerometer + Gyroscope (Wokwi Compatible)
Cirkit Designer LogoDesign with MPU6050 Accelerometer + Gyroscope (Wokwi Compatible) in Cirkit Designer

Introduction

The MPU6050 is a microelectromechanical system (MEMS) that combines a 3-axis accelerometer and a 3-axis gyroscope into one unit. This sensor is widely used in various applications such as motion tracking, gesture recognition, and robotics. Its compatibility with Wokwi, an online simulator for electronic projects, allows users to simulate and test their projects before actual hardware implementation.

Explore Projects Built with MPU6050 Accelerometer + Gyroscope (Wokwi Compatible)

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino UNO and MPU6050 Accelerometer-Gyroscope Sensor for Motion Tracking
Image of MPU-6050 sensor: A project utilizing MPU6050 Accelerometer + Gyroscope (Wokwi Compatible) 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
Arduino Nano and MPU6050 Based Gesture-Controlled Robotic Arm with Bluetooth Connectivity
Image of Copy of GLOVE ONLY FOR TOGGLE (1): A project utilizing MPU6050 Accelerometer + Gyroscope (Wokwi Compatible) in a practical application
This circuit features multiple MPU6050 accelerometer and gyroscope sensors interfaced with Arduino Nano microcontrollers, likely for capturing motion data. The Arduinos are programmed to read sensor data, calibrate input from potentiometers, and control LEDs. Communication with a Bluetooth module suggests wireless data transmission, possibly to a robotic arm or remote system, based on the motion and flex sensor inputs.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO and MPU6050 Accelerometer + Gyroscope Sensor for Motion Tracking
Image of MPU6050 Sim Test (Adafruit): A project utilizing MPU6050 Accelerometer + Gyroscope (Wokwi Compatible) in a practical application
This circuit interfaces an MPU6050 accelerometer and gyroscope sensor with an Arduino UNO via I2C communication. The Arduino UNO reads acceleration, gyroscope, and temperature data from the MPU6050 and outputs the readings to the serial monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO and MPU6050-Based Motion Sensing System
Image of SENSORS LAB: A project utilizing MPU6050 Accelerometer + Gyroscope (Wokwi Compatible) 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 Accelerometer + Gyroscope (Wokwi Compatible)

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 MPU-6050 sensor: A project utilizing MPU6050 Accelerometer + Gyroscope (Wokwi Compatible) 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
Image of Copy of GLOVE ONLY FOR TOGGLE (1): A project utilizing MPU6050 Accelerometer + Gyroscope (Wokwi Compatible) in a practical application
Arduino Nano and MPU6050 Based Gesture-Controlled Robotic Arm with Bluetooth Connectivity
This circuit features multiple MPU6050 accelerometer and gyroscope sensors interfaced with Arduino Nano microcontrollers, likely for capturing motion data. The Arduinos are programmed to read sensor data, calibrate input from potentiometers, and control LEDs. Communication with a Bluetooth module suggests wireless data transmission, possibly to a robotic arm or remote system, based on the motion and flex sensor inputs.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of MPU6050 Sim Test (Adafruit): A project utilizing MPU6050 Accelerometer + Gyroscope (Wokwi Compatible) in a practical application
Arduino UNO and MPU6050 Accelerometer + Gyroscope Sensor for Motion Tracking
This circuit interfaces an MPU6050 accelerometer and gyroscope sensor with an Arduino UNO via I2C communication. The Arduino UNO reads acceleration, gyroscope, and temperature data from the MPU6050 and outputs the readings to the serial monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of SENSORS LAB: A project utilizing MPU6050 Accelerometer + Gyroscope (Wokwi Compatible) 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 Technical Details

  • Voltage: 2.3V to 3.4V
  • Current: 3.9mA
  • Operating Temperature Range: -40 to +85°C
  • Sensitivity (Accelerometer): ±2g/±4g/±8g/±16g (programmable)
  • Sensitivity (Gyroscope): ±250°/s, ±500°/s, ±1000°/s, ±2000°/s (programmable)
  • Communication: I2C protocol
  • Digital Output: 16-bit analog-to-digital conversion for each channel
  • FIFO Buffer: 1024 byte

Pin Configuration and Descriptions

Pin Name Description
VCC Power supply (2.3V to 3.4V)
GND Ground
SCL Serial Clock Line for I2C communication
SDA Serial Data Line for I2C communication
XDA Auxiliary Data I2C Serial Data Line
XCL Auxiliary Data I2C Serial Clock Line
AD0 I2C Address Select
INT Interrupt Output

Usage Instructions

Integration into a Circuit

  1. Connect the VCC pin to the 3.3V output on your microcontroller.
  2. Connect the GND pin to the ground on your microcontroller.
  3. Connect the SCL and SDA pins to the corresponding I2C pins on your microcontroller.
  4. If using the interrupt feature, connect the INT pin to an external interrupt pin on your microcontroller.
  5. If using the auxiliary I2C bus, connect XDA and XCL to the auxiliary devices.

Important Considerations and Best Practices

  • Ensure that the power supply is stable and within the specified voltage range.
  • Use pull-up resistors on the SCL and SDA lines if they are not provided by the microcontroller.
  • When using the sensor with a 5V microcontroller, use a level shifter for the SDA and SCL lines to avoid damaging the sensor.
  • To minimize noise, keep the sensor away from motors and other sources of EMI.
  • For accurate readings, calibrate the sensor for your specific application environment.

Example Code for Arduino UNO

#include <Wire.h>
#include <MPU6050.h>

MPU6050 mpu;

void setup() {
  Wire.begin();
  Serial.begin(9600);
  mpu.initialize();
  if (!mpu.testConnection()) {
    Serial.println("MPU6050 connection failed");
    while (1);
  }
  Serial.println("MPU6050 connection successful");
}

void loop() {
  mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
  
  // Print acceleration values in m/s^2
  Serial.print("aX = "); Serial.print(ax/16384.0); Serial.print(" | ");
  Serial.print("aY = "); Serial.print(ay/16384.0); Serial.print(" | ");
  Serial.print("aZ = "); Serial.println(az/16384.0);
  
  // Print gyroscope values in degrees/s
  Serial.print("gX = "); Serial.print(gx/131.0); Serial.print(" | ");
  Serial.print("gY = "); Serial.print(gy/131.0); Serial.print(" | ");
  Serial.print("gZ = "); Serial.println(gz/131.0);
  
  delay(1000);
}

Troubleshooting and FAQs

Common Issues

  • Sensor not responding: Check connections and ensure the correct I2C address is used.
  • Inaccurate readings: Calibrate the sensor and ensure it's not affected by EMI.
  • No data on serial monitor: Verify baud rate and ensure the Arduino IDE's serial monitor is configured correctly.

Solutions and Tips for Troubleshooting

  • Use the I2C scanner sketch to confirm the device's address and connectivity.
  • Reset the MPU6050 and microcontroller to clear any configuration issues.
  • Check for soldering issues on the MPU6050 pins if using a breakout board.

FAQs

Q: Can the MPU6050 be used with a 5V microcontroller? A: Yes, but ensure that the I2C lines are level-shifted to protect the MPU6050.

Q: How can I change the sensitivity of the accelerometer or gyroscope? A: Use the library functions 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 LSB of the I2C address, allowing for two MPU6050s on the same bus.