Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use SHT40: Examples, Pinouts, and Specs

Image of SHT40Design with SHT40 in Cirkit Designer

Introduction

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.

Explore Projects Built with SHT40

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino Nano Weather Station with Ethernet Connectivity: A project utilizing SHT40 in a practical application
Arduino Nano Weather Station with Ethernet Connectivity

This circuit features an Arduino Nano microcontroller interfaced with an Ethernet W5500 module for network connectivity and an SHT31 sensor for temperature and humidity measurements. The Arduino Nano communicates with the Ethernet module via SPI and reads data from the SHT31 sensor using I2C, enabling remote monitoring of environmental conditions.

Open Project in Cirkit Designer
Image of Arduino Nano-Controlled LED Display with RTC and Humidity Sensing: A project utilizing SHT40 in a practical application
Arduino Nano-Controlled LED Display with RTC and Humidity Sensing

This circuit features a Nano 3.0 ATmega328P microcontroller connected to an LED dot display, a real-time clock (RTC DS3231), and a humidity and temperature sensor (SHT21). The microcontroller communicates with the RTC and SHT21 via I2C (using A4 and A5 as SDA and SCL lines, respectively), and it controls the LED display through SPI-like signals (using D10, D11, and D12 for DIN, CS, and CLK). The circuit is designed to display time and environmental data on the LED display, with all components sharing a common power supply and ground.

Open Project in Cirkit Designer
Image of Arduino UNO WiFi with Heart Pulse and Temperature Monitoring: A project utilizing SHT40 in a practical application
Arduino UNO WiFi with Heart Pulse and Temperature Monitoring

This circuit features an Arduino UNO R4 WiFi microcontroller connected to a Heart Pulse Sensor and an SHT1x-Breakout sensor. The Arduino is configured to read heart pulse signals from the Heart Pulse Sensor on analog pin A0 and temperature/humidity data from the SHT1x-Breakout sensor via the I2C interface on pins A4 (DATA) and A5 (SCK). Both sensors are powered by the Arduino's 5V output, and their ground pins are connected to the Arduino's ground.

Open Project in Cirkit Designer

Common Applications

Technical Specifications

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

Pin Configuration and Descriptions

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

Usage Instructions

How to Use the SHT40 in a Circuit

  1. Power Supply: Connect the VDD pin to a power source (1.08 V to 3.6 V) and the GND pin to ground.
  2. I²C Communication: Connect the SDA and SCL pins to the corresponding I²C data and clock lines of your microcontroller. Use pull-up resistors (typically 4.7 kΩ) on both SDA and SCL lines.
  3. Bypass Capacitor: Place a 100 nF capacitor close to the VDD and GND pins to stabilize the power supply.
  4. Address Selection: The default I²C address is 0x44. If using multiple SHT40 sensors, configure the alternate address (0x45) as per the datasheet.

Important Considerations and Best Practices

Example Code for Arduino UNO

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
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. Sensor Not Detected on I²C Bus:

    • Ensure the SDA and SCL lines are correctly connected to the microcontroller.
    • Verify that pull-up resistors (4.7 kΩ) are present on the I²C lines.
    • Check the sensor's power supply voltage (1.08 V to 3.6 V).
  2. Incorrect Readings:

    • Ensure the sensor is not exposed to condensation or contaminants.
    • Verify that the sensor is operating within its specified temperature and humidity range.
    • Check for noise or interference on the I²C lines.
  3. Arduino Code Fails to Compile:

    • Ensure the Adafruit SHT4x library is installed in the Arduino IDE.
    • Verify that the correct board and port are selected in the Arduino IDE.

FAQs

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.