Introduction: GY-521 MPU6050 3 Axis Gyroscope and Accelerometer With Arduino
This video tutorial goes over the installation and setup of a GY-521 board with a MPU6050 3 Axis Gyroscope and Accelerometer with an Arduino. After some initial troubleshooting with I was able to get the component working. At first I had trouble with loose breadboard connections so I decided to solder in the pins that came with the component. That solved my problem and I was off and running. I used some 3D modeling software to illustrate the operation of the component.
Everything you need to duplicate this project can be found here:
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Solder Pins to the Component
The component came with two sets of pins which I highly recommend soldering to the component.
I tried testing with a breadboard at first but only ran into frustration as the connections were loose. I was able to get a red led on the board so my voltage and ground were connected. However, when I ran my MPU6050 software on the Arduino, my serial monitor would show the error message: "MPU6050 connection failed". Soldering the pins to the board solved the connection issue. So if you are having this error message and are using a breadboard, solder could solve the problem.
Step 2: Connect to Arduino
Now that you have your pins soldered to the component you can wire it up to the Arduino Uno.
VCC -> 5v
GND -> GND
SCL -> A5
SDA -> A4
INT -> D2 (used for interrupt)
(the other pins do not need to be connected)
Step 3: Use I2C Scanner and MPU6050 Arduino Software
Using I2C Scanner, verify that the Arduino finds the device.
If the device is found then try using the MPU6050 example software to see if you get raw data.
The MPU6050 libraries can be downloaded here: http://diyhacking.com/projects/MPU6050.zip
The I2C libraries can be downloaded here: http://diyhacking.com/projects/I2Cdev.zip
Note: if the output is random characters, make sure your serial connection is set to 9600 baud in the arduino setup.
Step 4: Run the MPU Teapot Example With Processor IDE
Download and install the Processor IDE.
You can download the Processor IDE here: https://processing.org/download/?processing
Then open the MPU Teapot example and change some code.
Comment out: #define OUTPUT_READABLE_YAWPITCHROLL
And uncomment the line: //#define OUTPUT_TEAPOT
will look like this:
You will also need to change some lines of code for the Arduino MPU6050 Teapot example:
String portName = “/dev/ttyUSB1”;.
Change "ttyUSB1" to the port where your Arduino is connected. eg. "COM3";
I had some trouble finding the Toxiclabs library needed for this demo but I eventually found it here: https://bitbucket.org/postspectacular/toxiclibs/do...
You will need to modify some lines of code as detailed here: