ESP32 SHT31 / SHT31-D / GY-SHT31 / SI7021 Temperature and Humidity Sensor

SHT31 / SHT31-D / GY-SHT31 / SI7021 Temperature and Humidity Sensor image

SHT31 / SHT31-D / GY-SHT31 / SI7021

Protocol: I2C

Overview

The SHT31 series sensors utilize Sensirion's CMOSens® technology to deliver accurate, stable, and linear temperature and humidity data. Their robust calibration and long-term reliability make them ideal for applications that require consistent performance under varying conditions.

About SHT31 / SHT31-D / GY-SHT31 / SI7021 Temperature and Humidity Sensor

The SHT31, SHT31-D, GY-SHT31, and SI7021 sensors share a similar architecture, delivering high-accuracy temperature and humidity measurements. An improvement over the SHT30, the SHT31 series offers enhanced reliability and performance, making it ideal for HVAC systems, environmental monitoring, data logging, and IoT applications.

Key Features

  • Improved Accuracy & Stability – More precise than previous models.
  • I²C Communication – Seamless integration with ESP32, Arduino, and microcontrollers.
  • Enhanced Performance – Faster response time and better long-term reliability.
  • Versatile Applications – Used in industrial, smart home, and scientific monitoring systems.

With its higher precision and durability, the SHT31 series is a great choice for demanding climate monitoring applications. 🚀

For applications demanding even higher precision, faster response times, or specialized features, consider the SHT35 sensor, which provides superior performance for demanding environments.

Where to Buy

SHT31 / SHT31-D / GY-SHT31 / SI7021 Temperature and Humidity Sensor

Starting from

$6 per unit

Amazon com
Amazon.com Ships worldwide
View Price
Amazon de
Amazon.de Ships to EU
View Price
Aliexpress
AliExpress Best value
View Price

Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.

Technical Specifications

Operating Voltage 2.15V to 5.5V
Temperature Range -40°C to 125°C
Humidity Range 0% to 100% RH
Temperature Accuracy ±0.2°C
Humidity Accuracy ±2% RH
Interface I2C
Dimensions 2.5mm x 2.5mm x 0.9mm

Pinout Configuration

The VCC pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND pin is the ground connection and must be connected to the ground of your ESP32.

The SHT31 pinout is as follows:

  • VDD: Power supply voltage (2.15V to 5.5V).
  • GND: Ground.
  • SDA: Serial Data Line for I2C communication.
  • SCL: Serial Clock Line for I2C communication.

Wiring with ESP32

To interface the SHT31 sensor with an ESP32:
  • Connect VDD to the 3.3V pin on the ESP32.
  • Connect GND to the ground (GND) of the ESP32.
  • Connect SDA to the ESP32's GPIO21 (default I2C data pin).
  • Connect SCL to the ESP32's GPIO22 (default I2C clock pin).
  • Place pull-up resistors (10kΩ) between SDA and VDD, and SCL and VDD, to ensure reliable communication.

Troubleshooting Guide

Common Issues

⏸️ Sensor Stops Working After a Minute

❄️ Incorrect Negative Temperature Readings

💻 Compilation Error: 'Wire1' Not Declared

❌ Sensor Not Detected at Expected I2C Address

Debugging Tips

🔍 Serial Monitor

⚡ Voltage Checks

Code Examples

Arduino Example

C++
🔧

ESP-IDF Example

C++
🏠

ESPHome Example

YAML
🛠️

PlatformIO Example

C++
🐍

MicroPython Example

Python

Conclusion

The ESP32 SHT31 / SHT31-D / GY-SHT31 / SI7021 Temperature and Humidity Sensor is a powerful environment sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.