Introduction: GY-521 MPU6050 3-Axis Acceleration Gyroscope 6DOF Module Tutorial

Description

This simple module contains everything required to interface to the Arduino and other controllers via I2C (use the Wire Arduino library) and give motion sensing information for 3 axes - X, Y and Z.

Specifications

  • Accelerometer ranges: ±2, ±4, ±8, ±16g
  • Gyroscope ranges: ± 250, 500, 1000, 2000 °/s
  • Voltage range: 3.3V - 5V (the module include a low drop-out voltage regulator)

Step 1: Materials Preparation

In this tutorial, we will show you how the module works in detailed. First, we need to prepare the materials listed as below:

  1. Arduino Uno
  2. Male to female jumper wire
  3. USB Cable Type A to B
  4. Breadboard

Step 2: Hardware Installation

After getting the materials ready, We will connect the module with Arduino Uno. The detailed connection will be written in below:

  1. VCC -> 5V
  2. GND -> GND
  3. SCL -> A5
  4. SDA -> A4
  5. INT -> D2

Step 3: Source Code

To test the Arduino MPU 6050,

  1. First, download the Arduino library for MPU 6050. The link is provided here.
  2. Next, unzip/extract this library and move the folder named "MPU6050" inside the Arduino's "library" folder.
  3. Install the I2Cdev library if you don't already have it for your Arduino. Do the same procedure as above to install it. You can find the file here.
  4. Open Arduino IDE and follows the steps: [File]->[Examples]->[MPU6050]->[Examples]->[MPU6050_DMP6].
  5. Upload the source code to your Arduino.

Step 4: Results

  1. After uploading the code, open up the serial monitor and set the baud rate as 115200.
  2. Next, check if you see something like "Initializing I2C devices ..." on the serial monitor. If you don't, just press the reset button.
  3. Now, you'll see a line saying, "Send any character to begin DMP programming and demo." Just type in any character on the serial monitor and send it, and you should start seeing the yaw, pitch, and roll values coming in from the MPU 6050.

Notes: DMP stands for Digital Motion Processing. The MPU 6050 has a built-in motion processor. It processes the values from the accelerometer and gyroscope to give us accurate 3D values. Also, you will need to wait about 10 seconds before you get accurate values in serial monitor, after which the values will begin to stabilize.