SHT-85 init failed

I have a SHT-85 sensor connected to my Arduino Uno with the following wiring:

1 SCL - A5 analog in
2 VDD - 3.3V
3 VSS - GND
4 SDA - A4 analog in

I installed the arduino-sht library to Arduino IDE and uploaded the following code:

#include <SHTSensor.h>

#include <Wire.h>

SHTSensor sht;
// To use a specific sensor instead of probing the bus use this command:
// SHTSensor sht(SHTSensor::SHT3X);

void setup() {
  // put your setup code here, to run once:

  Wire.begin();
  Serial.begin(9600);
  delay(1000); // let serial console settle

  if (sht.init()) {
      Serial.println("init(): success\n");
  } else {
      Serial.println("init(): failed\n");
  }
  sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM); // only supported by SHT3x

}

void loop() {
  // put your main code here, to run repeatedly:

  if (sht.readSample()) {
      Serial.println("SHT:\n");
      Serial.println("  RH: ");
      Serial.println(sht.getHumidity(), 2);
      Serial.println("\n");
      Serial.println("  T:  ");
      Serial.println(sht.getTemperature(), 2);
      Serial.println("\n");
  } else {
      Serial.println("Error in readSample()\n");
  }

  delay(2000);
}

Now, this results in the Serial Monitor returning exactly nothing.

So something is wrong either in the wiring or in the code. I have already tried the following:

  • Switch the SCL and SDA. This results in the "init(): failed" and "error in readSample()" at every attempt at reading.

  • Use 5V instead. No change

  • Downgrade to earlier versions of the sht library. No change.

Somebody who has experienced the same problem? Any help is greatly appreciated!

Is an I2C sensor

Why not use the I2C pins?

image

Thanks for your reply.
But tried that too, doesn't work.

Start with a basic I2C scanner sketch - does it detect your device?

Arduino UNO A4 and A5 is I2C too.

Run the I2C scanner to make sure that your module is communicating with the UNO and which I2C address is defined.

https://playground.arduino.cc/Main/I2cScanner/

It says nothing at all, or just the letter "I" (with SDA and SCL switched).

So, apparently the only way to get this working is to use the 1.0.1 arduino-sht library with the 1.8.18 Arduino IDE.

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