

The SHT31, manufactured by Sensirion, is a digital humidity and temperature sensor designed to deliver accurate and reliable environmental measurements. It combines a capacitive humidity sensor and a band-gap temperature sensor on a single chip, providing high precision and fast response times. The SHT31 communicates via an I²C interface, making it easy to integrate into a wide range of applications.








The SHT31 sensor is designed for high performance and ease of use. Below are its key technical details:
| Parameter | Value |
|---|---|
| Supply Voltage (VDD) | 2.4V to 5.5V |
| Average Current | 2 µA (at 1 measurement per second) |
| Measurement Range | Humidity: 0% to 100% RH |
| Temperature: -40°C to 125°C | |
| Accuracy (Typical) | Humidity: ±2% RH |
| Temperature: ±0.3°C | |
| Communication Interface | I²C (up to 1 MHz) |
| Response Time (τ63%) | 8 seconds (for humidity) |
| Operating Temperature | -40°C to 125°C |
| Storage Temperature | -40°C to 125°C |
| Dimensions | 2.5 mm x 2.5 mm x 0.9 mm |
The SHT31 is typically available in a 4-pin package. Below is the pinout description:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | VDD | Power supply (2.4V to 5.5V) |
| 2 | SDA | Serial Data Line for I²C communication |
| 3 | GND | Ground |
| 4 | SCL | Serial Clock Line for I²C communication |
The SHT31 is straightforward to use in a circuit, thanks to its I²C interface. Below are the steps and considerations for integrating the sensor:
Below is an example of how to use the SHT31 with an Arduino UNO. This code reads temperature and humidity values and displays them on the Serial Monitor.
#include <Wire.h>
#include "Adafruit_SHT31.h"
// Create an instance of the SHT31 sensor
Adafruit_SHT31 sht31 = Adafruit_SHT31();
void setup() {
Serial.begin(9600); // Initialize Serial Monitor at 9600 baud
Wire.begin(); // Initialize I²C communication
// Initialize the SHT31 sensor
if (!sht31.begin(0x44)) { // 0x44 is the default I²C address
Serial.println("SHT31 sensor not found. Check wiring!");
while (1); // Halt execution if sensor is not found
}
Serial.println("SHT31 sensor initialized successfully.");
}
void loop() {
// Read temperature and humidity
float temperature = sht31.readTemperature();
float humidity = sht31.readHumidity();
// Check if readings are valid
if (!isnan(temperature) && !isnan(humidity)) {
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
} else {
Serial.println("Failed to read from SHT31 sensor.");
}
delay(2000); // Wait 2 seconds before the next reading
}
Adafruit_SHT31 library is used in this example. Install it via the Arduino Library Manager.0x44. If your sensor uses 0x45, update the sht31.begin() call accordingly.Sensor not detected by the microcontroller:
0x44).Incorrect or unstable readings:
Library not found or compilation errors:
Adafruit_SHT31 library is installed correctly.Q: Can the SHT31 measure both temperature and humidity simultaneously?
A: Yes, the SHT31 can measure both parameters in a single operation, and the readings are available via the I²C interface.
Q: What is the typical lifespan of the SHT31 sensor?
A: The sensor is designed for long-term use and can operate reliably for several years under normal conditions.
Q: Can I use the SHT31 with a 5V microcontroller?
A: Yes, the SHT31 supports a supply voltage range of 2.4V to 5.5V, making it compatible with both 3.3V and 5V systems.
Q: How do I protect the sensor in harsh environments?
A: Use a protective cover or filter to shield the sensor from dust, water, and other contaminants while allowing air to pass through.
By following the guidelines and best practices outlined in this documentation, you can effectively integrate the SHT31 sensor into your projects and achieve accurate environmental measurements.