Lesson 32 MPU6050 Gyro Acceleration Sensor

Share for us

Introduction

The MPU-6050 is the world’s first and only 6-axis motion tracking devices designed for the low power, low cost, and high performance requirements of smartphones, tablets and wearable sensors.

Required Components

 1 * Raspberry Pi

– 1 * Breadboard

– 1 * MPU-6050 module

– Several Jumper wires

Experimental Principle

In this experiment, use I2C to obtain the values of the three-axis acceleration sensor and three-axis gyroscope for MPU6050 and display them on the screen.

Experimental Procedures

Step 1: Build the circuit. 

Raspberry PiGPIO Extension BoardMPU-6050 Module
SCLSCL1SCL
SDASDA1SDA
3.3V3V3VCC
GNDGNDGND

Step 2: Setup I2C (see Appendix. If you have set I2C, skip this step.)

For C Users:

Step 3: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/C/32_mpu6050/

Step 4: Compile.

gcc 32_mpu6050.c -lwiringPi -lm

Step 5: Run.

    sudo ./a.out

For Python Users:

Step 3: Change directory. 

    cd /home/pi/SunFounder_SensorKit_for_RPi2/Python/

Step 4: Run.

    sudo python3 32_mpu6050.py

Now you can see the values of the acceleration sensor, gyroscope, and XY-axis rotation read by MPU6050 printed on the screen constantly.