SHT41 / SHT41-D / GY-SHT41-D Temperature and Humidity Sensor

View on Amazon
Overview
About SHT41 / SHT41-D / GY-SHT41-D Temperature and Humidity Sensor
The SHT41, SHT41-D, and GY-SHT41-D, developed by Sensirion, are high-accuracy digital sensors from the SHT4x series. They provide fully calibrated, linearized, and temperature-compensated digital outputs, making them ideal for demanding applications such as environmental monitoring, industrial automation, and IoT devices.
⚡ Key Features
- Exceptional Accuracy – Ensures precise temperature and humidity measurements.
- Pre-Calibrated & Temperature-Compensated – Ready for immediate, reliable use.
- I²C Communication – Easily integrates with ESP32, Arduino, and embedded systems.
- Industrial-Grade Reliability – Ideal for HVAC, weather monitoring, and automation.
With their high precision and stability, the SHT41 series sensors are perfect for advanced climate monitoring applications. 🚀
Get Your SHT41 / SHT41-D / GY-SHT41-D
💡 Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
SHT41 / SHT41-D / GY-SHT41-D Specifications
Complete technical specification details for SHT41 / SHT41-D / GY-SHT41-D Temperature and Humidity Sensor
📊 Technical Parameters
SHT41 / SHT41-D / GY-SHT41-D Pinout
The SHT41 uses standard I²C communication with 4 pins, offering high accuracy with wide voltage range.
Pin Descriptions
| Pin Name | Type | Description | Notes |
|---|---|---|---|
1 VDD | Power | Power supply input (2.4V to 5.5V) | Wide voltage range for flexible applications |
2 GND | Power | Ground connection | Connect to ESP32 ground |
3 SDA | Communication | I²C data line | Bidirectional data communication |
4 SCL | Communication | I²C clock line | Clock signal from master device |
Wiring SHT41 / SHT41-D / GY-SHT41-D to ESP32
Connect the SHT41 using standard I²C interface for accurate environmental sensing.
Visual Wiring Diagram

