Arduino and Processing – SIX AXIS GYRO and ACCELEROMETER

Hello world! Today i wanted to try out the MPU 6050 a.k.a GY-521 SIX AXIS GYRO and ACCELEROMETER module. Check out the video.

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

Libraries Needed.

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:
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! now you see the SIX AXIS GYRO and ACCELEROMETER @ work.



Parts list:
Arduino uno, I used the RobotDyn Uno.
MPU-6050 Accelerometer module. (GY-521)
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.


Arduino code MPU6050_DMP6.ino:

Processing code MPU6050_DMP6.ino:

Danny van den Brande

Programmer, Game Designer, 3D Designer, Web Designer, Graphic Designer. Jup this website looks crappy.. :) But enjoy the projects! Everything you need is here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.