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

How to Use SHT31: Examples, Pinouts, and Specs

Image of SHT31Design with SHT31 in Cirkit Designer

Introduction

The SHT31, manufactured by Teyleton (Part ID: SHT31-D), is a digital humidity and temperature sensor designed for high-accuracy environmental measurements. It combines a capacitive humidity sensor and a band-gap temperature sensor on a single chip, providing precise and reliable data. The SHT31 features a digital I²C interface, low power consumption, and a fast response time, making it ideal for applications such as HVAC systems, weather stations, industrial process monitoring, and IoT devices.

Explore Projects Built with SHT31

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 SHT31 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 SHT31 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

Technical Specifications

The following table outlines the key technical specifications of the SHT31 sensor:

Parameter Value
Supply Voltage (VDD) 2.4V to 5.5V
Average Current 2 µA (at 1 measurement/sec)
Measurement Range Humidity: 0% to 100% RH
Temperature: -40°C to 125°C
Accuracy Humidity: ±2% RH (typical)
Temperature: ±0.3°C (typical)
Communication Interface I²C (up to 1 MHz)
Response Time (τ63%) 8 seconds (humidity)
Operating Temperature -40°C to 125°C
Dimensions 2.5 mm x 2.5 mm x 0.9 mm

Pin Configuration and Descriptions

The SHT31 sensor is typically available in a 4-pin package. The pin configuration is as follows:

Pin Number Name Description
1 VDD Power supply (2.4V to 5.5V)
2 GND Ground
3 SDA Serial Data Line for I²C communication
4 SCL Serial Clock Line for I²C communication

Usage Instructions

How to Use the SHT31 in a Circuit

  1. Power Supply: Connect the VDD pin to a 3.3V or 5V power source and the GND pin to ground.
  2. I²C Communication: Connect the SDA and SCL pins to the corresponding I²C pins on your microcontroller. Use pull-up resistors (typically 4.7 kΩ) on both SDA and SCL lines.
  3. Address Selection: The SHT31 has a default I²C address of 0x44. If you need to use multiple sensors, some variants allow changing the address to 0x45 by grounding or pulling up a specific pin (refer to the datasheet for details).
  4. Bypass Capacitor: Place a 100 nF capacitor close to the VDD and GND pins to stabilize the power supply.

Important Considerations and Best Practices

Example Code for Arduino UNO

Below is an example of how to interface the SHT31 with an Arduino UNO using the I²C protocol:

#include <Wire.h>
#include "Adafruit_SHT31.h"

// Create an instance of the SHT31 sensor
Adafruit_SHT31 sht31 = Adafruit_SHT31();

void setup() {
  Serial.begin(9600); // Initialize serial communication at 9600 baud
  Wire.begin();       // Initialize I²C communication

  // Initialize the SHT31 sensor
  if (!sht31.begin(0x44)) { // Default I²C address is 0x44
    Serial.println("Failed to find SHT31 sensor!");
    while (1) delay(1); // Halt execution if sensor is not found
  }
  Serial.println("SHT31 sensor initialized.");
}

void loop() {
  // Read temperature and humidity
  float temperature = sht31.readTemperature();
  float humidity = sht31.readHumidity();

  // Check if readings are valid
  if (!isnan(temperature) && !isnan(humidity)) {
    Serial.print("Temperature: ");
    Serial.print(temperature);
    Serial.println(" °C");

    Serial.print("Humidity: ");
    Serial.print(humidity);
    Serial.println(" %");
  } else {
    Serial.println("Failed to read from SHT31 sensor!");
  }

  delay(2000); // Wait 2 seconds 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 SDA and SCL lines.
    • Check the I²C address (default is 0x44) and ensure it matches the code.
  2. Incorrect or NaN Readings:

    • Verify that the power supply voltage is within the specified range (2.4V to 5.5V).
    • Ensure the sensor is not exposed to condensation or extreme environmental conditions.
    • Check for loose or faulty connections in the circuit.
  3. Slow Response Time:

    • Ensure the sensor is not obstructed by a protective cover or filter that impedes airflow.
    • Verify that the sensor is not placed in a location with poor air circulation.

FAQs

Q: Can the SHT31 be used outdoors?
A: Yes, but it should be protected from direct exposure to water, dust, and extreme conditions using an appropriate enclosure or filter.

Q: How often should I calibrate the SHT31?
A: The SHT31 is factory-calibrated and does not require frequent calibration. However, periodic checks are recommended for critical applications.

Q: Can I use the SHT31 with a 5V microcontroller?
A: Yes, the SHT31 supports a supply voltage range of 2.4V to 5.5V, making it compatible with both 3.3V and 5V systems.