Gyroscope and Accelerometer
In this project, you'll learn how to connect and control the GY-521 gyro and accelerometer module which uses the MPU-6050 digital motion processor to detect the spin, tilt, and acceleration of an object.
The MPU-6050 uses the I2C protocol to communicate with the Arduino. The 7-bit I2C device address for the MPU-6050 is 0x68.
The MPU6050_RobotsForFun library contains all of the functions for interfacing with the MPU-6050.
Parts needed:
| ![]() | |
1 | Making the connections
| |
2 | Download the MPU6050_RobotsForFun library. | |
3 | Install the MPU6050_RobotsForFun library by selecting Sketch from the Arduino IDE menu
Click the Open button (Refer to this document for more information on how to install a library if you run into problems.) | |
4 | Create a new program by selecting File from the menu
| |
5 | Open the Serial Monitor. | |
6 | Upload and run the program. | |
7 | You will see the gyro x, y, z axis values printed. Tilt the MPU along the three axis to see the values change. | |
Are you ready to build a self balancing robot? Click on the Experiment button to learn how to build one. | ||