====== LamaPLC: SHT Sensirion Temperature/humidity sensor with I²C communication ======
Sensirion SHT sensors are a series of highly accurate, reliable digital humidity and temperature sensors built on the company's proprietary CMOSens Technology, offering fully calibrated outputs and long-term stability for a wide range of applications.
^Type of \\ measurement ^Model^Power \\ voltage ^Measurement, range, accuracy^Communication^Note|
|{{anchor:sht20}}{{:sensor:t.png|Temperature measuring}}{{:sensor:h.png|Humidity measuring}} \\ Temperature \\ Humidity |Sensirion \\ **SHT20** {{ :sensor:sht_20.png?100 |SHT20}}|**3.3V** \\ (2.1 .. 3.6V)|Temperature measurement range: -40 .. +125 °C\\ Temperature measurement accuracy: ±0.3°C\\ Humidity measurement range: 0..100% RH\\ Humidity measurement accuracy:±3% |[[com:basic_i2c|I²C]] \\ default addr.: **0x40/41**|3.2 µW (at 8 bits, 1 measurement /s)|
|{{anchor:sht21}}{{:sensor:t.png|Temperature measuring}}{{:sensor:h.png|Humidity measuring}} \\ Temperature \\ Humidity |Sensirion \\ **SHT21** {{ :sensor:sht_21.png?100 |SHT21}}|**3.3V** \\ (2.1 .. 3.6V)|Temperature measurement range: -40 .. +125 °C\\ Temperature measurement accuracy: ±0.3°C\\ Humidity measurement range: 0..100% RH \\ Humidity measurement accuracy: ±2%|[[com:basic_i2c|I²C]] \\ default addr.: **0x40/41**|3.2 µW (at 8 bits, 1 measurement /s)|
|{{anchor:sht25}}{{:sensor:t.png|Temperature measuring}}{{:sensor:h.png|Humidity measuring}} \\ Temperature \\ Humidity |Sensirion \\ **SHT25** {{ :sensor:sht_25.png?100 |SHT25}}|**3.3V** \\ (2.1 .. 3.6V)|Temperature measurement range: -40 .. +125 °C \\ Temperature measurement accuracy: ±0.2°C \\ Humidity measurement range: 0..100% RH \\ Humidity measurement accuracy: ±1.8%|[[com:basic_i2c|I²C]] \\ default addr.: **0x40/41**|3.2 µW (at 8 bits, 1 measurement /s)|
|{{anchor:sht30}}{{:sensor:t.png|Temperature measuring}}{{:sensor:h.png|Humidity measuring}} \\ Temperature \\ Humidity |Sensirion \\ **SHT30** {{ :sensor:sht_3x.png?100 |SHT30}}|**3.3 / 5 V** \\ (2.15 .. 5.5V)|Temperature measurement range: -40 .. +125 °C\\ Temperature measurement accuracy: ±0.2°C\\ Humidity measurement range: 0..100% RH\\ Humidity measurement accuracy: ±2% (10..90%)|[[com:basic_i2c|I²C]] \\ default addr.: **0x44/45**|4.8 µW (1 measurement/s)|
|{{anchor:sht31}}{{:sensor:t.png|Temperature measuring}}{{:sensor:h.png|Humidity measuring}} \\ Temperature \\ Humidity |Sensirion \\ **SHT31** {{ :sensor:sht_3x.png?100 |SHT31}}|**3.3 / 5 V** \\ (2.15 .. 5.5V)|Temperature measurement range: -40 .. +125 °C\\ Temperature measurement accuracy: ±0.2°C\\ Humidity measurement range: 0..100% RH\\ Humidity measurement accuracy: ±2% (0..100%)|[[com:basic_i2c|I²C]] \\ default addr.: **0x44/45**|4.8 µW (1 measurement/s)|
|{{anchor:sht35}}{{:sensor:t.png|Temperature measuring}}{{:sensor:h.png|Humidity measuring}} \\ Temperature \\ Humidity |Sensirion \\ **SHT35** {{ :sensor:sht_3x.png?100 |SHT35}}|**3.3 / 5 V** \\ (2.15 .. 5.5V)|Temperature measurement range: -40 .. +125 °C\\ Temperature measurement accuracy: ±0.2°C\\ Humidity measurement range: 0..100% RH\\ Humidity measurement accuracy: ±1.5% (0..80%)|[[com:basic_i2c|I²C]] \\ default addr.: **0x44/45**|4.8 µW (1 measurement/s)|
|{{anchor:sht40}}{{:sensor:t.png|Temperature measuring}}{{:sensor:h.png|Humidity measuring}} \\ Temperature \\ Humidity |Sensirion \\ **SHT40** {{ :sensor:sht_4x.png?100 |SHT40}}|**3.3** \\ (1.08 .. 3.6V)|Temperature measurement range: -40 .. +125 °C\\ Temperature measurement accuracy: ±0.2°C\\ Humidity measurement range: 0..100% RH\\ Humidity measurement accuracy: ±1.8%|[[com:basic_i2c|I²C]] \\ default addr.: **0x44/45**|4.0 µW (1 measurement/s)|
The SGP sensors can be integrated with the [[https://tasmota.github.io/docs/About/|Tasmota]] system. For more information, [[https://tasmota.github.io/docs/SHT30/|see here]].
{{page>:tarhal}}
==== SHT Sensor Comparison Table ====
^Model^Typical \\ RH Accuracy^Typical \\ Temperature \\ Accuracy^Supply \\ Voltage \\ Range^Interface^Key Features|
^SHT20|±3% RH (@20-80% RH)|±0.3°C (@10-40°C)|2.1V to 3.6V|I²C, PWM, SDM|Low-cost version of SHT2x series|
^SHT21|±2% RH (@0-100% RH)|±0.3°C (@10-40°C)|2.1V to 3.6V|I²C, PWM, SDM|Standard version of SHT2x series|
^SHT25|±1.5% RH (@0-80% RH)|±0.2°C (@5-60°C)|2.1V to 3.6V|I²C, PWM, SDM|Highest performance of SHT2x series|
^SHT30|±3% RH (@20-80% RH)|±0.2°C (@0-65°C)|2.15V to 5.5V|I²C (two addresses)|Low-cost version of SHT3x series, integrated heater|
^SHT31|±2% RH (@0-100% RH, @25°C)|±0.2°C (@0-90°C)|2.15V to 5.5V|I²C (two addresses)|Standard version of SHT3x series, integrated heater|
^SHT35|±1% RH (@20-60% RH)|±0.1°C (@20-60°C)|2.15V to 5.5V|I²C (two addresses)|Premium version of SHT3x series, highest accuracy|
^SHT40|±1.8% RH (@25-75% RH)|±0.2°C (@0-75°C)|1.08V to 3.6V|I²C (two addresses)|Fourth generation, ultra-low power, faster response time, smaller package|
===== Moduls =====
^Type of \\ measurement ^Name^Pics^Sensors^Description|
|{{anchor:sht40_mod}}{{:sensor:t.png|Temperature measuring}}{{:sensor:h.png|Humidity measuring}} \\ - Temperature \\ - Humidity |**SHTxx modul**|{{:sensor:sht40.png?150|SHTxx modul}}|[[#sht20|SHT20]] \\ [[#sht30|SHT30]] \\ [[#sht40|SHT40]]|[[com:basic_i2c|I²C]] interface \\ default address: 0x44/45 \\ wiring colors: \\ - black: GND \\ - red: VCC (3.3V / 5V) \\ - white: SDA \\ - yellow: SCL|
|{{anchor:gy_21}}{{:sensor:t.png|Temperature measuring}}{{:sensor:h.png|Humidity measuring}} \\ - Temperature \\ - Humidity |**GY-21**|{{:sensor:modul_gy21.png?150|GY-21}}|[[#htu21|HTU21]] \\ [[#si7021|Si-7021]] \\ [[#sht21|SHT21]]|[[com:basic_i2c|I²C]] interface (**only 1 modul**, default address: 0x40) \\ GY-21 is a reliable and durable module for detecting temperature and humidity values \\ compatible with Arduino, Atmega328p, ESP and Raspberry \\ Typical measurement accuracy temperature: +/-1°C deviation between -30°C and 90°C \\ Typical measurement accuracy humidity: +/-2% RL between 5% and 95% RL|
¹: //The SHT20, HTU20, and Si7020 are different manufacturers' versions of essentially the same I²C digital humidity and temperature sensor chip, designed to be hardware- and software-compatible. The GY-20 is a generic breakout board that uses one of these chips.//
²: //The SHT21, HTU21, and Si7021 are very similar digital humidity and temperature sensor chips from different manufacturers (Sensirion, Measurement Specialties, and Silicon Labs, respectively), while the GY-21 is a generic breakout board that uses one of these chips. They are largely interchangeable in hardware and software for most general-purpose applications.//
³: //The SHT31, HTU31, and Si7031 are high-accuracy digital temperature and humidity sensor chips from different manufacturers (Sensirion, TE Connectivity, and Silicon Labs, respectively) that are designed to be largely interchangeable. The GY-31 is a generic name for a breakout board that typically uses the SHT31 chip.//
==== Arduino & SHT21 ====
**Wiring**
* SCL: A5
* GND: GND
* SDA: A4
* Vdd: 5V or 3.3V
**Arduino code**
This example uses the SHT21 library to read temperature and humidity every 2 seconds
#include
#include "SHT21.h" // Install "SHT21" or "HTU21D" library via Library Manager
SHT21 sht;
void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(115200); // Set baud rate for Serial Monitor
Serial.println("GY-21 (SHT21) Sensor Test");
}
void loop() {
// Read values from the sensor
float temperature = sht.getTemperature();
float humidity = sht.getHumidity();
// Check if readings are valid
if (!isnan(temperature) && !isnan(humidity)) {
Serial.print("Temperature: ");
Serial.print(temperature, 1); // Print with 1 decimal place
Serial.print(" °C\t");
Serial.print("Humidity: ");
Serial.print(humidity, 1);
Serial.println(" %");
} else {
Serial.println("Failed to read from GY-21 sensor!");
}
delay(2000); // Wait 2 seconds before the next reading
}
==== Example codes ====
none
{{tag>SHT20 SHT21 SHT25 SHT30 SHT31 SHT35 SHT40 GY21 temperature humidity i2c communication sensor arduino code}}
This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}