Stufin
Home Quick Cart Profile

MPU-6050 Triple-Axis Accelerometer & Gyroscope Module

Buy Now on Stufin

Acceleration

Measures the acceleration of the object in three axes (x, y, z) with a range of 2g, 4g, 8g, or 16g.

Angular Rate

Measures the angular rate of the object in three axes (x, y, z) with a range of 250/s, 500/s, 1000/s, or 2000/s.

The module is capable of operating in various modes, including
Low-Power ModeReduces power consumption while maintaining the accuracy of the measurements.
High-Dynamic Range ModeEnables the module to measure acceleration and angular rates over a wider range.

Key Features

  • High Accuracy: Provides accurate measurements with a high resolution of 16 bits for acceleration and 16 bits for angular rate.
  • Low Noise: Features a low noise density of 0.3 mg/Hz for acceleration and 0.01 /s/Hz for angular rate.
  • Low Power Consumption: Operates at a low current consumption of 3.6 mA (typical) and 1.5 mA (sleep mode).
  • Digital Output: Provides a digital output through the I2C or SPI interface, allowing for easy communication with microcontrollers and other devices.
  • Compact Design: Measuring only 4 mm x 4 mm x 0.95 mm, the module is suitable for use in space-constrained applications.
  • Operating Temperature Range: Operates over a wide temperature range of -40C to 85C.
  • RoHS Compliant: Meets the Restriction of Hazardous Substances (RoHS) directive, making it an environmentally friendly component.

Applications

The MPU-6050 Triple-Axis Accelerometer & Gyroscope Module is suitable for various applications, including

Robotics

Enhances the stability and balance of robots, allowing them to move and maneuver with precision.

Drones

Provides accurate motion sensing and orientation data for drone stabilization and navigation.

Wearables

Enables the creation of wearable devices that track movement, orientation, and activities.

Gaming

Enhances gaming experiences with motion sensing and gesture recognition capabilities.

Industrial Automation

Monitors and controls the motion of industrial equipment and machinery.

Pinout and Dimensions

The MPU-6050 module has a 24-pin QFN package with the following pinout

VDD

Power supply pin (1.8V to 3.6V)

GND

Ground pin

SCL

I2C clock pin

SDA

I2C data pin

INT

Interrupt pin

AD0I2C address pin

FS

Full-scale range select pin

XDA, XDB, YDA, YDB, ZDA, ZDBAnalog output pins
V_logicLogic voltage pin (1.8V to 3.6V)

Length

4 mm

Width

4 mm

Height

0.95 mm

Conclusion

The MPU-6050 Triple-Axis Accelerometer & Gyroscope Module is a versatile and high-performance component suitable for various applications that require motion sensing, orientation, and balance detection. Its compact design, low power consumption, and high accuracy make it an ideal choice for developers and engineers working on IoT, robotics, and wearable devices projects.

Pin Configuration

  • MPU-6050 Triple-Axis Accelerometer & Gyroscope Module Pinout
  • The MPU-6050 is a popular and widely used IoT component that combines a triple-axis accelerometer and a triple-axis gyroscope in a single module. It is commonly used in robotics, drones, and other applications that require motion sensing and tracking. The module has a total of 8 pins, which are explained below:
  • Pin 1: VCC (Power Supply)
  • Function: Power supply pin
  • Type: Input
  • Description: Connect to a 3.3V or 5V power supply. The MPU-6050 module operates at a voltage range of 2.375V to 3.46V, but it is recommended to use a 3.3V or 5V power supply for optimal performance.
  • Pin 2: GND (Ground)
  • Function: Ground pin
  • Type: Input
  • Description: Connect to the ground of the power supply or the ground of the microcontroller.
  • Pin 3: SCL (Serial Clock)
  • Function: I2C serial clock pin
  • Type: Input
  • Description: Connect to the SCL pin of the microcontroller or other I2C devices. The SCL pin is used to generate the clock signal for I2C communication.
  • Pin 4: SDA (Serial Data)
  • Function: I2C serial data pin
  • Type: Input/Output
  • Description: Connect to the SDA pin of the microcontroller or other I2C devices. The SDA pin is used to transmit and receive data between the MPU-6050 and other I2C devices.
  • Pin 5: XDA (Accelerometer X-axis Output)
  • Function: Analog output pin for accelerometer X-axis data
  • Type: Output
  • Description: This pin outputs an analog signal proportional to the acceleration on the X-axis. The output voltage range is 0V to VCC.
  • Pin 6: XGY (Gyroscope X-axis Output)
  • Function: Analog output pin for gyroscope X-axis data
  • Type: Output
  • Description: This pin outputs an analog signal proportional to the angular velocity on the X-axis. The output voltage range is 0V to VCC.
  • Pin 7: YDA (Accelerometer Y-axis Output)
  • Function: Analog output pin for accelerometer Y-axis data
  • Type: Output
  • Description: This pin outputs an analog signal proportional to the acceleration on the Y-axis. The output voltage range is 0V to VCC.
  • Pin 8: YGY (Gyroscope Y-axis Output)
  • Function: Analog output pin for gyroscope Y-axis data
  • Type: Output
  • Description: This pin outputs an analog signal proportional to the angular velocity on the Y-axis. The output voltage range is 0V to VCC.
  • Connecting the Pins:
  • To connect the MPU-6050 module to a microcontroller or other I2C devices, follow these steps:
  • 1. Connect the VCC pin to a 3.3V or 5V power supply.
  • 2. Connect the GND pin to the ground of the power supply or the ground of the microcontroller.
  • 3. Connect the SCL pin to the SCL pin of the microcontroller or other I2C devices.
  • 4. Connect the SDA pin to the SDA pin of the microcontroller or other I2C devices.
  • 5. Connect the XDA, XGY, YDA, and YGY pins to analog-to-digital converter (ADC) pins on the microcontroller or other compatible devices.
  • Note: The MPU-6050 module can also be used with a breadboard or PCB. Make sure to follow the recommended pinout and connection diagram to avoid damage to the module or other components.

