MPU6050 (GY-521) values

Hi,

I'm having troubles reading values from GY-521 to my Arduino Pro Mini.

I get the basic code from Arduino Playground http://playground.arduino.cc/Main/MPU-6050#short

And this Is that i get:

AcX = 254 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7680 | GyY = 30 | GyZ = 0
AcX = 254 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7680 | GyY = 30 | GyZ = 0
AcX = 254 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7680 | GyY = 30 | GyZ = 0
AcX = 254 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7680 | GyY = 30 | GyZ = 0

Always the same values.

MPU is connected by this way:

VCC => 5v
GND => GND
SDA / SCL => A4 / A5
INT = Digital Pin 2 (I tried 3 too)
(also i tried to change A4 for A5 and vice versa)
(and tried with 3.3V too)

And, if I try to use the library i2cdevlib/Arduino/MPU6050 at master · jrowberg/i2cdevlib · GitHub I always get the message that Connection Failed.

I tried to the I2CTester and it founds the IMU at 0x68 (as expected)

Any idea?

Thank you very much.

You did run the i2c_scanner ?
http://playground.arduino.cc/Main/I2cScanner
Does it run without problem for a long time ?
When it detects the address, also the short sketch from the Playground should work.
The long sketch from that page in the Playground returns an error for I2C problems, you could try that one also.
http://playground.arduino.cc/Main/MPU-6050

Perhaps the MPU-6050 is damaged, but there are many other things that could be wrong.
Can you check with a magnifier the soldering of the Pro Mini and the MPU-6050 board ?
Perhaps something is wrong, or a solder drop that causes a shortcut.
Is the Pro Mini a clone from Ebay ?

Perhaps you use flat-cable or other long cable, or a breadboard with bad contacts.
Can you make a photo of it ?

Hi,

I have three MPU-6050.

All of them pass the test with Arduino Playground - I2cScanner as you said... "for a long time" are 2 or 3 minutes.

Scanning...
I2C device found at address 0x68 !
done

Scanning...
I2C device found at address 0x68 !
done

The simple Sketch you paste (Arduino Playground - MPU-6050) return this values for 3 MPU's (pay attention for difference values between MPU1 &3 wrt MPU2

AcX = 252 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7680 | GyY = 30 | GyZ = 0
AcX = 252 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7680 | GyY = 30 | GyZ = 0
AcX = 252 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7680 | GyY = 30 | GyZ = 0

AcX = 110 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 6400 | GyY = 1 | GyZ = 0
AcX = 110 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 6400 | GyY = 1 | GyZ = 0
AcX = 110 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 6400 | GyY = 1 | GyZ = 0

AcX = 252 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7168 | GyY = 26 | GyZ = 0
AcX = 252 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7168 | GyY = 26 | GyZ = 0
AcX = 252 | AcY = 0 | AcZ = 104 | Tmp = 35.02 | GyX = 7168 | GyY = 26 | GyZ = 0

One of them was soldered a few weeks ago, now I try to solder the others and I think I did it correctly.

The Pro Mini is a clone from eBay and put all togheter in breadboard trying different cables...

Any ideas?

I will continue trying to solder better and other ways.

Thank you.

No ideas, not even a clue, sorry !

Can you try that longer example from the Playground and make a photo of your wiring and modules ?
Somehow the integers are completely different, as if you are reading status data and turn that into x,y,z values.

Please do not use cables, use just a few short wires.
The I2C-bus doesn't like cables, even 30cm could be too long. When you use seperate wires that are not close to each other, you can go up to 2 meters (or even more).

Here you have a photo.

I'm trying with other Pro Mini's in order to discard bad solders in A4/A5/D2 pin, but I get the same results.

I'm trying with some sorter wires as you said...

The most weird think is the values that I get... are constants always. And if I remove the INT pin the values still being the same!

Thanks for the photo, it seems all okay.

