GY-521 Module MPU-6050 Trouble

Hi everyone,

First of all... I know that this question was posted several Times before, but I didn't find any usable answer to this specific problem.

I'm currently using an Arduino Uno R3 and I want to connect a MPU-6050 Sensor via I2C. I bought this one:

When I use the I2C_Scanner Sketch, I get the message, that there is a Sensor recognized at the Address 0x86.

Trying to use the Simple Sketch from http://playground.arduino.cc/Main/MPU-6050 and my serial monitor shows me the following:

AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0

So as far as I can see the communication between the Sensor-Chip and the Arduino should be ok, but I only gat zero values all the time.

Does anyone have a clou whether there is some part of the chip broken or if this is some software problem?

Thank you in advance for your help

const int MPU_addr=0x68;  // I2C address of the MPU-6050

It seems that the sketch connects to some other sensor as your I2C returned 0x86. That might explain why you only get zeros.

Sorry, that was a fault in my writing. Here is the output from the Scanning Sketch:

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

So it seems that the Sensor is recognized. And there is no other device connected to my arduino.

I’ve extended the sample code to correctly check the return values of the Wire methods. Please run that sketch and post the serial output.

    // MPU-6050 Short Example Sketch
    // By Arduino User JohnChi
    // August 17, 2014
    // Public Domain
    #include<Wire.h>
    const int MPU_addr=0x68;  // I2C address of the MPU-6050
    int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
    uint8_t retval;
    void setup(){
      Wire.begin();
      Wire.beginTransmission(MPU_addr);
      Wire.write(0x6B);  // PWR_MGMT_1 register
      Wire.write(0);     // set to zero (wakes up the MPU-6050)
      retval = Wire.endTransmission(true);
      Serial.begin(9600);
      if (retval) {
        Serial.print(F("Wake up of MPU failed: "));
        Serial.println(retval);
      }
    }
    void loop(){
      Wire.beginTransmission(MPU_addr);
      Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
      retval = Wire.endTransmission(false);
      if (retval) {
        Serial.print(F("Setting register number failed: "));
        Serial.println(retval);
      }
      retval = Wire.requestFrom(MPU_addr,14,true);  // request a total of 14 registers
      if (retval != 14) {
        Serial.print(F("Read registers not complete, read "));
        Serial.print(retval);
        Serial.println(F(" bytes."));
      }
      AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)    
      AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
      AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
      Tmp=Wire.read()<<8|Wire.read();  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
      GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
      GyY=Wire.read()<<8|Wire.read();  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
      GyZ=Wire.read()<<8|Wire.read();  // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
      Serial.print("AcX = "); Serial.print(AcX);
      Serial.print(" | AcY = "); Serial.print(AcY);
      Serial.print(" | AcZ = "); Serial.print(AcZ);
      Serial.print(" | Tmp = "); Serial.print(Tmp/340.00+36.53);  //equation for temperature in degrees C from datasheet
      Serial.print(" | GyX = "); Serial.print(GyX);
      Serial.print(" | GyY = "); Serial.print(GyY);
      Serial.print(" | GyZ = "); Serial.println(GyZ);
      delay(333);
    }

I took your updated code for testing and this is the serial output I got:


AcX = 0 | AcY = 0 | AcZ = 0 |AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0


So everything shows just 0 but the temperature which is corrected by the constand value 36.53

So everything shows just 0 but the temperature which is corrected by the constand value 36.53

Which also is a zero reading for the temperature.

How did you wire the module to the Arduino? Post a wiring diagram or describe every wire you connected to the MPU-6050 breakout. Maybe there's a line floating that should be connected.

I wired everything as shon in every tutorial I've found ^^.

First of all.. I bougth an original Arduino Uno R3... so no clone, and the sensor as shown in my first post.
The wiring:

MPU6050 GY-521 | Arduino Uno R3

VCC -------------------->----------------- 5V

GND -------------------->----------------- GND

SCL --------------------->----------------- A5

SDA --------------------->----------------- A4

This was my basic wiring for the raw-data demo.
BTW... I now bougth another MPU6050 for comparison from another company and this one runs without any error in the same wiring.

For me it's just the point of understanding what's going wrong with this sensor unit to gain a little more knowledge.

Same problem here, hope someone can help me! :confused:
I have chinese mpu6050 and arduino nano.
I have connected:
GND to GND
SCL to A5
SDA to A4
When I connected VCC to 5V I had this running the i2c scanner code:

I2C Scanner 
Scanning... 
Unknow error at address 0x02
I2C device found at address 0x68  ! 
done

When I connected VCC to 3.3 instead I got this:

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

With the example sketch the output is:

AcX = -1 | AcY = -1 | AcZ = -1 | Tmp = 36.53 | GyX = -1 | GyY = -1 | GyZ = -1
AcX = -1 | AcY = -1 | AcZ = -1 | Tmp = 36.53 | GyX = -1 | GyY = -1 | GyZ = -1

Now I tried pylon's code and I have:

Wake up of MPU failed: 2
Setting register number failed: 2
Read registers not complete, read 0 bytes.
AcX = -1 | AcY = -1 | AcZ = -1 | Tmp = 36.53 | GyX = -1 | GyY = -1 | GyZ = -1

EDIT:
I solved! I have connected GND to the other GND pin (the one between the RST and VIN pin) on arduino nano and now it is working. What is the difference between the 2 pins?

You should use a level converter for this module as the GY-521 is running on 3V3 and the UNO is running on 5V. The Wire library activates the internal pullups for SDA and SCL so the MPU-6050 gets a to high voltage on these lines. It might work for some time but it also might destroy your chip.

I too have a similar problem but worse than this. I have purchase Arduino Uno R3 and MPU 6050 - http://www.ebay.in/itm/MPU6050-GY-521-Module-3-Axis-analog-gyro-sensors-Accelerometer-3-Axis-Gyroscope-/302007450764?

I have tried 3 codes so far. When i try the above code by pylon what i get in Serial Monitor is a blank screen and nothing. I have also tried the code by Jeff Rowberg and when i see the Serial Monitor the only thing i see is "Initializing I2C devices..." and it is stuck there for ever. I even tried running I2C Scanners code, what i see on Serial Monitor is "I2C Scanner
Scanning..." and only that. I have not altered any code or anything.

My Connection

VCC - 3.3 V
ADO - GND
GND - GND
INIT - 2 (Digital)
SCL - A5 (Analog)
SDA - A4

I even tried VCC as 5V but still no changes. Where am i making the mistake. Please guide me

@HarzSR: Did you read my last reply? You read that a level converter should be used with that model but connect it directly to the UNO? It might be worse in your case because your sensor already died from the higher voltage.