I just got the MPU-6050 gyro/accelerometer and I can't figure out how to properly program it. I wouldn not consider myself an advanced programer by no means. I have tried the tutorial on the Arduino page, any help please.
Please tell us what you tried, which code you used and what the result was.
Did you connect it okay ?
Did you run the i2c_scanner ? Was it visible ?
Did you run the test sketch from the Playground, did the values change when you rotated the sensor ?
Do you want to program it yourself ? Did you read all 4 the datasheets ? Did you read the newest documenation about the dmp ?
I might sound dumb saying this but how would I go about setting up the I2C scanner?
You wrote about a tutorial, did you refer to this ?
http://playground.arduino.cc/Main/MPU-6050
That page has a link to the i2c_scanner:
http://playground.arduino.cc/Main/I2cScanner
Create a new sketch, copy the i2c_scanner into it and let it run. It shows the devices that are found on the I2C bus.
Can you start by telling which module you have and how you have connected it to the Arduino ?
Also tell which Arduino board you have. Once that is okay, it is safe to run the i2c_scanner.
I have the MPU-6050 Accel/Gyro (Attached Picture), I am using the Arduino Uno. I connected it to the Arduino.
I have connected the ports on the MPU-6050 as follows:
VCC (On MPU-6050) connected to 3.3V (On Arduino)
GND (On MPU-6050) connected to GND (on Arduino)
ADO (On MPU-6050) connecte to GND (On Arduino)
SDA (On MPU-6050) connected to A4 (On Arduino)
SDL (On MPU-6050) connected to A5 (On Arduino)
That is how I wired everything up so far, I have ran a sketch to measure the Gyro/Temp/Accelerometer raw data and it worked.
But I have not runned the I2C scanner yet.
Hi guys I did allready some stuff with mpu6050 it works quite good but i have one problem. It works just from (in straight position it writes 180 degrees) 90-270. That less or more than this values it jumps and doesnt show proper values does anybody know why?
I have one more question generall about gyroscope and accelerometer, what is the difference between this two equations:
roll = (atan2(accX,accZ)+PI)*RAD_TO_DEG;
pitch = (atan2(accY,accZ)+PI)*RAD_TO_DEG;
and
roll = atan(accY / sqrt(accX * accX + accZ * accZ)) * RAD_TO_DEG;
pitch = atan2(-accX, accZ) * RAD_TO_DEG;
Thank you so much for help!
If that sketch is running, you don't have to try the i2c_scanner anymore, since the I2C bus is working.
AD0 is already to ground with a pulldown resistor on the board. So you don't have to connect it to ground.
The board has a voltage regulator. If you supply 3.3V to its VCC, the voltage regulator produces maybe 3.2V. That means that also the i2c bus pullup resistors on the board are pulled up to 3.2V.
By using 5V to VCC, the i2c bus is a little stronger. But do not connect any other pin to 5V, because the MPU-6050 will get damaged.
This is a good guide : Guide to gyro and accelerometer with Arduino including Kalman filtering - Sensors - Arduino Forum
Now it is time for some serious work. 8)
Use the i2cdevlib, you need both the i2cdevlib and the mpu6050 library.
Connect the 'INT' to Arduino pin 2, since the MPU-6050 generates interrupts at a pace of 100Hz to tell that new data is ready.
The 'dmp' example sketch shows all kind of data to the serial monitor.
http://www.i2cdevlib.com/devices/mpu6050
Alright thank you, it is working and giving me correct values. I want to see if I can put it through a Proccesing sketch