Overview

The SHT21 is a high-accuracy digital relative humidity and temperature sensor manufactured by Sensirion. Built on Sensirion's proprietary CMOSens technology, it integrates a capacitive humidity sensor element, a bandgap temperature sensor, and a 14-bit ADC inside a compact 3.0×3.0 mm3.0 \times 3.0\text{ mm} 6-pin DFN package.

Delivering typical accuracies of ±2% RH\pm 2\%\ \text{RH} and ±0.3C\pm 0.3^\circ\text{C}, user-configurable resolution (12-bit RH / 14-bit Temp down to 8-bit / 11-bit), CRC-8 checksum verification, an internal heating element, and an I2CI^2C interface (0x40), the SHT21 draws a standby current of just 0.15 μA0.15\ \mu\text{A}.

Quick reference

Operating voltage (VIN)3.3 V to 5.0 V DC (breakout with 3.3V LDO regulator)
IC supply voltage (VDD)2.1 V to 3.6 V DC (3.3 V nominal)
InterfaceI2CI^2C Fast-Mode (up to 400 kHz)
Fixed I2CI^2C address0x40
Humidity range & accuracy0% to 100% RH0\%\text{ to }100\%\text{ RH} (±2% RH\pm 2\%\ \text{RH} typical)
Temperature range & accuracy40C to +125C-40^\circ\text{C}\text{ to }+125^\circ\text{C} (±0.3C\pm 0.3^\circ\text{C} typical)
Resolution options12-bit RH / 14-bit Temp (Default) or 8-bit RH / 11-bit Temp
Internal heaterOnboard programmable heater for diagnostic testing
Standby current0.15 μA0.15\ \mu\text{A} typical at VDD=3.0VVDD = 3.0\text{V}

Pinout

Breakout module 4-pin header:

PinNameTypeDescription
1VCCPowerSupply power input (+3.3 V to +5.0 V DC)
2GNDPowerGround reference (0 V)
3SDADigital Input / OutputI2CI^2C Serial Data
4SCLDigital InputI2CI^2C Serial Clock

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply Voltage (Module)VVINV_{VIN}3.33.3 / 5.05.5VPower rail with LDO
Active Measurement CurrentICCI_{CC}150330µAActive sampling
Sleep CurrentIsdI_{sd}0.150.4µASleep mode
Temp Accuracy (0C60C0^\circ\text{C}\dots 60^\circ\text{C})TaccT_{acc}-0.3±0.3\pm 0.3+0.3°CAt 25C25^\circ\text{C}
RH Accuracy (20%80%20\%\dots 80\%)RHaccRH_{acc}-2.0±2.0\pm 2.0+2.0% RHAt 25C25^\circ\text{C}
Measuring Time (14-bit Temp)ttempt_{temp}6685msMax resolution
Measuring Time (12-bit RH)trht_{rh}2229msMax resolution

I2CI^2C Command Opcodes & Math

  • Hold Master Mode Temp: 0xE3
  • Hold Master Mode RH: 0xE5
  • No Hold Master Mode Temp: 0xF3
  • No Hold Master Mode RH: 0xF5

Temperature Calculation (C^\circ\text{C})

Temperature (C)=46.85+175.72×(Raw 16-bit Temp Register & 0xFFFC65536)\text{Temperature } (^\circ\text{C}) = -46.85 + 175.72 \times \left( \frac{\text{Raw 16-bit Temp Register \& 0xFFFC}}{65536} \right)

Relative Humidity Calculation (% RH\%\text{ RH})

Relative Humidity (% RH)=6.0+125.0×(Raw 16-bit RH Register & 0xFFFC65536)\text{Relative Humidity } (\%\text{ RH}) = -6.0 + 125.0 \times \left( \frac{\text{Raw 16-bit RH Register \& 0xFFFC}}{65536} \right)

Wiring

SHT21 PinArduino / MCUESP32Notes
VCC5V / 3.3V3.3VPower rail
GNDGNDGNDSystem ground
SCLA5GPIO 22I2CI^2C Clock
SDAA4GPIO 21I2CI^2C Data

Example (SHT21 Arduino Library)

cpp
#include <Wire.h>
#include "SHT21.h"

SHT21 sht;

void setup() {
  Serial.begin(115200);
  Wire.begin();

  Serial.println("Sensirion SHT21 Sensor Test");
  sht.begin();
}

void loop() {
  float temp = sht.getTemperature();
  float humidity = sht.getHumidity();

  Serial.print("Temperature: "); Serial.print(temp); Serial.print(" °C | ");
  Serial.print("Humidity: "); Serial.print(humidity); Serial.println(" % RH");

  delay(1000);
}

Common mistakes

  • Leaving I2CI^2C lines un-pulled: SHT21 requires 4.7 kΩ4.7\text{ k}\Omega pull-up resistors on SDA and SCL.
  • Forgetting I2CI^2C address 0x40 collision: SHT21 shares fixed address 0x40 with HTU21D and HDC1080.

Notes

  • Sensirion SHT Series Evolution: SHT11 (1-Wire-like protocol) \rightarrow SHT21 (I2CI^2C 0x40) \rightarrow SHT31 (I2CI^2C 0x44/0x45) \rightarrow SHT40 (I2CI^2C 0x44 ultra-low power).

Assets & downloads