LowPowerLab Forum

Hardware support => Moteino => Topic started by: FlyingSaucrDude on July 18, 2021, 03:05:07 PM

Title: Problems Using SHT 30-D [solved:weak pullups]
Post by: FlyingSaucrDude on July 18, 2021, 03:05:07 PM
Hi all! I'm a new Moteino user, and I was wondering if anyone had any ideas about a problem I'm encountering.

I'm trying to use a Moteino 8MHz to read from and SHT 30-D, an I2C-based temperature/humidity sensor. (This one from Adafruit https://www.adafruit.com/product/5064 (https://www.adafruit.com/product/5064), to be specific.) However, whenever I try to access the SHT30 over I2C using the Moteino, nothing happens. I don't have anything else connected to the Moteino's I2C bus.

More specifically, I've tried several different SHT-3X libraries, and all of them give me an error saying the SHT 30 was not found.

Things I've tried to debug this:


#include <Wire.h>

void setup() {
  Wire.begin();

  Serial.begin(9600);
  while (!Serial); // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}

void loop() {
  int nDevices = 0;

  Serial.println("Scanning...");

  for (byte address = 1; address < 127; ++address) {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);

    byte error = Wire.endTransmission(); // With SHT-30 connected, sketch hangs here on the very first iteration of the loop

    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(5000); // Wait 5 seconds for next scan
}


Does anyone have any ideas on what might be preventing the I2C bus/SHT-30 from working correctly on the Moteino 8MHz? Thanks in advance!

P.S. I'm cross-posting this on the Adafruit forums and a couple of other places, just in case somebody elsewhere has encountered a similar problem.
Title: Re: Problems Using SHT 30-D
Post by: Felix on July 19, 2021, 09:53:08 AM
You have added I2c pullups, correct?
Title: Re: Problems Using SHT 30-D
Post by: FlyingSaucrDude on July 19, 2021, 09:58:47 AM
This particular package of the sensor comes with 10KΩ pullups from both SCA and SDL to VCC on its PCB. Could it be that value's too big?  :-\
Title: Re: Problems Using SHT 30-D
Post by: Felix on July 19, 2021, 10:41:26 AM
10k should be OK.
Title: Re: Problems Using SHT 30-D
Post by: FlyingSaucrDude on August 02, 2021, 06:46:42 PM
For anyone who encounters this problem in the future, here's the answer:

It turns out the 10KΩ pull-up resistors that came with this package weren't sufficient. I had to add additional 1KΩ pullups from both SCA and SDL to VCC to get things to work.

(FWIW I also tried 4.7KΩ pull up resistors, and that made some commands to the SHT 31 work, but not all.)