MPU6050 Reads All Zeros - Tried Various Solutions

Hi All, I’m extremely frustrated here with an MPU6050 that only outputs zeros for ax, ay, az, gx, gy, gz. I’ve read online that the chip boots up into sleep mode, yet when i wake the it up it still only shows zero.

I’ve used about 5 different code/sketches found online, including Jeff Rowlands awesome code/library.

I purchased 5 MPU6050’s directly from digikey. Only the chips, no breakout board or anything.

I made a custom board with a SAMD21 arm cortex which is reading the MPU6050. I’ve attached my schematic and a pic of my board.

I’m going crazy trying to solve this. One idea maybe my SDA and SCL resistance values are incorrect. I started with 10k ohm on i2c, didnt work. Then went to 2.2k on the i2c, didnt work. i dont have any 4.7k unfortunately.

I thought maybe my board was poor or faulty, but i’ve made 3 PCBs so far (different layout each time) and each one the MPU6050 shows zeros.

I purchase these chips right from digikey, still in the cut tape. I tried 3 of the 5 MPU6050 so far, all yield zeros.

Now i’ve tried Jeff’s code, and every example code in existence with same result.

Note that the i2c scanning code finds the MPU6050 just fine, and it shows 0x68 as the chips address.

Some thoughts, i broke out the AD0 to one pin of the SAMD21, and the INT to another pin, but i’m not using either in code. I dont think they are needed. When i use a multimeter these 2 pins are about 95mV when maybe they should be grounded?

I doubt that all 5 chips i bought are faulty, so must be something i’m doing wrong. But i think i tried everything.

My board works as i can flash other code just fine, blink LEDs, etc. Kinda struggling here! thanks for any help.

EDIT: I did check the connections with an oscilloscope and didnt see anything that caught my eye with errors etc…

Also i do have break out board MPU6050s from amazon, and they work just find with the same exact code.

EDIT2: I located some 4.7k resistors and just tried them on SCL/SDA, no change still zeros!!

Anyone have any ideas? Bump...

You have REGOUT and CPOUT connected to GND ?
Read the datasheet.

REGOUT : Regulator filter capacitor connection. Regulator Filter Capacitor (Pin 10), Ceramic, X7R, 0.1μF ±10%, 2V.

CPOUT : Charge pump capacitor connection. Charge Pump Capacitor (Pin 20), Ceramic, X7R, 2.2nF ±10%, 50V.

Damn I missed that. I feel stupid. I will roll another board tonight with the corrections and try it out. Appreciate the help.

Well that fixed it, the sensor outputs real values now.

But the new problem is the values are completely random. With the device sitting still on a table, the numbers fluctuate all over the place.

Perhaps this is some register not configured properly. However I used Jeff rowlan example code which initializes the chip...

RogerPodacter, we have to know more, almost as if we are looking over your shoulder.
When you use a library : give a link to it.
If you have a problem with a sketch : show us the sketch.
If you have connected something : show a schematic or photo.
And if you have weird values, show us the values.

I think that raw values that are all over the place is normal. That is why a software filter is needed.

Use a simple sketch from this page and compare the raw values :
Show us the values and tell us how you used the sensor. If you put the sensor on a wooden table and there is a computer on that table, that might already give more fluctuation of the values.

apologies for that. so i’ve attached my corrected schematic after you pointed out my errors. See Attachment 1. that made the board function and actually output read values for ax, ay, az, gx, gy, gz instead of all zeros.

My new board i cant get to work with Jeff Rowberg’s code yet due to interrupt pin mapping. Each time i flash the sketch the INT pin seems to move to a different actual pin on the board. So i currently used user JohnChi’s MPU6050short.ino sketch, which is actually i think the one you just recommended. Code below:

    // MPU-6050 Short Example Sketch
    // By Arduino User JohnChi
    // August 17, 2014
    // Public Domain
    //#define Serial SerialUSB
    const int MPU_addr=0x68;  // I2C address of the MPU-6050
    int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
    void setup(){
      //pinMode(A5, OUTPUT);
      //digitalWrite(A5, HIGH);
      Wire.write(0x6B);  // PWR_MGMT_1 register
      Wire.write((byte)0);     // set to zero (wakes up the MPU-6050)
    void loop(){
      Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
      Wire.requestFrom(MPU_addr,14,true);  // request a total of 14 registers<<8|;  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L) <<8|;  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)<<8|;  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)<<8|;  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)<<8|;  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)<<8|;  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)<<8|;  // 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);

so yes this looks like raw data output with no filtering.

The reason i say its outputting all random values is when i sit the board idle on my desk, here is the output i obtain (see Attachment 2). the first 20 seconds i shook the board, the next 20 seconds i let it sit flat on the desk. The graphed data seems to show no difference. I assumed there should be some difference no matter how the data is scaled or filtered.

Next i will try using Jeff Rowbergs DMP code, i just am having to issues getting the INT pin to read which is why i havent yet used it this time. The INT pin seems to keep changing locations on the board everytime i flash the code. The specific sketch I’m troubleshooting is “MPU6050_DMP6.ino” and linked specifically from here:

You need somewone who knows the SAM21D / M0+ / Arduino Zero.
I will write a few of my thoughts, but I have no clue :frowning:

The ‘dmp’ of the i2cdevlib is a few steps ahead, try to get normal values with the small sketch.

Have you tried an Arduino Zero with a MPU-6050 module on a breadboard ?
That is what Arduino is for : fast prototyping.

Are you using the newest Arduino IDE and the newest core for the Zero ?

At least add that delay at the end of the loop() in the small sketch.

Could you test the return value of Wire.endTransmission() and Wire.requestFrom() ?
The Wire.endTransmission returns an error (it should be zero), the Wire.requestFrom() return the number of received bytes (it should be same as the number of requested bytes).

Did you try the i2c_scanner ?
Let it run for a while, it should find the sensor, and it should be stable without any problems.

There are USB logic analyzers that can decode the I2C information, for example the Saleae logic analyzers.

Sorry for never responding. So I got my board working. I ended up making a new board with an mpu9250 instead, which is almost identical. Anyway it's working as should so far. I didn't really do anything different, just made a new board with the 9250.

It's definitely a pain to read the compass though. Not very clear at all.

You have REGOUT and CPOUT connected to GND ?
Read the datasheet.

REGOUT : Regulator filter capacitor connection. Regulator Filter Capacitor (Pin 10), Ceramic, X7R, 0.1μF ±10%, 2V.

CPOUT : Charge pump capacitor connection. Charge Pump Capacitor (Pin 20), Ceramic, X7R, 2.2nF ±10%, 50V.

Hello can u tell me what are the REGOUT and COUT pins?

because I am facing the same problem I am using and Arduino Pro mini and the mpu6050 and the sensor just ouputs zeros

This diagram could be helpful!