Watch the demo video:
Circuit used
I used "GY-521" which has "MPU-6050" sensor which contains an accelerometer and a gyro on one chip.
Connections:
VCC on GY-521 ----> to 3.3v pin on ArduinoGND on GY-521 ----> to GND pin on Arduino
SCL on GY-521 ----> to PinA5 on Arduino
SDA on GY-521 ----> to PinA4 on Arduino
Codes
I used 2 codes. The first one should be uploaded to the Arduino board. It is responsible for detecting one of the 3 angles of the sensor, and sending its value to the computer via USB.
The other code is a Matlab code responsible for receiving the angle from the Arduino and visualizing it on a 2D object.
Arduino Code, Matlab code, and Libraries needed:
https://drive.google.com/folderview?id=0Bx4uoJmyE27YOHBqUzVsLU9XTVE&usp=sharing
Move "I2Cdev" & "MPU6050" folders to
Documents > Arduino > libraries
so how to save datas retrieved into a file
ReplyDeleteGood day. I have a question I hope you can answer me. I want to connect two MPU6050 a single arduino. What you need to add the arduino sketch for the two readings? What do I need to add to the MATLAB code to create a graph of the second module? I tried to duplicate the variables but it has not worked for me. I await your response. Thank you.
ReplyDeletehi, may I know do you know about it already?
Deletegood work..
ReplyDeleteI am using mega2560 instead of UNO. So where should i connect MPU 6050 SCL and SDA pins??can I connect to mega scl and sda pins?
if you search on google about "mega2560 scl sda(i2c) pins". You will find out...
DeleteThank you! There were some problems with x64 Windows, but on x32 is OK
ReplyDeleteDid you had any troubles? I ask it because normally the mpu requires level shifters when used with the uno...
ReplyDeletehi sir,
ReplyDeleteyou said that frist code should uploaded int arduino board. i tried to upload through arduino software. is it correct ? which sorftware can use to upload into arduino board .? help me pleasem .
hi sir,
ReplyDeleteyou said that frist code should uploaded int arduino board. i tried to upload through arduino software. is it correct ? which sorftware can use to upload into arduino board .? help me pleasem .
hi sir,
ReplyDeleteyou said that frist code should uploaded int arduino board. i tried to upload through arduino software. is it correct ? which sorftware can use to upload into arduino board .? help me pleasem .
dear sir, regarding i2c communication, can't we connect SDA,SCL of MPU 6050 to that of arduino? is it necessary to connect SDA of mpu 6050 to pin A4 of ardiuino and SCL to A5?
ReplyDeletedear sir, regarding i2c communication, can't we connect SDA,SCL of MPU 6050 to that of arduino? is it necessary to connect SDA of mpu 6050 to pin A4 of ardiuino and SCL to A5?
ReplyDeletecan you hepl me!
ReplyDeleteError using serial/fopen (line 72)
Open failed: Port: COM2 is not available. No ports are available.
Use INSTRFIND to determine if other instrument objects are connected to
the requested device.
Error in real_time_2D_animation_MPU6050 (line 5)
fopen(arduin); % initiate arduino communication