

The SHT40 is a digital humidity and temperature sensor designed for high accuracy and low power consumption. It is part of Sensirion's 4th generation of humidity sensors, offering improved performance in a compact form factor. The SHT40 communicates via an I²C interface, making it easy to integrate into a wide range of applications. Its small size and robust design make it ideal for use in HVAC systems, weather monitoring stations, IoT devices, and industrial automation.








The SHT40 is a high-performance sensor with the following key specifications:
| Parameter | Value | 
|---|---|
| Supply Voltage (VDD) | 1.08 V to 3.6 V | 
| Average Current Consumption | 0.4 µA (at 1 measurement per second) | 
| Measurement Range (Humidity) | 0% RH to 100% RH | 
| Measurement Range (Temp.) | -40°C to +125°C | 
| Accuracy (Humidity) | ±1.8% RH (typical) | 
| Accuracy (Temperature) | ±0.2°C (typical) | 
| Communication Interface | I²C | 
| I²C Address | 0x44 (default) or 0x45 (alternate) | 
| Dimensions | 1.5 mm x 1.5 mm x 0.5 mm | 
The SHT40 has four pins, as described in the table below:
| Pin Name | Pin Number | Description | 
|---|---|---|
| VDD | 1 | Power supply (1.08 V to 3.6 V) | 
| GND | 2 | Ground | 
| SDA | 3 | I²C data line | 
| SCL | 4 | I²C clock line | 
Below is an example of how to interface the SHT40 with an Arduino UNO using the I²C protocol. This code uses the Adafruit SHT4x library.
#include <Wire.h>
#include "Adafruit_SHT4x.h"
// Create an instance of the SHT4x sensor
Adafruit_SHT4x sht4 = Adafruit_SHT4x();
void setup() {
  Serial.begin(9600); // Initialize serial communication
  while (!Serial) delay(10); // Wait for the serial monitor to open
  // Initialize the SHT40 sensor
  if (!sht4.begin()) {
    Serial.println("Failed to find SHT40 sensor!");
    while (1) delay(10); // Halt if sensor initialization fails
  }
  Serial.println("SHT40 sensor initialized!");
  // Set the precision mode (optional)
  sht4.setPrecision(SHT4X_HIGH_PRECISION);
  Serial.println("High precision mode set.");
}
void loop() {
  sensors_event_t humidity, temp;
  // Perform a measurement
  if (!sht4.getEvent(&humidity, &temp)) {
    Serial.println("Failed to read data from SHT40!");
    return;
  }
  // Print temperature and humidity readings
  Serial.print("Temperature: ");
  Serial.print(temp.temperature);
  Serial.println(" °C");
  Serial.print("Humidity: ");
  Serial.print(humidity.relative_humidity);
  Serial.println(" %");
  delay(1000); // Wait 1 second before the next reading
}
Sensor Not Detected on I²C Bus:
Incorrect Readings:
Arduino Code Fails to Compile:
Q: Can I use the SHT40 with a 5V microcontroller?
A: Yes, but you must use a level shifter to step down the I²C voltage levels to the sensor's operating range (1.08 V to 3.6 V).
Q: How do I protect the sensor in harsh environments?
A: Use a protective filter or housing to shield the sensor from dust, water, and contaminants.
Q: What is the typical response time of the SHT40?
A: The typical response time is 8 seconds for humidity and 2 seconds for temperature, depending on airflow and environmental conditions.