MPU6050 ESP32 No Acknowledge

I am struggling to get an acknowledge from the MPU6050 using ESP32 with arduino framework. I am unable to derive if the problem is hardware or firmware.

I have copied the sparkfun's breakout board schematic, setting the FSYNC, CLKIN and AD0 pins to GND and SDA, SCL and INT to GPIOs 25, 26 and 27 respectively (INT is unused/floating). I am using 2.7k pull-ups for the i2c lines.

enter image description here

I am using the following code to test the i2c comms:

#include <Wire.h>
 
#define I2C_SDA 25
#define I2C_SCL 26

void setup() {
  Wire.setClock(100000UL);
  Wire.begin(I2C_SDA, I2C_SCL);
  delay(3000);
  Serial.begin(115200);
  Serial.println("\nI2C Scanner");
}
 
void loop() {
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for(address = 1; address < 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
      nDevices++;
    }
    else if (error==4) {
      Serial.print("Unknow error at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  }
  else {
    Serial.println("done\n");
  }
  delay(5000);          
}

I have probed the i2c line using a logic analyser. The code behaves as expected but I get no acknowledge.
enter image description here

I have checked that the chip has power, lowered the speed from 200kHz (default) to 100kHz. I have tried using internal pull-ups on esp32 instead of external. I have tried a different MPU6050 chip.

Any help diagnosing would be greatly appreciated.

Putting a cap between a pin and ground does not ground the pin.

What happens when you do an I2C scan?

I2C scanner

What did the I2C scanner report?

If no scan results then no I2C device.

Also why not use the 'natural' I2C pins for the ESP32's Arduino core?

Wire_SCL GPIO_NUM_22
WIRE_SDA GPIO_NUM_21

Post an image of your project.

Thank you for your pointers.
The adafruit I2C scanner is the code I have been running. It reports no device found. I have tried another ESP32 device which has the default SDA and SCL pins available (21 and 22 respectively). The cap is not an issue on sparkfun board so cannot see why it would be on my board.

That's a problem.

post a schematic of the project.

post an image of the project.

SOLVED! I have connected VLOGIC to VDD and I2C communication now works! On the Sparkfun schematic, you can see there is a net label VIn the VLOGIC pin, which goes to the VIO terminal on the Sparkfun board's header. That must be connected to a suitable supply voltage.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.