Overview

The SHT31 (part of Sensirion's SHT3x series including SHT30, SHT31, and SHT35) is a high-accuracy digital humidity and temperature sensor. Built on Sensirion's CMOSens MEMS technology, it integrates a capacitive humidity sensor, a bandgap temperature sensor, an analog-to-digital converter, and signal processing circuitry on a single chip.

With outstanding precision (±0.2C\pm 0.2^\circ\text{C} temperature accuracy, ±2% RH\pm 2\%\text{ RH} humidity accuracy), low power consumption, an onboard heating element to clear internal condensation, programmable threshold ALERT outputs, and dual I2CI^2C address options (0x44 / 0x45), the SHT31 is widely regarded as the gold standard environmental sensor for precision HVAC control, weather stations, laboratory datalogging, and industrial IoT nodes.

Quick reference

Operating voltage (VCC)2.15 V to 5.5 V DC
InterfaceI2CI^2C (up to 1 MHz Fast Mode Plus)
Default I2CI^2C address0x44 (ADDR pin Low / un-connected)
Alternate I2CI^2C address0x45 (ADDR pin High to VCC)
Temperature accuracy±0.2C\pm 0.2^\circ\text{C} (typ. from 0C0^\circ\text{C} to 65C65^\circ\text{C})
Humidity accuracy±2.0% RH\pm 2.0\%\text{ RH} (typ. from 0%0\% to 100% RH100\%\text{ RH})
Current consumption0.8 mA0.8\text{ mA} active / 0.2 μA0.2\ \mu\text{A} standby
Special featuresOnboard internal heater, hardware ALERT interrupt pin

Pinout

Breakout modules expose a 5-pin or 6-pin 0.1" (2.54 mm) header:

PinNameTypeDescription
1VCCPowerSupply input (+2.15 V to +5.5 V DC)
2GNDPowerGround (0 V)
3SCLDigital InputI2CI^2C Serial Clock
4SDADigital Input / OutputI2CI^2C Serial Data
5ALR / ALERTDigital OutputProgrammable interrupt alert output pin (leave open if unused)
6ADR / ADDRDigital InputI2CI^2C Address select (Low = 0x44, High = 0x45)

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply VoltageVCCV_{CC}2.153.3 / 5.05.5VDC
Active Supply CurrentICCI_{CC}0.81.5mADuring I2CI^2C conversion
Standby CurrentIsbI_{sb}0.22.0µAIdle state
Heater Power DissipationPheatP_{heat}3.38.0mWInternal heater enabled at 3.3V
Temp Accuracy (SHT31)TaccT_{acc}-0.2±0.2\pm 0.2+0.2°C0CT65C0^\circ\text{C} \le T \le 65^\circ\text{C}
Humidity Accuracy (SHT31)RHaccRH_{acc}-2.0±2.0\pm 2.0+2.0% RH0%RH100%0\% \le RH \le 100\%
Measurement Durationtmeast_{meas}2.54.515.0msLow / Medium / High repeatability

I2CI^2C Commands & CRC-8

The SHT31 uses 16-bit command codes (MSB followed by LSB):

Command (16-bit)Description
0x2C06Clock Stretching enabled, High repeatability measurement
0x2400Clock Stretching disabled, High repeatability measurement
0x306DSoftware Reset (SOFTRESET)
0x3070Heater Enable (HEATER_ON)
0x3066Heater Disable (HEATER_OFF)
0xE000Read Status Register

When reading 6 measurement bytes from the sensor (2 bytes RHRH, 1 byte CRC, 2 bytes Temp, 1 byte CRC), valid data must be checked using the polynomial X8+X5+X4+1X^8 + X^5 + X^4 + 1 (0x31, init 0xFF).

Conversion Formulas

Temperature (C)=45+175×(ST2161)\text{Temperature } (^\circ\text{C}) = -45 + 175 \times \left( \frac{S_T}{2^{16} - 1} \right)

Relative Humidity (% RH)=100×(SRH2161)\text{Relative Humidity (\% RH)} = 100 \times \left( \frac{S_{RH}}{2^{16} - 1} \right)

Wiring

SHT31 PinArduino / MCUESP32Notes
VCC5V / 3.3V3.3VNative 2.15V–5.5V support
GNDGNDGNDSystem ground
SCLA5GPIO 22I2CI^2C Clock
SDAA4GPIO 21I2CI^2C Data
ADDRGNDGNDConnect to GND for 0x44, VCC for 0x45

Example

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

Adafruit_SHT31 sht31 = Adafruit_SHT31();

void setup() {
  Serial.begin(9600);
  while (!Serial) delay(10);

  Serial.println("Initializing SHT31 sensor...");
  // Default address 0x44
  if (!sht31.begin(0x44)) {
    Serial.println("Could not find SHT31! Check wiring.");
    while (1) delay(10);
  }
  Serial.println("SHT31 initialized.");
}

void loop() {
  float t = sht31.readTemperature();
  float h = sht31.readHumidity();

  if (!isnan(t) && !isnan(h)) {
    Serial.print("Temp: "); Serial.print(t); Serial.print(" °C | ");
    Serial.print("Humidity: "); Serial.print(h); Serial.println(" %RH");
  } else {
    Serial.println("Failed to read from SHT31");
  }

  delay(2000);
}

Common mistakes

  • Leaving internal heater running continuously: The integrated heating element is intended strictly for drying out condensation in high-humidity environments. Leaving the heater turned on during normal measurements causes self-heating errors of +3C+3^\circ\text{C} to +5C+5^\circ\text{C}.
  • I2C address collision: Connecting multiple SHT31 sensors without pulling the ADDR pin High on the second unit results in bus collisions at address 0x44.
  • Ignoring CRC bytes: Neglecting CRC validation on noisy I2CI^2C lines can lead to erroneous spike readings.

Notes

  • SHT30 vs SHT31 vs SHT35: All three parts share identical pinouts and command codes. SHT30 is the budget variant (±3% RH\pm 3\% \text{ RH}), SHT31 is standard grade (±2% RH\pm 2\% \text{ RH}), and SHT35 is high-precision grade (±1.5% RH\pm 1.5\% \text{ RH}).

Assets & downloads