I2C no devices found on ESP32 (with HDC1080DMBR)

Hello, I am working on a project where I am using HDC1080DMBR RH&T sensor integrated on a custom board.

I have some trouble getting it to work. The schematics of the circuit will be attached at the bottom of this post. Vcc is 3.3V. So I came across some "I2C scanners" which I tried but it failed to detect any device every time. The code is shown bellow.

/*
 * Wire - I2C Scanner
 *
 * for example the WeMos D1 Mini I2C bus uses pins:
 * D1 = SCL
 * D2 = SDA
 */

#include <Wire.h>

const int SCLpin = 22;
const int SDApin = 21;

void setup()
{
  Serial.begin(115200);
  Serial.println("I2C Scanner");
  Serial.println("SDA Pin = "+String(SDA));
  Serial.println("SCL Pin = "+String(SCL));
  Wire.begin(SDApin, SCLpin);
}

void loop()
{
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for (address = 1; address < 127; address++)
  {
    // The i2c scanner uses the return value of Write.endTransmisstion to see if a device did acknowledge to the 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.print(address, HEX);
      Serial.println(" !");
      nDevices++;
    }
    else if (error == 4)
    {
      Serial.print("Unknown 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(2000);
}

I set the SDA pin to 21 and SCL to 22 as shown in ESP32 datasheet. The output on serial monitor reads no devices found. I tried to setting the pin 5 to output and HIGH to pull up the resistors but it did not have any effect. Now whenever I tried to use a library to get some data, the report would be max values for RH (100) and T (125) so I am assuming all the bits are = 1.

Anyone has any idea what could be wrong here? Thanks!

You do not need a pull up for the SCL and 10K is rather large, I use 2.2K or so for an ESP32. Also pull up resistors go to 3.3V and not a GPIO pin.

Idahowalker:
Also pull up resistors go to 3.3V and not a GPIO pin.

There might have been some notion of "switching off the pullups to save power". But the idle state of the I2C bus is HIGH, so that should not be a concern; the pullups are not drawing current.

Hello Idahowalker and thank you for your response.

The 3.3V was set to a GPIO pin for this particular application for toggling (to save power).
If there is something wrong with it I don't know about, please let me know since I am fairly new to this stuff so it is very possible to make a silly mistake.

Also can you elaborate a little bit on the pull ups? Can you explain why I don't need it for SCL? Thank you!

See #2. :roll_eyes:

nizzy94:
Hello Idahowalker and thank you for your response.

The 3.3V was set to a GPIO pin for this particular application for toggling (to save power).

Burning up GPIO pins is an option I don't go for myself. It's your project you power it how you wish.

nizzy94:
If there is something wrong with it I don't know about, please let me know since I am fairly new to this stuff so it is very possible to make a silly mistake.

pins from the mcu are limited in their output.

nizzy94:
Also can you elaborate a little bit on the pull ups? Can you explain why I don't need it for SCL? Thank you!

The data lines want pull ups for signal conditioning.

Hi,
Can you post an exported jpg image of your custom PCB please?

Before going to a PCB did you breadboard your project to prove your communications?

Thanks.. Tom... :slight_smile:

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