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.)
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.