Arduino driver for the Sensirion SHT2x series temperature and humidity sensors (SHT20, SHT21, SHT25).
The SHT2x sensors provide accurate relative humidity and temperature measurements with low power consumption and digital I²C interface, making them ideal for environmental monitoring applications.
-
Full SHT2x command support
-
Temperature measurement (°C)
-
Relative humidity measurement (%RH)
-
Configurable resolution
-
Heater control
-
CRC validation for data integrity
-
Serial number reading
-
Low power operation
The SHT2x communicates using I²C interface.
| SHT2x Pin | MCU Pin | Notes |
|---|---|---|
| VCC | 3.3V | 3.3V only |
| GND | GND | Common ground |
| SDA | SDA | I²C data |
| SCL | SCL | I²C clock |
-
Default I²C address:
0x40 -
Supported bus speeds:
- 100 kHz
- 400 kHz (recommended)
-
Arduino Library Manager
- Open Arduino IDE
- Go to Library Manager
- Search for 7Semi SHT2x
- Click Install
-
Manual Installation
- Download this repository as ZIP
- Arduino IDE → Sketch → Include Library → Add .ZIP Library
float temperature;
sensor.readTemperature(temperature);- Returns temperature in °C
float temperature, humidity;
sensor.readTempHum(temperature, humidity);- Reads both temperature and humidity
The SHT2x allows adjusting measurement resolution:
sensor.setResolution(SHT2x_RES_12_14);Enable or disable internal heater:
sensor.setHeater(true);- Useful for condensation removal
uint64_t serial;
sensor.readSerialNumber(serial);- Returns unique device ID
sensor.softReset();- Resets sensor to default state