Author Topic: Problems Using SHT 30-D [solved:weak pullups]  (Read 1680 times)

FlyingSaucrDude

  • NewMember
  • *
  • Posts: 5
Problems Using SHT 30-D [solved:weak pullups]
« 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, 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:
  • I tested the SHT30 by connecting it to my Raspberry Pi Zero's I2C interface, and it worked fine.
  • To figure out if the Moteino has a faulty I2C interface, I hooked the Moteino up to my Pi Zero and ran a slave sender/receiver program. The Pi correctly  wrote and read bytes from the Moteino (which correctly received/sent them).
  • I tried using the simple I2C scanner sketch below to see if the SHT30 would even show up on the I2C bus. Whenever I run the sketch with the SHT30 connected, it hangs at the indicated line. If I disconnect the SHT-30, the sketch runs correctly and reports no devices.

Code: [Select]
#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.
« Last Edit: August 03, 2021, 09:26:54 AM by Felix »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Problems Using SHT 30-D
« Reply #1 on: July 19, 2021, 09:53:08 AM »
You have added I2c pullups, correct?

FlyingSaucrDude

  • NewMember
  • *
  • Posts: 5
Re: Problems Using SHT 30-D
« Reply #2 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?  :-\

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Problems Using SHT 30-D
« Reply #3 on: July 19, 2021, 10:41:26 AM »
10k should be OK.

FlyingSaucrDude

  • NewMember
  • *
  • Posts: 5
Re: Problems Using SHT 30-D
« Reply #4 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.)