That longer sketch checks the I2C errors all the time.
http://playground.arduino.cc/Main/MPU-6050#sketch
If that error would be always zero and the x,y,z values are still like that, then I don't know what could be wrong.

I can't believe they are all fake MPU-6050 chips, so it must be something obvious that I don't see.
Perhaps the MPU-6050 modules are all from the same bad batch, perhaps with a wrong capacitor or resistor. But I don't think so.

The common factor is the usb-serial converter ?
Are you sure that you use 5V to power the Pro Mini board ? Many usb-serial converters are 3.3V and a FTDI module can often be set to 5V or 3.3V.
Do you have a Arduino Uno ? If you use that with the MPU-6050 board, it should (it must) work.
Can you measure the voltages with a multimeter ?

Thank you very much for your patient.

I get Pro Mini's, Accelerometers, Gyros, Bluetooth, and other sensor in a "big" buy on eBay to the same buyer with big reputation, everythink works fine, and as you said I cant believe that 3 gyros are fake and probably is something obvious that I cant see.

The longer sketch shows this:

InvenSense MPU-6050
June 2012
WHO_AM_I : 0, error = 0
PWR_MGMT_1 : 0, error = 0

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 110, 0, 104
temperature: 35.000 degrees Celsius
gyro x,y,z : 6400, 1, 0,

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 110, 0, 104
temperature: 35.000 degrees Celsius
gyro x,y,z : 6400, 1, 0,

(repeat values forever)
So, no errors... no 0 values...

Maybe same bad batch and I was unlucky with that?

The accelerometer (GY-61) works fine.

The common factor is USB serial converter, I havent troubles with that, but I tried with other USB-serial converter that I have and the same result (CP2102 and CP2101).

I tried both with 3.3v and 5v, same values.

I have an Arduino Uno but it is broken :stuck_out_tongue:

I keep trying with other Pro Minis...

Thank you again!

PD: I measure voltage, 4,99, 5.1... I think its all ok

Zero error and all wrong values ? No way !
Perhaps there is a different sensor chip on the board. Can you read the text on the sensor ?
I have checked photos online, and every MPU-6050 module has a MPU-6050 sensor with readable text.

Can you buy a MPU-6050 module for 3 dollars from another vendor on Ebay ?
And a new Arduino Uno.
You can test the Uno with the new MPU-6050 module, that should work. Then you can replace parts until you find what is the cause of this.

LOL, it wasnt MPU6050, I read the chip as you tell me and its ITG3205!

I found this code: http://www.geeetech.com/wiki/index.php/ITG3205_Triple_Axis_Gyroscope_Breakout and its works without problems!

Thanks for your help Peter_n

I'm not sure if that is funny or not :~
But at least we found the cause !

Hi. I am also having the same problem. Could you please tell me how exactly you came to realize that you have been using a different sensor? If its a ITG3205, what will be written in the sensor? I cant read anything what they have written.

Hi, can anyone tell me what the values means, i get the temperature it shows 25 celsius but for other values i have no clue. let say that accel sensor shows 100 and gyro 5000 what are the units?

Hi, I am using MPU6050 for self balancing unicycle. I am using single axis of sensor. I am getting my tilt angle from following code.

double accXangle=(atan2(AcY,AcZ)+PI)RAD_TO_DEG;
// Convert gyro raw vlues to degrees!
double gyroXrate=(double)GyX/131.0;
// Complementary Filter!
double compAngleX = (0.97 * (compAngleX + (gyroXrate * dt))) + (0.03 * accXangle);
//Serial.println("AcX = ");
float a=31.142
(compAngleX-5.35);
float ang=a-90;
return ang;

But the problem is that due to sudden movements of sensor, it gives random values which have nothing to do with sensor movement. For example when sensor is suddenly moved in positive direction of angle measurement, i gives -ve values for angle which then effect on pwm and thus direction of motor.

Can any one tell me where i am going wrong or why this is happening.