Introduction: Arduino / Processing - SIX AXIS GYRO & ACCELEROMETER

Hello world! Today i wanted to try out the MPU 6050 a.k.a GY-521 Accelerometer module. Check out the video and follow the next step for the Schematic, Code & Parts list.

What you need?

  • Arduino IDE (i assume you already have this.)
  • Processing IDE (Needed for the Airplane Demo.)

Libraries Needed.

  • "I2Cdev.h"
  • "MPU6050_6Axis_MotionApps20.h"
  • "Wire.h"

Install the Library toxiclibs-complete-0020 in the Sketch folder of the Processing IDE !NOT in Arduino IDE!

if there is no folder @ C:/users/user/documents/processing/libraries, then create one yourself.

First upload the arduino code to the arduino.

Before uploading you need to comment the line in the arduino MPU6050_DMP6 code which says:

from #define OUTPUT_READABLE_YAWPITCHROLL To //#define OUTPUT_READABLE_YAWPITCHROLL.

And uncomment the line:

from //#define OUTPUT_TEAPOT To #define OUTPUT_TEAPOT.

Open the processing example for the MPU 6050.

  • Open the Processing IDE, then: File –> Open.
  • Then navigate to the folder where you had installed the MPU6050 library for arduino.
  • Find the processing example in: MPU6050 –> Examples –> MPU6050_DMP6 –> Processing –> MPUTeapot.

In this code, you have change the serial port. Linux users

String portName = “/dev/ttyUSB1”;. You need to change ttyUSB1 to the port on which your arduino is connected.

And for windows users, you need to comment the line which says:

from String portName = “/dev/ttyUSB1”; To //String portName = “/dev/ttyUSB1”;. And uncomment the line which says:

from //String portName = “COM4”; to String portName = “COM4”;. And replace “COM4” with the COM port on which your arduino is connected

Save the processing code in the sketch folder. And press the play button in the processing IDE.

You will see a place move its X-Y-Z Axis when you move the MPU-6050.

Have fun!

Step 1: Schematic, Parts List.

Parts list.

  1. Arduino uno, I used the RobotDyn Uno.
  2. MPU-6050 Accelerometer module. (GY-521)
  3. Jumper wires set.

Good luck!

The CODES are in the EXAMPLES folder of the MPU-6050 Library. I used MPU6050_DMP6.ino

Make sure to set baudrate to. 115200 on the serial monitor.

Comments

About This Instructable

1,943views

26favorites

License:

Bio: Hello world! I make simple & Advanced projects for people who want to learn programming and electronics. Most of my Instructables are about arduino and the ... More »
More by vandenbrande:Arduino & C# - RGB LED / LED STRIP CONTROL C# Application Arduino & C# - LM35 Temperature Sensor C# Application Arduino (OPEN SOURCE) Arduino & C# - HC SR04 Distance Meter C# App for Arduino
Add instructable to: