Lora V3 with SHT31-D

Hello,

i am trying to make my first steps with LoRa and struggeling with the code.
I want to set up a temperature and humidity sensor with a SHT31-D and the Lora V3 board.

The Problem is, that the sketch did not find the SHT31-D, but when i am set up a I²C Scanner, it find
the Sensor without any problems at the id 0x44…

Did anyone have an idea what i am doing wrong? (These are my first steps, so i hope that i am be able one day to set up a local LoRa network…

#include <Wire.h>              
#include "HT_SSD1306Wire.h"
#include "Adafruit_SHT31.h"                       // Temperatursensor
#include <Arduino.h>
#include "DHT.h"

/* definitions for deepsleep */
#define uS_TO_S_FACTOR 1000000          /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 300                   /* Time ESP32 will go to sleep for 5 minutes (in seconds) */
#define TIME_TO_SLEEP_ERROR 3600             /* Time to sleep in case of error (1 hour) */

SSD1306Wire  display(0x3c, 500000, SDA_OLED, SCL_OLED, GEOMETRY_128_64, RST_OLED); // addr , freq , i2c group , resolution , rst

Adafruit_SHT31 sht31 = Adafruit_SHT31();
DHT dht(25, DHT22);
RTC_DATA_ATTR int bootCount = 0;
const int SCLpin = 42;
const int SDApin = 41;

void setup() {

  VextON();
  display.init();
  display.setFont(ArialMT_Plain_10);
  startup();
  Temperatursensor();
  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); //go to sleep
  Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) + " Seconds");
  Serial.println("Boot number: " + String(bootCount));
  Serial.println("Going to sleep");
  display.clear();      // clear the displa
  display.drawString(64, 15, "Going to sleep");
  display.drawString(64, 35, String(bootCount));
  display.display();
  delay(750);
  display.clear();      // clear the display
  esp_deep_sleep_start();
}

void loop() {

}

void startup(){

  display.clear();      // clear the display
  display.drawProgressBar(0, 32, 120, 10, 0);
  display.setTextAlignment(TEXT_ALIGN_CENTER);
  display.drawString(64, 15, "0%");
  display.display();
  delay(200);
  Serial.begin(115200);
  Wire.begin();
  Wire.setClock(20000);                             //I²C Frequenz auf 20Khz setzen, Standard its 100kHz
  display.clear();      // clear the display
  display.drawProgressBar(0, 32, 120, 10, 50);
  display.drawString(64, 15, "50%");
  display.display();
  delay(200);
  ++bootCount;
  display.clear();      // clear the display
  display.drawProgressBar(0, 32, 120, 10, 100);
  display.drawString(64, 15, "100%");
  display.display();
  delay(200);
  Serial.println();
  Serial.println("Setup is completed!");
  delay(200);

}

void Temperatursensor(){

  display.clear();      // clear the display
  delay(250);  
  display.setTextAlignment(TEXT_ALIGN_CENTER);
  display.drawString(64, 15, "Temperaturmessung");
  display.display();

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

  float t = sht31.readTemperature();
  float h = sht31.readHumidity();
  float heatindex = dht.computeHeatIndex(t, h);
  double VaporPressureValue = h * 0.01 * 6.112 * exp((17.62 * t) / (t + 243.12));
  double Numerator = 243.12 * log(VaporPressureValue) - 440.1;
  double Denominator = 19.43 - (log(VaporPressureValue));
  double DewPoint = (Numerator / Denominator);
  Serial.print("Temperature : ");
  Serial.println(t);
  Serial.print("Humidity: ");
  Serial.println(h);
  Serial.print("Hitzeindex : ");
  Serial.println(heatindex);
  Serial.print("Taupunkt: ");
  Serial.println(DewPoint);
  delay(250);

  }

void VextON(void)

{

  pinMode(Vext,OUTPUT);
  digitalWrite(Vext, LOW);

}

void VextOFF(void) //Vext default OFF

{

  pinMode(Vext,OUTPUT);
  digitalWrite(Vext, HIGH);

}

I think you’ll find that you’re not addressing the correct I2C bus when trying to access the SHT31-D sensor—it should be on the second I2C bus (Wire1), the first I2C bus (Wire) is used for the OLED display and is not broken out on the V3 boards for any other use.

Maybe check out the following

for starters, but a search on these forums for “wifi lora v3 i2c” will return a number of posts discussing the underlying issue.