Connection Status
Protocol
Pin Connections
| SHT41 / SHT41-D / GY-SHT41-D Pin | Connection | ESP32 Pin | Description |
|---|---|---|---|
1 VDD Required | 3.3V | Power supply (2.4V to 5.5V supported) | |
2 GND Required | GND | Ground connection | |
3 SDA Required | GPIO21 | I²C data line (default SDA) | |
4 SCL Required | GPIO22 | I²C clock line (default SCL) |
GPIO21/22 are default I²C pins on ESP32
I²C address is 0x44 (fixed)
Add 10kΩ pull-up resistors on SDA/SCL if needed
Can share I²C bus with other devices
SHT41 / SHT41-D / GY-SHT41-D Troubleshooting
Common issues and solutions to help you get your sensor working
Common Issues
Issue: The SHT41 sensor exhibits unreliable behavior when connected to an ESP32. Some sensors function without issues, while others intermittently stop working or cause the ESP32 to freeze. The error message observed is: Recovery failed: SCL is held LOW on the i2c.
Possible causes include insufficient pull-up resistors on the I2C lines, leading to communication instability.
Solution: Ensure that appropriate pull-up resistors are present on the SDA and SCL lines. If the sensor board lacks built-in pull-ups, add external resistors (typically 4.7kΩ to 10kΩ) to stabilize the I2C communication. Additionally, verify that the power supply is stable and that all connections are secure. ([forum.arduino.cc](https://forum.arduino.cc/t/what-causes-my-sht41-to-stop-working-on-esp32/1304760))
Issue: The SHT41 sensor reports temperature readings higher than the actual ambient temperature. This discrepancy is often due to self-heating caused by nearby components on the PCB, such as microcontrollers, voltage regulators, or LEDs.
Possible causes include heat generated by adjacent components affecting the sensor's measurements.
Solution: To minimize self-heating effects, consider the following approaches:
- Isolate the sensor from heat-generating components by placing it on a separate PCB or using physical barriers.
- Implement duty-cycling in your code to reduce the sensor's active time, thereby decreasing heat accumulation.
- Ensure adequate ventilation around the sensor to dissipate heat effectively.
Issue: When attempting to read data from the SHT41 sensor using an ESP32 with MicroPython, the following error occurs: OSError: [Errno 19] ENODEV. This error arises during the I2C read operation, despite the sensor being detected at address 0x44 during scanning.
Possible causes include improper I2C communication sequences or timing issues.
Solution: Implement a soft reset of the sensor before initiating data reads. This can be achieved by sending the appropriate reset command as specified in the sensor's datasheet. Additionally, ensure that the I2C communication follows the correct sequence and adheres to the timing requirements outlined by the manufacturer. ([github.com](https://github.com/orgs/micropython/discussions/9844))
Issue: When using the SHT4x Smart Gadget to read data from an external SHT41-AD1B sensor, the display shows values like 3.0 for temperature and 0.1 for humidity, which are incorrect.
Possible causes include improper connection or configuration of the external sensor.
Solution: Verify that the external sensor is correctly connected to the Smart Gadget, ensuring proper alignment and secure connections. Consult the Smart Gadget's user manual to confirm that it supports the specific sensor model and that any necessary configuration settings are correctly applied. ([forum.digikey.com](https://forum.digikey.com/t/what-causes-sht4x-smart-gadget-reading-error-how-to-fix-it/28248))
Debugging Tips
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
SHT41 / SHT41-D / GY-SHT41-D Programming Examples
Ready-to-use code examples for different platforms and frameworks
#include <Wire.h>
#include "Adafruit_SHT4x.h"
Adafruit_SHT4x sht4;
void setup() {
Serial.begin(115200);
if (!sht4.begin()) {
Serial.println("Couldn't find SHT41 sensor!");
while (1) delay(10);
}
sht4.setPrecision(SHT4X_HIGH_PRECISION);
Serial.println("SHT41 initialized");
}
void loop() {
sensors_event_t humidity, temp;
if (!sht4.getEvent(&humidity, &temp)) {
Serial.println("Failed to read sensor data");
return;
}
Serial.print("Temperature: "); Serial.print(temp.temperature); Serial.println(" °C");
Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println(" %");
delay(2000);
}#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/i2c.h"
#define I2C_MASTER_SCL_IO 22 /*!< GPIO number for I2C master clock */
#define I2C_MASTER_SDA_IO 21 /*!< GPIO number for I2C master data */
#define I2C_MASTER_NUM I2C_NUM_0 /*!< I2C master port */
#define I2C_MASTER_FREQ_HZ 100000 /*!< I2C master clock frequency */
#define SHT41_SENSOR_ADDR 0x44 /*!< SHT41 I2C address */
static esp_err_t i2c_master_init(void) {
i2c_config_t conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = I2C_MASTER_SDA_IO,
.scl_io_num = I2C_MASTER_SCL_IO,
.sda_pullup_en = GPIO_PULLUP_ENABLE,
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.master.clk_speed = I2C_MASTER_FREQ_HZ,
};
ESP_ERROR_CHECK(i2c_param_config(I2C_MASTER_NUM, &conf));
return i2c_driver_install(I2C_MASTER_NUM, conf.mode, 0, 0, 0);
}
void read_sht41_sensor() {
uint8_t data[6];
uint8_t cmd[] = {0xFD}; // High precision measurement command
i2c_master_write_to_device(I2C_MASTER_NUM, SHT41_SENSOR_ADDR, cmd, 1, pdMS_TO_TICKS(1000));
vTaskDelay(pdMS_TO_TICKS(10));
i2c_master_read_from_device(I2C_MASTER_NUM, SHT41_SENSOR_ADDR, data, 6, pdMS_TO_TICKS(1000));
uint16_t temp_raw = (data[0] << 8) | data[1];
uint16_t hum_raw = (data[3] << 8) | data[4];
float temperature = -45 + 175 * ((float)temp_raw / 65535.0);
float humidity = 100 * ((float)hum_raw / 65535.0);
printf("Temperature: %.2f °C, Humidity: %.2f %%\n", temperature, humidity);
}
void app_main() {
ESP_ERROR_CHECK(i2c_master_init());
while (1) {
read_sht41_sensor();
vTaskDelay(pdMS_TO_TICKS(2000));
}
}sensor:
- platform: sht4x
address: 0x44
temperature:
name: "Room Temperature"
humidity:
name: "Room Humidity"
update_interval: 60splatformio.ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
adafruit/Adafruit SHT4x Library @ ^1.0.0
monitor_speed = 115200main.cpp
#include <Wire.h>
#include "Adafruit_SHT4x.h"
Adafruit_SHT4x sht4;
void setup() {
Serial.begin(115200);
if (!sht4.begin()) {
Serial.println("Couldn't find SHT41 sensor!");
while (1) delay(10);
}
sht4.setPrecision(SHT4X_HIGH_PRECISION);
Serial.println("SHT41 initialized.");
}
void loop() {
sensors_event_t temp, humidity;
if (!sht4.getEvent(&humidity, &temp)) {
Serial.println("Failed to read sensor data");
return;
}
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity.relative_humidity);
Serial.println(" %");
delay(2000);
}from machine import I2C, Pin
from time import sleep
# Initialize I2C interface
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
# SHT41 I2C address
SHT41_ADDR = 0x44
# Command for high-precision measurement
MEASURE_CMD = b'\xFD'
while True:
try:
i2c.writeto(SHT41_ADDR, MEASURE_CMD)
sleep(0.01) # Wait for measurement to complete
data = i2c.readfrom(SHT41_ADDR, 6)
raw_temp = (data[0] << 8) | data[1]
raw_hum = (data[3] << 8) | data[4]
temperature = -45 + 175 * (raw_temp / 65535.0)
humidity = 100 * (raw_hum / 65535.0)
print("Temperature: {:.2f} °C".format(temperature))
print("Humidity: {:.2f} %".format(humidity))
except Exception as e:
print("Error reading SHT41: ", e)
sleep(2)Wrapping Up SHT41 / SHT41-D / GY-SHT41-D
The ESP32 SHT41 / SHT41-D / GY-SHT41-D 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.
Best Practices
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Safety First
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.
Ready to Start Building?
Now that you have all the information you need, it's time to integrate the SHT41 / SHT41-D / GY-SHT41-D into your ESP32 project and bring your ideas to life!
Explore Alternative Sensors
Looking for alternatives to the SHT41 / SHT41-D / GY-SHT41-D? Check out these similar sensors that might fit your project needs.

BME680 Environmental Sensor
The BME680 is a versatile environmental sensor capable of measuring air quality (VOCs), temperature, humidity, and pressure. It supports I2C...

AHT10 Temperature and Humidity Sensor
The AHT10 is an advanced, fully calibrated, and highly integrated temperature and humidity sensor that provides reliable, precise...

DHT21 / AM2301A Temperature and Humidity Sensor
The DHT21 is a reliable sensor for measuring temperature and humidity, offering calibrated digital output and ease of integration with...





