Reference
SHT31
High-accuracy temperature and humidity.
- Connects over
- I²C
- Address
- 0x44 (or 0x45)
- Made by
- Sensirion
- Datasheet
- sensirion.com
Use it
hardware {
device sht31: SHT31
}
every 1s {
let value: float = sht31.temperature()
log("sht31", "temperature={value}")
}
On its own, the declaration puts the SHT31 on the first I²C bus (SDA 21, SCL 22 on the ESP32) at 0x44. To choose the pins or the address, declare the bus and attach the device: device sht31: SHT31 on i2c0 at 0x45 with i2c i2c0(sda: 21, scl: 22).
Methods
-
sht31.temperature() -> float
Precision temperature in °C
-
sht31.humidity() -> float
Precision humidity %
Wiring
| Pin | Connect to |
|---|---|
VCC | 3.3V or 5V |
GND | Ground |
SDA | Pull-up to VCC (often on breakout board) |
SCL | Pull-up to VCC |
ALERT | Programmable threshold output |
ADDR | 0x44 (LOW) or 0x45 (HIGH) |
Specifications
- Voltage
- 2.4V – 5.5V
- Current
- 1.7 mA measure, 0.2 μA sleep
- Temp
- −40°C to +125°C ±0.3°C
- Humidity
- 0 – 100% RH ±2%
- Response time
- 8 s temp, 8 s humidity
Tips
- One of the best-in-class T/H sensors — pricier than AHT20 but worth it for accuracy.
- On-chip heater can boil off condensation after high-humidity events.
- Built-in CRC on every read — library should verify it.
Alternatives worth knowing:
- AHT20: Cheaper, slightly less accurate.
- BME280: Adds pressure.