SHT30 Temperature and Humidity Sensor
The SHT30 sensor is a high-precision digital temperature and humidity sensor that utilizes Sensirion's CMOSens® technology. It provides fully calibrated, linearized, and temperature-compensated digital output, making it ideal for applications requiring precise and reliable environmental measurements.

On this page
SHT30 pinout
The SHT30 uses standard I²C communication with 4 pins, featuring wider voltage range (2.4V-5.5V).
| Pin | Type | Description | Notes |
|---|---|---|---|
| VDD | Power | Power supply input (2.4V to 5.5V) | Wide voltage range for flexible power options |
| GND | Power | Ground connection | Connect to ESP32 ground |
| SDA | Communication | I²C data line | Bidirectional data communication |
| SCL | Communication | I²C clock line | Clock signal from master device |
Standard I²C interface for easy integration
Default I²C address is 0x44 or 0x45 (configurable)
Excellent accuracy: ±0.2°C temp, ±2% humidity
Wide voltage range (2.4V-5.5V) works with 3.3V and 5V systems
Professional-grade sensor with fast measurements
Wiring the SHT30 to ESP32
Connect the SHT30 using standard I²C interface for high-precision measurements.
| SHT30 pin | ESP32 pin | Purpose |
|---|---|---|
| VDD | 3.3V | Power supply (2.4V to 5.5V supported) |
| GND | GND | Ground connection |
| SDA | GPIO21 | I²C data line (default SDA) |
| SCL | GPIO22 | I²C clock line (default SCL) |
GPIO21/22 are default I²C pins on ESP32
I²C address is 0x44 or 0x45 (check your module)
Add 10kΩ pull-up resistors on SDA/SCL if needed
Can share I²C bus with other devices
SHT30 code examples
SHT30 Arduino example
Copy#include <Wire.h>
#include "Adafruit_SHT31.h"
Adafruit_SHT31 sht31 = Adafruit_SHT31();
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
if (!sht31.begin(0x44)) { // Set to 0x45 for alternate i2c addr
Serial.println("Couldn't find SHT31");
while (1) delay(1);
}
}
void loop() {
float t = sht31.readTemperature();
float h = sht31.readHumidity();
if (!isnan(t) && !isnan(h)) { // check if 'is not a number'
Serial.print("Temp *C = "); Serial.print(t); Serial.print(" ");
Serial.print("Hum. % = "); Serial.println(h);
} else {
Serial.println("Failed to read from SHT31 sensor");
}
delay(1000);
}This Arduino sketch demonstrates how to interface with the SHT30 sensor using the Adafruit SHT31 library. It initializes the sensor and reads temperature and humidity data every second, printing the results to the Serial Monitor. The sensor’s I2C address is set to 0x44 by default; if your sensor uses the alternate address (0x45), adjust the initialization accordingly.
SHT30 ESP-IDF example
Copy#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/i2c.h"
#define I2C_MASTER_SCL_IO 22 /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_SDA_IO 21 /*!< GPIO number used for I2C master data */
#define I2C_MASTER_NUM I2C_NUM_0 /*!< I2C master I2C port number */
#define I2C_MASTER_FREQ_HZ 100000 /*!< I2C master clock frequency */
#define SHT30_SENSOR_ADDR 0x44 /*!< SHT30 I2C address */
static esp_err_t i2c_master_init(void) {
i2c_config_t conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = I2C_MASTER_SDA_IO,
.scl_io_num = I2C_MASTER_SCL_IO,
.sda_pullup_en = GPIO_PULLUP_ENABLE,
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.master.clk_speed = I2C_MASTER_FREQ_HZ,
};
esp_err_t err = i2c_param_config(I2C_MASTER_NUM, &conf);
if (err != ESP_OK) {
return err;
}
return i2c_driver_install(I2C_MASTER_NUM, conf.mode, 0, 0, 0);
}
void read_sht30_sensor() {
uint8_t data[6];
uint8_t cmd[] = {0x24, 0x00}; // Single-shot, high repeatability, no clock stretching
i2c_master_write_to_device(I2C_MASTER_NUM, SHT30_SENSOR_ADDR, cmd, 2, pdMS_TO_TICKS(1000));
vTaskDelay(pdMS_TO_TICKS(15)); // Wait for the measurement
i2c_master_read_from_device(I2C_MASTER_NUM, SHT30_SENSOR_ADDR, data, sizeof(data), pdMS_TO_TICKS(1000));
uint16_t temp_raw = (data[0] << 8) | data[1];
uint16_t hum_raw = (data[3] << 8) | data[4];
float temperature = -45 + 175 * ((float)temp_raw / 65535.0);
float humidity = 100 * ((float)hum_raw / 65535.0);
printf("Temperature: %.2f °C, Humidity: %.2f %%\n", temperature, humidity);
}
void app_main() {
ESP_ERROR_CHECK(i2c_master_init());
while (1) {
read_sht30_sensor();
vTaskDelay(pdMS_TO_TICKS(2000));
}
}This ESP-IDF code demonstrates how to interface with the SHT30 sensor using the I2C interface. It initializes the I2C master on GPIO21 (SDA) and GPIO22 (SCL) and reads temperature and humidity data from the SHT30. The sensor’s raw data is processed and converted into human-readable temperature and humidity values. The readings are printed to the console every 2 seconds.
SHT30 ESPHome example
Copyi2c:
sda: GPIO21
scl: GPIO22
scan: true
sensor:
- platform: sht3xd
address: 0x44
temperature:
name: "Room Temperature"
humidity:
name: "Room Humidity"
update_interval: 60sThe ESPHome configuration uses the sht3xdd platform for interfacing with the SHT30 sensor. The i2c section specifies the SDA (GPIO21) and SCL (GPIO22) pins, enabling communication with the sensor. The address key indicates the I2C address of the SHT30 sensor (default 0x44). Two sensor entities are defined: one for temperature and one for humidity, with user-friendly names such as ‘Room Temperature’ and ‘Room Humidity.’ The readings are updated every 60 seconds.
SHT30 PlatformIO example
Copy[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
adafruit/Adafruit SHT31 Library @ ^2.2.2#include <Arduino.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"
Adafruit_SHT31 sht31 = Adafruit_SHT31();
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
if (!sht31.begin(0x44)) { // Set to 0x45 for alternate i2c addr
Serial.println("Couldn't find SHT31");
while (1) delay(1);
}
}
void loop() {
float t = sht31.readTemperature();
float h = sht31.readHumidity();
if (!isnan(t) && !isnan(h)) { // check if 'is not a number'
Serial.print("Temp *C = "); Serial.print(t); Serial.print(" ");
Serial.print("Hum. % = "); Serial.println(h);
} else {
Serial.println("Failed to read from SHT31 sensor");
}
delay(1000);
}This PlatformIO code initializes the SHT30 sensor using the Adafruit library. The setup checks for the sensor’s presence at the default I2C address 0x44. If successful, the loop continuously reads temperature and humidity values, printing them to the Serial Monitor every 2 seconds. Any errors in reading are reported in the console.
SHT30 MicroPython example
Copyfrom machine import I2C, Pin
from time import sleep, sleep_ms
# The SHT30 speaks plain I2C - no driver needed (SDA=GPIO21, SCL=GPIO22)
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
SHT3X_ADDR = 0x44 # 0x45 if the ADDR pin is pulled high
while True:
i2c.writeto(SHT3X_ADDR, b'\x24\x00') # single shot, high repeatability
sleep_ms(20) # wait for the measurement
data = i2c.readfrom(SHT3X_ADDR, 6)
temp_raw = (data[0] << 8) | data[1]
hum_raw = (data[3] << 8) | data[4]
temperature = -45 + 175 * temp_raw / 65535
humidity = 100 * hum_raw / 65535
print("Temperature: {:.2f} C".format(temperature))
print("Humidity: {:.2f} %".format(humidity))
sleep(2)The SHT30 needs no driver - the example sends the single-shot high-repeatability command (0x2400), waits 20 ms, reads six bytes and applies the datasheet conversions. Address 0x44 by default, 0x45 with the ADDR pin pulled high.
SHT30 specifications
About the SHT30
The SHT30 is the low-cost tier of Sensirion’s third-generation SHT3x line, sitting below the SHT31 and SHT35: I2C at 0x44 by default (0x45 with the ADDR pin pulled high), a wide 2.4 V to 5.5 V supply that works on both 3.3 V and 5 V boards, and accuracy of ±0.2 degC / ±2 %RH. The catch is that Sensirion only guarantees the ±2 %RH figure across a 10-90 %RH band - readings near the extremes of the range carry a looser tolerance than the headline number suggests.
Unlike the older SHT2x line, Sensirion has not marked the SHT3x family not recommended for new designs - it remains the sensor most third-party libraries (Adafruit’s SHT31 driver included) default to, and the one most breakout boards and code examples online assume. If a build needs that same ±2 %RH number guaranteed across the full 0-100 %RH range instead of just the middle, the pin-compatible SHT31 costs only a little more.
For the newer 1.08-3.6 V SHT4x generation with lower power draw, see the SHT40 - though it caps out at 3.6 V, so a 5 V-only project still has a good reason to stay with the SHT30.
SHT30 troubleshooting
Sensor Not Detected After Arduino Reset
›
Issue: The SHT30 sensor functions correctly upon initial power-up but fails to be detected on the I2C bus after pressing the Arduino reset button or uploading new code. The serial monitor displays: Couldn't find SHT31.
Possible causes include the sensor not resetting properly when the Arduino is reset, leading to communication issues.
Solution: Implement a power cycle for the sensor by briefly disconnecting and reconnecting its power supply after resetting the Arduino. This ensures both the Arduino and the sensor initialize correctly. Alternatively, consider adding a manual reset mechanism for the sensor or using a microcontroller that can control the sensor's power line programmatically. ([forums.adafruit.com](https://forums.adafruit.com/viewtopic.php?t=196956))
Communication Failure with SHT30 Shield
›
Issue: When using the LOLIN Wemos SHT30 Shield with ESPHome, the following error message is encountered: Communication with SHT3xD failed!.
Possible causes include incorrect I2C pin configuration, insufficient pull-up resistors, or improper initialization in the software.
Solution: Verify that the correct I2C pins are configured in the ESPHome YAML file, matching the hardware connections. Ensure that appropriate pull-up resistors (typically 4.7kΩ) are present on the SDA and SCL lines. Confirm that the sensor is properly initialized in the code, and consider testing with different I2C frequencies if issues persist. ([community.home-assistant.io](https://community.home-assistant.io/t/solved-lolin-wemos-sht30-shield-not-working-communication-with-sht3xd-failed-esphome/331751))
Bus Error in MicroPython
›
Issue: When interfacing the SHT30 sensor with ESP32 Pico using MicroPython, the following error occurs: SHT30Error: Bus error.
Possible causes include incorrect I2C address configuration, improper pin assignments, or missing initialization parameters in the I2C setup.
Solution: Ensure that the correct I2C address (typically 0x44) is specified in the code. Verify that the SDA and SCL pins are correctly assigned and correspond to the physical connections. Modify the I2C initialization to include the bus ID parameter, for example: self.i2c = I2C(0, scl=Pin(scl_pin), sda=Pin(sda_pin)). Adding appropriate pull-up resistors on the I2C lines may also help resolve the issue. ([github.com](https://github.com/rsc1975/micropython-sht30/issues/3))
Sensor Not Generating Readings Outside Faraday Cage
›
Issue: The SHT30 sensor fails to generate readings when placed outside a Faraday cage, but functions correctly inside it. The serial monitor may display: Failed to read temperature and Failed to read humidity.
Possible causes include electromagnetic interference (EMI) affecting sensor performance when not shielded.
Solution: To mitigate EMI, consider enclosing the sensor in a grounded metal enclosure or Faraday cage during operation. Ensure that the sensor's wiring is properly shielded and kept away from sources of electromagnetic noise, such as high-frequency circuits or wireless transmitters. Additionally, verify that the sensor's power supply is stable and free from noise. ([forum.arduino.cc](https://forum.arduino.cc/t/sht30-sensor-not-generating-readings/1157377))
Where to buy the SHT30

Resources
Similar sensors