Code Examples

MPU-6050 Triple-Axis Accelerometer & Gyroscope Module Documentation
Overview
The MPU-6050 is a popular, low-power, and high-performance triple-axis accelerometer and gyroscope module. It combines a 3-axis accelerometer and a 3-axis gyroscope in a single chip, providing accurate measurements of acceleration, roll, pitch, and yaw. This module is widely used in various IoT applications, such as robotics, drones, wearable devices, and gaming consoles.
Pinout and Connections
The MPU-6050 module typically has 8 pins:
VCC: Power supply (3.3V or 5V)
 GND: Ground
 SCL: I2C clock
 SDA: I2C data
 XDA: Accelerometer data (optional)
 XCL: Accelerometer clock (optional)
 AD0: I2C address selection (optional)
 INT: Interrupt output (optional)
Code Examples
### Example 1: Basic Accelerometer and Gyroscope Readings using Arduino
This example demonstrates how to read the accelerometer and gyroscope values using the MPU-6050 library in Arduino.
```c
#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
void setup() {
  Serial.begin(115200);
  Wire.begin();
  mpu.begin();
  mpu.setAccelerometerRange(MPU6050_RANGE_2G);
  mpu.setGyroRange(MPU6050_RANGE_250DEG);
  mpu.setDLPFMode(MPU6050_DLPF_5HZ);
}
void loop() {
  int16_t ax, ay, az;
  int16_t gx, gy, gz;
mpu.getAcceleration(&ax, &ay, &az);
  mpu.getRotation(&gx, &gy, &gz);
Serial.print("Acceleration (g): ");
  Serial.print(ax / 16384.0);
  Serial.print(", ");
  Serial.print(ay / 16384.0);
  Serial.print(", ");
  Serial.println(az / 16384.0);
Serial.print("Gyro (deg/s): ");
  Serial.print(gx / 131.0);
  Serial.print(", ");
  Serial.print(gy / 131.0);
  Serial.print(", ");
  Serial.println(gz / 131.0);
delay(50);
}
```
### Example 2: Orientation Calculation using Python and Raspberry Pi
This example demonstrates how to calculate the orientation of the MPU-6050 module using Python and Raspberry Pi.
```python
import smbus
import math
# I2C bus and address
bus = smbus.SMBus(1)
address = 0x68
# Accelerometer and gyroscope scale factors
accel_scale = 32768.0
gyro_scale = 131.0
# Function to read accelerometer and gyroscope values
def read_mpu():
    data = bus.read_i2c_block_data(address, 0x3B, 14)
    ax = (data[0] << 8) | data[1]
    ay = (data[2] << 8) | data[3]
    az = (data[4] << 8) | data[5]
    gx = (data[8] << 8) | data[9]
    gy = (data[10] << 8) | data[11]
    gz = (data[12] << 8) | data[13]
    return ax, ay, az, gx, gy, gz
# Function to calculate orientation
def calculate_orientation(ax, ay, az, gx, gy, gz):
    roll = math.atan2(ay, az)
    pitch = math.atan2(-ax, math.sqrt(ay  2 + az  2))
    yaw = math.atan2(gz, gy)
    return roll, pitch, yaw
while True:
    ax, ay, az, gx, gy, gz = read_mpu()
    roll, pitch, yaw = calculate_orientation(ax / accel_scale, ay / accel_scale, az / accel_scale,
                                               gx / gyro_scale, gy / gyro_scale, gz / gyro_scale)
    print("Roll: {:.2f}, Pitch: {:.2f}, Yaw: {:.2f}".format(math.degrees(roll), math.degrees(pitch), math.degrees(yaw)))
    time.sleep(0.1)
```
### Example 3: Gesture Recognition using ESP32 and MicroPython
This example demonstrates how to use the MPU-6050 module to recognize gestures using the ESP32 board and MicroPython.
```python
import machine
import utime
from mpu6050 import MPU6050
# I2C bus and address
i2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(21), freq=400000)
mpu = MPU6050(i2c, address=0x68)
# Gesture recognition thresholds
threshold_x = 2000
threshold_y = 2000
threshold_z = 2000
while True:
    ax, ay, az = mpu.acceleration
    if ax > threshold_x:
        print("Right gesture detected!")
    elif ax < -threshold_x:
        print("Left gesture detected!")
    elif ay > threshold_y:
        print("Up gesture detected!")
    elif ay < -threshold_y:
        print("Down gesture detected!")
    elif az > threshold_z:
        print("Forward gesture detected!")
    elif az < -threshold_z:
        print("Backward gesture detected!")
    utime.sleep(0.1)
```
These examples demonstrate how to use the MPU-6050 module in various contexts, including Arduino, Python with Raspberry Pi, and MicroPython with ESP32. By leveraging the module's accelerometer and gyroscope readings, you can develop innovative IoT projects that involve motion sensing, orientation calculation, and gesture recognition.