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