not initialize mpu6050 ,Failed to find MPU6050 chip

Status
Not open for further replies.
Hello,

I use the mpu6050 (OEM china product) with library from arduino IDE -> adafruit MPU6050 ->basic_readings.
in this below code, it shows me on serial arduino IDE ->"Failed to find MPU6050 chip"
Code:
// Try to initialize!
  if (!mpu.begin()) {
    Serial.println("Failed to find MPU6050 chip");
    while (1) {
      delay(10);
    }

if i change to code and remove the " ! "
Code:
 if (mpu.begin()) {
    Serial.println("Failed to find MPU6050 chip");
    while (1) {
      delay(10);
the code proceeds and gives me values.

Why it can not confirm the chip?


i working in teensy 3.2


Thank you!

Stathis
 
Pull ups seem to be present on the board (value 2.2k).
Which logic level does AD0 have? If on GND, then the I2C address is 0x69, but the Adfruit library uses the fixed address 0x68 (HIGH at AD0).
 
logic level to ADO is none(in the air,not connecting). when run the i2c scanner find the mpu6050 in 0x68, is ok, but when run the sketch -> adafruit MPU6050 ->basic_readings.
is not progressing when do it initialize and give messenge "Failed to find MPU6050 chip" . I try with other MPU6050 with same connection and code and it run well !
 
May be something wrong with timing within MPU6050.
Adafruit library contains a lot of delays, so if it works with one PCB and not with the other (same curcuit), may be at egde of timing limits.
Adafruit library does several initialsations and setting during begin()

Sorry, have no time/ability to dig deeper.
 
May be something wrong with timing within MPU6050.
Adafruit library contains a lot of delays, so if it works with one PCB and not with the other (same curcuit), may be at egde of timing limits.
Adafruit library does several initialsations and setting during begin()

Sorry, have no time/ability to dig deeper.

what is wrong you thing?
Τhe mpu6050 being defective board ? or
the code being responsible for timing?
 
I have that board - bought it years ago. It worked good. Can't remember a different WhoAmI.
Maybe I try next weekend with that lib.
 
One of the things the startup code does is read the WHO_AM_I register to make sure that the magic number returned is as expected. Perhaps your board is returning a different number.

Υou are right!
I used the WHO_AM_I code:
Code:
/*https://forum.arduino.cc/t/mpu-6050-a-module-problems-who-am-i-reports-0x98-not-0x68-as-it-should-fake-mpu-6050/861956
*/
#include <Wire.h>

#define MPU6050_I2C_ADDRESS 0x68   // Default MPU-6050 address
#define MPU6050_WHO_AM_I 0x75      // R Who am I address

void setup()
{
  Wire.begin();        // Initiate wire library
  Serial.begin(9600);  // Initiate serial port 
  WhoAmI();            // Verifies identity of device
}
void loop()
{
  //blank
}

void WhoAmI(){
  uint8_t waiByte;                                    // Data will go here
  MPU6050_Read(MPU6050_WHO_AM_I, &waiByte);           // Get data
  Serial.print(F("Device WhoAmI reports as: 0x"));    // 
  Serial.println(waiByte,HEX);                        // Report WhoAmI data
  }

void MPU6050_Read(int address,uint8_t *data){            // Read from MPU6050. Needs register address, data array
  int size = sizeof(*data);                              //
  Wire.beginTransmission(MPU6050_I2C_ADDRESS);           // Begin talking to MPU6050
  Wire.write(address);                                   // Set register address
  Wire.endTransmission(false);                           // Hold the I2C-bus
  Wire.requestFrom(MPU6050_I2C_ADDRESS, size, true);     // Request bytes, release I2C-bus after data read
  int i = 0;                                             //
  while(Wire.available()){                               //
    data[i++]=Wire.read();                               // Add data to array
  }
}

Device WhoAmI reports as: 0x72!

I try in another mpu6050 and it is 0x68!!!

Now the problem was solved by changing in the Adafruit_MPU6050.h ,i open it and in the first lines i change the below following variable

#define MPU6050_DEVICE_ID 0x72 //change it from 0x68 to 0x72 !! !!!

I wish it was this problem only with returning a different number ID and not some mpu6050 chip clone when i use it to give wrong measurements!!



thank you all!

Stathis
 
A MPU6050 should always report 0x68. Since this is derived from the I2C address, it should also require a change to that to get something different.

Unless it is not a MPU6050. Some other flavor of MPU or even a fake. (The MPU6050 is not recommended for new designs so production of the real things is coming to an end.)
 
Status
Not open for further replies.
Back
Top