Reference
SHT40 / SHT41 Temperature and Humidity Sensor Complete Guide
Sensirion's fourth-generation SHT4x sensors trade the SHT3x series' heater-based self-test for an ultra-low idle power budget and a slightly tighter accuracy spec. This guide covers wiring an SHT40 or SHT41 to an ESP32, real I2C addressing, and which SHT generation actually makes sense for a new project.
The SHT40 and SHT41 are Sensirion’s newer SHT4x-series digital temperature and humidity sensors, the generation after the already-published SHT3x series. They’re factory-calibrated, communicate over I2C, and are common on small breakout boards from Adafruit, SparkFun and generic sellers.
SHT40 vs. SHT41: what's actually different
Both chips share the same package, pinout and I2C command set, the difference is factory-trimmed accuracy:
| Model | Typical humidity accuracy | Typical temperature accuracy |
|---|---|---|
| SHT40 | ±1.8% RH | ±0.2°C |
| SHT41 | ±1.8% RH (tighter tolerance band than SHT40) | ±0.2°C |
In practice the two are close enough that most hobby projects won’t notice a difference, buy whichever your supplier stocks. Unlike some SHT3x variants, the SHT4x family has no heater-based self-test cycle, instead it has a built-in heater purely for demisting the sensor in condensing environments, a genuinely different feature, not a self-check.
Pinout and I2C Address
| Pin | Function |
|---|---|
| VCC | Power, 1.08V–3.6V depending on breakout |
| GND | Ground |
| SDA | I2C data |
| SCL | I2C clock |
The SHT4x family ships with one of two fixed I2C addresses depending on the exact part number: 0x44 (SHT40-AD1B/SHT41-AD1B, the address almost every breakout board uses) or 0x45 (the -BD1B variant). Check your specific board’s datasheet if 0x44 doesn’t show up on an I2C scan, there’s no address-select pin to change it in software.
Idle power draw is genuinely tiny, around 0.4µW, which is the SHT4x family’s real headline feature over SHT3x for battery-powered projects.
Wiring to an ESP32
| SHT4x Pin | ESP32 Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| SDA | GPIO21 |
| SCL | GPIO22 |
Arduino code (Adafruit SHT4x library)
#include <Wire.h>
#include "Adafruit_SHT4x.h"
Adafruit_SHT4x sht4 = Adafruit_SHT4x();
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
if (!sht4.begin()) {
Serial.println("Couldn't find SHT4x sensor!");
while (1) delay(10);
}
sht4.setPrecision(SHT4X_HIGH_PRECISION);
}
void loop() {
sensors_event_t humidity, temp;
sht4.getEvent(&humidity, &temp);
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.print(" degC Humidity: ");
Serial.print(humidity.relative_humidity);
Serial.println(" %RH");
delay(2000);
}Install “Adafruit SHT4x Library” via the Arduino Library Manager, it depends on Adafruit’s BusIO and Unified Sensor libraries.
SHT3x or SHT4x: which should you buy?
Honest answer: for most indoor projects it doesn’t matter much, both are accurate, reliable, factory-calibrated I2C sensors from the same manufacturer. Pick SHT4x specifically if idle power draw genuinely matters (a coin-cell or solar-powered sensor node), the ~0.4µW idle figure is a real, meaningful improvement over SHT3x’s idle current. Pick SHT3x if your supplier already stocks it cheaper or you need its optional ALERT pin, which most SHT4x breakouts drop. See the SHT3x series guide for that generation’s own wiring and code.
Conclusion
The SHT40/SHT41 give you the same reliable Sensirion accuracy as the SHT3x series with a much smaller idle power footprint, at the cost of losing the ALERT pin some SHT3x boards expose. Either family pairs cleanly with an ESP32 over I2C.
Related
Reference
ESP32-CAM (AI-Thinker) Pinout
The real pin reference for the AI-Thinker ESP32-CAM: an ESP32 with a camera connector and microSD slot, and only 2 or 3 genuinely free GPIOs left over.
Read more
Guide
AI-C3 Pinout
The complete pin reference for the AI-C3: a compact ESP32-C3-MINI-1 dev board with a USB-C port, onboard RGB LED, and 22 usable GPIOs.
Read more
Reference
Seeed Studio XIAO ESP32S3 Pinout
The real pin reference for Seeed Studio's XIAO ESP32S3: thumbnail-sized, native USB, with a camera/display connector on the Sense variant.
Read more
More guides
Keep building.
From ESP32 HomeKit accessories to Arduino and ATtiny reference guides, there’s more where this came from.
All guides