Temperature, humidity and air
SHT31 / SHT3x with ESP32
Sensirion's SHT31 is the sensor to pick when humidity matters more than pressure. Sensirion lists ±2 %RH and 0.2 °C typical accuracy, against ±3 %RH for a BME280. It does nothing else, which keeps the chip tiny and the code short.
It runs from about 2.4 to 5.5 V and talks I2C, so it connects directly to an ESP32 at 3.3 V. Sensirion's SHT3x family has more members with different accuracy, but the wiring and most code are the same. Modules commonly use address 0x44, and many expose an ADDR pin to move it to 0x45 if you need two sensors.
The chip contains a small heater, used to drive condensation off the sensor in very humid air. Leave it off for normal readings, because it raises the measured temperature. As with any humidity sensor, placement decides the result: keep it out of warm air from the display board, and give it airflow if it lives in a case.

Specifications
| Measures | Temperature and humidity |
|---|---|
| Supply | 2.4–5.5 V (Sensirion table) |
| Humidity accuracy | ±2 %RH typical |
| Temperature accuracy | 0.2 °C typical |
| Humidity response | 8 s (τ63%) |
| Interface | I2C |
| Common module address | 0x44, or 0x45 with ADDR high |
Power and logic levels
3.3 V: safe to connect directly
| Supply | 2.15–5.5 V, use 3V3 |
|---|---|
| Signal level | I2C follows the module pull-ups |
| On an ESP32 | Run it from 3V3, so the I2C lines stay at 3.3 V. |
ESP32 pins, including those on a display board's connectors, work at 3.3 V and are not 5 V tolerant. Modules differ, so if in doubt, measure the signal before you connect it.
Wiring
| SHT31 / SHT3x | Connect to | Note |
|---|---|---|
| VCC | 3V3 | Check the module: the bare sensor is not 5 V |
| GND | GND | |
| SDA | GPIO 8 | Any free pin, set in Wire.begin() |
| SCL | GPIO 9 | Any free pin, set in Wire.begin() |
Arduino code
#include <Wire.h>
#include <Adafruit_SHT31.h>
const int SDA_PIN = 8, SCL_PIN = 9; // use your board's I2C pins
Adafruit_SHT31 sht;
void setup() {
Serial.begin(115200);
Wire.begin(SDA_PIN, SCL_PIN);
if (!sht.begin(0x44)) {
Serial.println("SHT31 not found: check wiring or try 0x45");
while (true) delay(1000);
}
}
void loop() {
Serial.printf("%.2f C %.1f %%\n", sht.readTemperature(), sht.readHumidity());
delay(2000);
}
Needs the Adafruit SHT31 library. Compiled for ESP32-S3 with arduino-esp32 3.x. Not yet tested by us on a physical sensor. Change the pins to match your board.
On a display
LCD Ultra Pro has this sensor as a built-in value source. Choose it in a rule, and a label or gauge shows the reading without writing code.
Design a display for SHT31 / SHT3xBoards with a ready connector
Only boards whose connectors we have surveyed. Others may still work on free GPIOs.
| Elecrow CrowPanel ESP32 HMI 2.4" | I2C port: SDA 22, SCL 21Not shared with the touch controller (it is on SPI) — free for sensors |
| Elecrow CrowPanel ESP32 HMI 2.8" | I2C port: SDA 22, SCL 21Not shared with the touch controller (it is on SPI) — free for sensors |
| Elecrow CrowPanel ESP32 HMI 3.5" | I2C port: SDA 22, SCL 21Not shared with the touch controller (it is on SPI) — free for sensors |
| Elecrow CrowPanel ESP32-S3 HMI 5.0" | I2C port: SDA 19, SCL 20Same I2C bus as the GT911 touch (0x14 / 0x5D) and, on V3.0 boards, the PCA9557 touch-reset expander (0x18) |
| Elecrow CrowPanel ESP32-S3 HMI 7.0" | I2C port: SDA 19, SCL 20Same I2C bus as the GT911 touch (0x14 / 0x5D) and, on V3.0 boards, the PCA9557 touch-reset expander (0x18) |
| LilyGO T-Display-S3-Pro 2.33" | QWIIC RIGHT: SDA 5, SCL 6I2C only — same bus as the touch, the PMU (SY6970) and the light sensor |
| M5Stack AtomS3 0.85" | Bottom I2C pins: SDA 38, SCL 39Same I2C bus as the built-in IMU (MPU6886, 0x68) |
| Makerfabs MaTouch ESP32-S3 Rotary IPS 2.1 Round | Mabee I2C (J1): SDA 17, SCL 18Same I2C bus as the touch controller (CST826) |
| Makerfabs MaTouch ESP32-S3 Parallel TFT 4.3" | Mabee I2C: SDA 17, SCL 18Same I2C bus as the touch controller (GT911) |
| Makerfabs MaTouch ESP32-S3 Parallel TFT with Touch 5.0" | Mabee I2C: SDA 17, SCL 18Same I2C bus as the touch controller (GT911) |
| Makerfabs MaTouch ESP32-S3 Parallel TFT with Touch 7.0" | Mabee I2C: SDA 17, SCL 18Same I2C bus as the touch controller (GT911) |
| Sunton ESP32-4827S043R/C 4.3" | I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18. |
| Sunton ESP32-8048S043C 4.3" | I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18. |
| Sunton ESP32-8048S050C 5.0" | I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18. |
| Sunton ESP32-8048S070C 7.0" | I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18. |
| Waveshare ESP32-S3 Touch LCD 2.1" round | I2C connector: SDA 15, SCL 7Same I2C bus as the touch controller, the IO expander, the RTC and the IMU (addresses 0x15/0x5D, 0x20, 0x51, 0x6B, 0x7E taken) |
| Waveshare ESP32-S3 Touch LCD 2.8" | I2C connector: SDA 11, SCL 10Same I2C bus as the RTC and the IMU (0x51, 0x6B, 0x7E taken) — the touch has its own bus |
| Waveshare ESP32-S3 Touch LCD 2.8" Type B | I2C connector: SDA 15, SCL 7Same I2C bus as the touch controller, the IO expander, the RTC and the IMU (addresses 0x15/0x5D, 0x20, 0x51, 0x6B, 0x7E taken) |
| Waveshare ESP32-S3-Touch-LCD-2.8C | I2C connector: SDA 15, SCL 7Same I2C bus as the touch controller, the IO expander, the RTC and the IMU (addresses 0x15/0x5D, 0x20, 0x51, 0x6B, 0x7E taken) |
| Waveshare ESP32-S3-LCD-7B | I2C connector (H1): SDA 8, SCL 9Same I2C bus as the touch controller (GT911) and the IO expander (CH422G) |
Good to know
- Leave the heater off for normal readings.
- Modules usually use 0x44. The ADDR pin selects 0x45.
- Keep it out of the warm air around the display board.
What it is good for
- Greenhouse and humidor monitors
- Thermostats
- Bathroom and cellar humidity control
FAQ
Is the SHT31 more accurate than the BME280?
Sensirion lists ±2 %RH typical for the SHT31-DIS-B, while the BME280 is around ±3 %RH.
What is the SHT31 I2C address?
Usually 0x44, or 0x45 when the ADDR pin is high.
What is the heater for?
It removes condensation in very humid conditions. Keep it off for normal measuring.
Sources
Related parts
Use this information at your own risk. It is for general guidance only: the example code compiles, but it has not been tested on every part, and modules differ between sellers. Check the manufacturer's data before you build. Product names belong to their owners, and LCD Ultra Pro is not affiliated with them. See our Terms.