In this example we will connect an SHT30 shield to our MH ET LIVE ESP32 MINI KIT, here is the shield
SHT30 Shield For WeMos D1 mini SHT30 I2C Digital Temperature and Humidity Sensor Module
SHT3x-DIS is the next generation of Sensirion’s temperature and humidity sensors. It builds on a new CMOSens® sensor chip that is at the heart of Sensirion’s new humidity and temperature platform. The SHT3x-DIS has increased intelligence, reliability and improved accuracy specifications compared to its predecessor. Its functionality includes enhanced signal processing, two distinctive and user selectable I2C addresses and communication speeds of up to 1 MHz.
The DFN package has a footprint of 2.5 x 2.5 mm while keeping a height of 0.9 mm. This allows for integration of the SHT3x-DIS into a great variety of applications.
Additionally, the wide supply voltage range of 2.4 to 5.5 V guarantees compatibility with diverse assembly situations. All in all, the SHT3x-DIS incorporates 15 years of knowledge of Sensirion, the leader in the humidity sensor industry.
Code
This example uses the adafruit sht31 library – https://github.com/adafruit/Adafruit_SHT31
[cpp]
#include <Arduino.h>
#include <Wire.h>
#include “Adafruit_SHT31.h”
Adafruit_SHT31 sht31 = Adafruit_SHT31();
void setup()
{
Serial.begin(9600);
Serial.println(“SHT31 test”);
if (! sht31.begin(0x45))
{
Serial.println(“Couldn't find SHT31”);
while (1) delay(1);
}
}
void loop()
{
float t = sht31.readTemperature();
float h = sht31.readHumidity();
if (! isnan(t))
{ // check if ‘is not a number'
Serial.print(“Temp *C = “); Serial.println(t);
}
else
{
Serial.println(“Failed to read temperature”);
}
if (! isnan(h))
{ // check if ‘is not a number'
Serial.print(“Hum. % = “); Serial.println(h);
}
else
{
Serial.println(“Failed to read humidity”);
}
Serial.println();
delay(1000);
}
[/cpp]
Output
Open the serial monitor
Temp *C = 27.09
Hum. % = 38.13
Temp *C = 29.39
Hum. % = 42.54
Temp *C = 30.67
Hum. % = 52.62
Temp *C = 31.08
Hum. % = 58.37
Temp *C = 31.05
Hum. % = 60.80
Temp *C = 29.83
Hum. % = 50.91
Temp *C = 29.50
Hum. % = 44.09
Link
SHT30 Shield For WeMos D1 mini SHT30 I2C Digital Temperature and Humidity Sensor Module