How to use and where to connect the SHT31 on the arduino nano 33 IoT

Greetings!

I am very new to the arduino community and eco system - so please be understanding. I would like to ask a rather "dumb" question. Some backstory - I bought an arduno nano 33 IoT with a SHT31 temperature and humudity sensor. Does anyone have any idea on which pins to connect the sensor and how to interface it. I am looking forward to hearing from you guys!

Hi @voyant

Welcome to the forum!

I personally haven't used either of those parts, but I think I get what you are asking.

Connections:
Arduino SHT31
+5V VIN
GND GND
SCL SCL
SDA SDA

Tutorials, pinouts, etc. etc.

Note: I2C address is either 0x44 or 0x45.

Hope this helps!

I will be sure to try that - that guide is super useful as far as I see, I will keep you updated. Thank you in advance!

UPDATE!!

I got it working! Finally! I have drawn a little diagram which consists of where to connect the wires.


Here's my code:

#include <Arduino.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"

bool enableHeater = false;

Adafruit_SHT31 sht31 = Adafruit_SHT31();

void setup() {
  Serial.begin(9600);

  while (!Serial)
    delay(10);

  Serial.println("SHT31 test");
  if (! sht31.begin(0x44)) {
    Serial.println("Couldn't find SHT31");
    while (1) delay(1);
  }

  Serial.print("Heater Enabled State: ");
  if (sht31.isHeaterEnabled())
    Serial.println("ENABLED");
  else
    Serial.println("DISABLED");
}


void loop() {
  float t = sht31.readTemperature();
  float h = sht31.readHumidity();

  Serial.println(sht31.readTemperature());

  if (! isnan(t)) {
    Serial.print("Temp *C = "); Serial.print(t); Serial.print("\t\t");
  } else { 
    Serial.println("Failed to read temperature");
  }
  
  if (! isnan(h)) {
    Serial.print("Hum. % = "); Serial.println(h);
  } else { 
    Serial.println("Failed to read humidity");
  }
  
  if (millis() % 30000 == 0) {
    enableHeater = !enableHeater;
    sht31.heater(enableHeater);
    Serial.print("Heater Enabled State: ");
    if (sht31.isHeaterEnabled())
      Serial.println("ENABLED");
    else
      Serial.println("DISABLED");
  }
}
1 Like

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