Temperature & humidity are two significant environmental parameters in different applications like weather monitoring, automation, agriculture, etc. So the common sensor used to measure these parameters is a temperature humidity sensor. This device converts temperature & humidity into electrical signals that measure temperature and humidity easily. These sensors measure various substances depending on changes within their electrical characteristics whenever temperature & humidity vary. So based on the sensor type, the operation principle will be changed. Examples of temperature humidity sensors are; SHT31, DHT11, HTU21D, DHT22, DHT12, SHT20, SHT10, etc. Thus, this article provides an overview of the SHT31 temperature humidity sensor, pinout, specifications, and applications.
What is the SHT31 Temperature Humidity Sensor?
SHT31 is a highly accurate, quick response, reliable, integrated temperature and humidity sensor. The sensor within the module is mainly designed with Sensirion’s CMOSens® technology so, it is linearized, well-calibrated, and compensated primarily in digital output. This sensor combines various functions and interfaces with a wide voltage operating range from 2.4 to 5.5V. So this sensor can obtain the relative humidity at ±2% error only. These temperature and humidity sensors are appropriate for different small-volume and high-volume applications. Thus, this sensor can be utilized in various applications like Automobiles, Medical use, Food Processing, Industrial freezers, etc.
How SHT31 Sensor Work?
The SHT31 sensor works by reading humidity above 0 to 100% full range of RH with ±2% a typical accuracy over 20% to 80% RH range. So its maximum range of temperature is -40 to 125°C with ±0.3°C typical accuracy at 25°C.
The SHT31 sensor includes an alert pin that activates whenever the humidity or temperature crosses its pre-defined limits. So this allows the host microcontroller to execute other tasks when the sensor gathers data. This sensor utilizes I2C serial bus communication which works up to 1 MHz speed. Thus, it is well-matched with 3.3V or 5V controllers like ESP32, micro: bit, and Arduino Uno. Thus, this SHT31 sensor is designed with waterproof thus you can utilize it securely within outdoor projects but, it’s not recommended to immerse it in water.
SHT31 Sensor Pin Configuration:
SHT31 temperature humidity sensor pin configuration is shown below. This sensor includes six pins which are discussed below.
- Pin (VIN): This pin supplies power to the module from the 2.4 to 5.5V range.
- Pin (GND): This pin provides the common GND between the devices.
- Pin (SCL): This serial clock pin is connected to your microcontroller’s I2C CLK line, thus it provides the CLK signal.
- Pin (SDA): This serial data pin is connected to your I2C data line of the microcontroller, thus it is utilized to transmit & receive data
- Pin (AD): This is the address selection pin of I2C. So this pin decides the module’s I2C address. Whenever this pin is not connected, then the default I2C address will be 0x44Hex. So whenever it is connected to a high voltage signal, then the I2C address will become 0x45Hex.
- Pin (AL): This is the alert o/p pin, so it activates whenever the environmental condition exceeds the predefined limits.
Features & Specifications:
The features and specifications of the SHT31 temperature humidity sensor include the following.
- SHT31 is a temperature humidity sensor.
- This sensor includes six pins.
- Its power supply range is from 2.4V to 5.5V.
- The current drawn during measurements is 0.8mA and 0.2µA in single shot mode.
- The humidity range is from 0 to 100 %RH.
- Humidity accuracy is ±2% above the 20% to 80% RH range.
- Its package/case is DFN.
- The output type of this sensor is Digital, I2C.
- The interface is I2C.
- The temperature range of this sensor is from -40˚C to +125˚C.
- Temperature accuracy will be ±0.3˚C at 25°C.
Equivalents & Alternatives
Equivalent SHT31 temperature humidity sensors are; SHT30-ARP-B, SHT40I-HD1B-R2, SHT40I-HD1F-R2, HPP845E131R4, etc. So alternative temperature humidity sensors are; DHT11, GY-BME280-5V, 7Semi SHT20, SHT25, SI7021, etc.
SHT31 Temperature Humidity Sensor Interfacing with Arduino
SHT31 temperature humidity sensor interfacing with Arduino is shown below. This interfacing detects temperature and humidity readings within the environment.
The required components to make this interfacing include an Arduino board, SHT31 sensor module, and jumper wires. The connections of this interfacing follow as;
- The 5V pin of the Arduino board is connected to the Vin pin of the SHT31 module.
- The A4 pin of the Arduino board is connected to the SDA pin of the SHT31 module.
- The A5 pin of the Arduino board is connected to the SCL pin of the SHT31 module.
- The GND pin of the Arduino board is connected to the GND pin of the SHT31 module.
Once the connections are made then need to install the SHT31 Arduino library. To program the Arduino development board, then we utilize Arduino IDE. So, you must have the Arduino IDE latest version.
To connect the SHT31 sensor with Arduino, we need to install Adafruit SHT31 and Adafruit BusIO libraries to allow the sensor data. So, Library Manager is used in our Arduino IDE for installing the latest library versions. First need to open Arduino IDE then go to Sketch. After that Include Libraries then Manage Libraries. So, Type Adafruit SHT31 within the search bar & install the latest version.
Code
The required code for interfacing the SHT31 temperature humidity sensor with Arduino is shown below.
#include <Arduino.h>
<Wire.h>
#include “Adafruit_SHT31.h”
Adafruit_SHT31 sht31 = Adafruit_SHT31();
void setup() {
Serial.begin(115200);
if (! sht31.begin(0x44)) {
Serial.println(“Check circuit. SHT31 not found!”);
while (1) delay(1);
}
}
void loop() {
float temp = sht31.readTemperature();
float hum = sht31.readHumidity();
if (! isnan(temp)) {
Serial.print(“Temperature(°C): “);
Serial.print(temp);
Serial.print(“\t\t”);
} else {
Serial.println(“Failed to read temperature!”);
}
if (! isnan(hum)) {
Serial.print(“Humidity(%): “);
Serial.println(hum);
} else {
Serial.println(“Failed to read humidity!”);
}
delay(1000);
}
Working
Once the above code is uploaded on your Arduino development board, press the ENABLE button on the board. So this displays readings of current temperature and humidity on an Arduino serial monitor after each second.
Open up the serial monitor within your Arduino IDE then set the baud rate to 115200. After that, this serial monitor displays the temperature & humidity readings with the units, So new readings will be simply displayed after each second.
Difference between SHT31 and DHT11
The difference between SHT31 and DHT11 temperature humidity sensors includes the following.
SHT31 |
DHT11 |
This sensor has a wider humidity range. | This sensor has a low humidity range. |
It is more accurate. | It is less accurate. |
SHT31 sensor operating temperature range is from -40–125°C. | DHT11 sensor operating temperature ranges from 0°C to 50°C. |
This sensor uses I2C communication | The DHT11 sensor utilizes a single-wire protocol to commune through a microcontroller: |
This sensor utilizes surface mount mounting. | This sensor is available in versions; mounted on a small PCB and four-pin version. |
SHT31 sensor has up to 1 MHz frequency. | This sensor has up to 0.5 Hz frequency. |
SHT31 sensor operating voltage ranges from 2.4 to 5.5V. | DHT11 sensor operating voltage ranges from 3.3 to 5.5 volts. |
Advantages & Disadvantages
The advantages of the SHT31 sensor include the following.
- SHT31sensor is highly accurate with ±2% humidity error and ±0.3°C temperature error.
- This sensor detects -40°C to 125°C temperature and 0% to 100%RH humidity.
- This sensor includes an I2C interface with dual address options, so it is compatible with different controllers.
- These are highly reliable, quick response, accurate so used in different applications.
- This sensor is available with strong anti-interference ability thus, it helps in stabilizing signals & allows different projects to quickly respond to ecological sensors.
- It has less power consumption, fast response time, highly reliable with long-term stability.
- This sensor is very simple to use.
The disadvantages of the SHT31 sensor include the following.
- This sensor’s battery life is fairly short ranging from 10 to 180 days.
- They have a limited temperature range & low accuracy.
- These are less resistant to shock.
- Environmental factors affect the functionality and accuracy of these sensors.
- Periodic wetting & drying can cause these sensor wild swings within humidity readings.
Applications
The applications of the SHT31 sensor include the following.
- The SHT31 is a temperature humidity sensor, thus used to monitor (or) control humidity & temperature in Thermostats & humidistats.
- This can be utilized within indoor weather stations, thus it monitors temperature & humidity.
- This sensor can be incorporated into industrial automation systems, smart home systems, etc.
- This sensor can be utilized for environmental monitoring, thus it can also be suitable for different small-volume and high-volume applications.
- It is a popular choice in different projects & applications thus, it monitors temperature & humidity levels through high precision.
- It is used in different applications like; weather stations, environmental monitoring, industrial automation, and HVAC systems because of its capacity to measure temperature & humidity precisely.
Please refer to this link for the SHT31 Temperature Humidity Sensor Datasheet.
Thus, this is an overview of the SHT31 temperature humidity sensor, pinout, features, specifications, interfacing, pros, cons, and uses. So, a temperature and humidity sensor is a low-cost and sensitive electronic device that detects, measures, and reports both air temperature and dampness. So, here is a question for you, what is a DHT11 sensor?