Electronics

Temperature And Humidity Sensor GY-21 HTU21 SHT21

AED 34.65

Low stock
1

Description

the SHT21 sensor is a solution for high-precision temperature and humidity measurement. This compact module excels in data accuracy and can be seamlessly integrated into various devices. Utilize the I2C protocol to directly retrieve data, compatible with platforms like Arduino and Raspberry Pi. Whether you're working on thermostats, humidity control systems, or indoor weather monitors, the SHT21 sensor guarantees reliable and precise results.

 

Package Includes:

  • 1x SHT21 Temperature Sensor Module

Features:

  • High Precision: Offers accurate measurement of temperature and humidity. The SHT21 sensor module excels in providing precise readings of both temperature and humidity, ensuring that the data collected is highly accurate and reliable.
  • I2C Communication: Supports direct data reading via the I2C protocol. The module is equipped with I2C communication capabilities, allowing seamless and direct interaction with microcontrollers, such as Arduino or Raspberry Pi. This simplifies the process of reading and utilizing the collected data.
  • Versatile Integration: Suitable for various devices like thermostats, weather stations, and more. Designed to be versatile, the SHT21 module is well-suited for integration into a wide range of devices. It finds utility in applications like thermostats, weather stations, indoor climate monitoring systems, and various other environments where precise temperature and humidity measurements are crucial.
  • Wide Humidity Range: Measures humidity from 0% to 100% RH. Capable of accurately measuring humidity across an extensive range, the SHT21 sensor spans from 0% to 100% relative humidity (RH), accommodating diverse environmental conditions.
  • Extended Temperature Range: Measures temperatures from -40°C to 125°C. The SHT21 module boasts a temperature measurement range from a frigid -40°C to a scorching 125°C, encompassing both extreme cold and heat scenarios.
  • Accuracy: Provides reliable readings with precise accuracy. With its well-engineered design, the SHT21 module ensures that the data it generates is highly accurate and dependable, making it an invaluable tool for critical applications.
  • Resolution Options: Offers adjustable resolution for different needs. The module offers flexibility by providing resolution options that can be adjusted based on specific requirements. This adaptability is particularly useful when fine-tuning the measurement precision for different applications.
  • Compact Size: Designed for easy integration, even in small devices. Engineered with a compact form factor of 21mm x 16mm, the module is designed to be easily integrated into devices of varying sizes, ensuring minimal impact on the overall design.
  • Power Efficiency: Operates with low current consumption. The SHT21 module is engineered with power efficiency in mind. It operates with low current consumption, making it suitable for energy-conscious applications and extending the operational lifespan of battery-powered devices.
  • Enhanced Precision Mode: Offers higher resolution at the expense of longer measurement times. For applications demanding heightened measurement precision, the module provides an enhanced precision mode. While this mode delivers more accurate readings, it comes with slightly longer measurement times.
  • Integrated IC: Built around the SHT21 integrated circuit. The core of the module is the SHT21 integrated circuit. This integrated solution houses the necessary components for temperature and humidity sensing, ensuring consistent and accurate measurements.
  •  

Description:

This module features the SHT21 sensor, a high-precision device that measures both temperature and humidity. You can easily connect it to an Arduino or Raspberry Pi using the I2C protocol and use it for various applications that require monitoring and controlling environmental conditions. The module is very compact and can fit in almost any device, such as thermostats, humidistats, indoor weather stations, and more. The SHT21 sensor can measure humidity from 0 to 100% RH with an accuracy of 2% in the range of 5% to 95% RH. It can also measure temperature from -40 to 125°C with an accuracy of 0.3°C in the range of 0 to 70°C. The sensor has a fast response time and a high resolution, which can be adjusted according to your needs. In normal mode, the sensor can output humidity with a resolution of 0.7% RH and a conversion time of 2ms, and temperature with a resolution of 0.040°C and a conversion time of 11ms. In maximum resolution mode, the sensor can output humidity with a resolution of 0.04% RH and a conversion time of 14ms, and temperature with a resolution of 0.01°C and a conversion time of 44ms. The SHT21 sensor is a reliable and versatile module that can help you create amazing projects with accurate and stable readings of temperature and humidity.

 

Principle of Work:

This module is based on the SHT21 sensor, which is a high-performance device that can measure both temperature and humidity with great accuracy and stability. The sensor uses two different types of sensors to measure these physical quantities: a capacitive sensor element for humidity and a band gap sensor for temperature. A capacitive sensor element works by measuring the change in capacitance that occurs when the humidity level changes. A band gap sensor works by measuring the change in voltage that occurs when the temperature level changes. These sensors are integrated with a 14-bit ADC (analog-to-digital converter) that converts the analog signals from the sensors into digital data that can be processed by a microcontroller unit (MCU). The module communicates with the MCU using the I2C protocol, which is a widely used serial communication protocol that allows multiple devices to share data over two wires: SDA (serial data) and SCL (serial clock). The I2C protocol has several advantages, such as simplicity, flexibility, low power consumption, and noise immunity. The protocol works by using open drain connections, which means that the devices can only pull the lines low or leave them floating. The protocol also uses start and address signaling, which means that the master device can initiate a transaction by pulling SDA low while SCL is high and then sending the address of the slave device it wants to communicate with. The protocol also supports master and slave modes, which means that any device can act as a master or a slave depending on the situation. The protocol also supports multi-master mode, which means that more than one device can act as a master and arbitrate for the bus access. The protocol also uses data and clock signals, which means that the data is transferred bit by bit along the SDA line while being synchronized by the SCL line controlled by the master device. The MCU can use these to read the data from the module and use it for various applications that require monitoring and controlling the temperature and humidity levels, such as thermostats, humidistats, indoor weather stations, and more. The module is very small and can be easily mounted in almost any device. The SHT21 sensor is an excellent choice for projects that need accurate and reliable measurements of temperature and humidity.

 

Pinout of the Board:

Pin Name Function
VCC Power supply pin (+)
GND Ground pin (-)
SCL Serial Clock pin for I2C communication. The module has built-in pull-up resistors, so no external ones are needed.
SDA Serial Data pin for I2C communication. The module has built-in pull-up resistors, so no external ones are needed.

 

 


Applications:

  1. Weather Stations: The SHT21 can be used in weather monitoring stations to measure temperature and humidity, providing accurate data for local weather conditions and contributing to meteorological research.
  2. HVAC Systems: Heating, Ventilation, and Air Conditioning (HVAC) systems require accurate temperature and humidity measurements to ensure optimal indoor air quality and comfort. The SHT21 can be integrated into such systems to provide real-time data for control and regulation.
  3. Industrial Automation: In industrial settings, the SHT21 can be used to monitor environmental conditions within factories or manufacturing plants, ensuring that machinery and products are kept in appropriate temperature and humidity conditions.
  4. Agriculture: The sensor can be utilized in agriculture to monitor and control the conditions in greenhouses, crop storage facilities, and livestock enclosures, helping optimize growth conditions and prevent disease.
  5. Food and Beverage: The SHT21 can be used in the food and beverage industry to monitor storage conditions of perishable goods, helping to maintain quality and extend shelf life.
  6. Medical Devices: Some medical devices require precise temperature and humidity control. The SHT21 can be integrated into devices like incubators, pharmaceutical storage, and medical equipment to ensure proper conditions.
  7. Data Centers: Data centers rely on accurate environmental monitoring to prevent overheating and ensure the proper functioning of servers and networking equipment. The SHT21 can provide critical data for maintaining optimal conditions.
  8. Automotive Industry: The sensor can be used in vehicles to monitor cabin conditions and adjust climate control systems for passenger comfort.
  9. Consumer Electronics: The SHT21 can be integrated into smart home devices, wearables, and other consumer electronics to monitor and adjust environmental conditions.
  10. Research and Development: The sensor is commonly used in research projects where precise temperature and humidity measurements are required, such as studies on material behavior, environmental changes, or biological experiments.
  11. Energy Efficiency: The sensor's accuracy can contribute to energy efficiency efforts by providing data to optimize heating, cooling, and ventilation systems in buildings.
  12. Environmental Monitoring: In environmental monitoring applications, the SHT21 can be deployed to track temperature and humidity variations in natural habitats, helping researchers understand ecosystems and climate patterns.

 

Circuit:

Wire the SHT21 temperature sensor module by connecting its VCC and GND power supply pins to the Arduino UNO's 3.3V and GND pins respectively. Establish serial communication by linking the SHT21 's SDA and SCL pins to the Arduino's A4 and A5 pins for sending and receiving data.

 

Library: 

  • Download the SHT21 Library: Begin by downloading the SHT21 Arduino library from its source. You can obtain the library from the following link: Download the SHT-21 Library
  • Open Arduino IDE: Launch your Arduino IDE program on your computer.
  • Install the Library: Once the library's .ZIP file is downloaded, proceed to install it in the Arduino IDE. To do this, follow these steps:
    • a. In the Arduino IDE, navigate to the "Sketch" menu at the top.
    • b. From the dropdown menu that appears, select "Include Library."
    • c. In the submenu that opens, click on "Add .ZIP Library."
    • d. Locate the downloaded .ZIP library file on your computer and select it.
    • e. The Arduino IDE will then install the library for you.
  • Verify Installation: To ensure that the library has been successfully installed, you can check if it appears in the "Sketch" > "Include Library" submenu. You should see the SHT21 library listed there.

 

Code:

this code initializes communication with the SHT21 sensor, reads temperature and humidity values, checks for errors, and then prints the readings along with error handling and a delay between readings:

#include "SHT21.h"  // Include the SHT21 library

SHT21 sht;  // Create an instance of the SHT21 class

float temperature;   // Variable to store temperature
float humidity;      // Variable to store humidity

void setup() {
  Wire.begin();       // Initialize I2C communication
  Serial.begin(9600); // Initialize Serial communication
  Serial.println("SHT21 Sensor Data:");
}

void loop() {
  // Read temperature and humidity from the SHT21 sensor
  temperature = sht.getTemperature();  
  humidity = sht.getHumidity();       

  // Check for communication errors with the sensor
  if (isnan(temperature) || isnan(humidity)) {
    Serial.println("Error reading data from sensor");
    return;
  }

  // Print the sensor readings
  Serial.print("Temperature: ");
  Serial.print(temperature, 2);  // Print temperature with 2 decimal places
  Serial.print(" °C\t");

  Serial.print("Humidity: ");
  Serial.print(humidity, 2);     // Print humidity with 2 decimal places
  Serial.print(" %\n");

  delay(2000);  // Delay for 2 seconds before the next reading
}

  1. It includes the SHT21 library for interfacing with the sensor.
  2. Creates an instance of the SHT21 class to work with the sensor.
  3. Defines two float variables, temperature and humidity, to store the measured values.
  4. In the setup() function:
    • Initializes I2C communication using the Wire.begin() function.
    • Initializes serial communication using Serial.begin(9600).
    • Prints a message indicating that the code is reading SHT21 sensor data.
  5. In the loop() function:
    • Reads the temperature and humidity values from the SHT21 sensor using sht.getTemperature() and sht.getHumidity() respectively.
    • Checks for communication errors with the sensor using isnan() function (returns true if the value is NaN, which could indicate a communication issue).
    • If there's an error, it prints an error message and exits the loop iteration using return.
    • If there's no error, it prints the temperature and humidity readings with two decimal places each, along with appropriate units.
    • Adds a delay of 2 seconds using delay(2000) before the next reading is taken.

 

 

Technical Details:

  • IC: SHT21
  • Operating voltage: 3V – 5V DC
  • Current consumption: 150mA
  • Measuring range, humidity: 0% - 80%
  • measuring range Temp.: -10° – 85° C
  • Accuracy humidity: +/-3% RH
  • Accuracy temp.: +/-0.4°C
  • Size: 21mm x 16mm
  • Resolution: 0.04%RH, 0.02°C
  • Accuracy: ±2% RH, ±3°C

 

Resources:

Comparisons:

let's compare the SHT21 module to the DHT11 and LM75 modules in terms of their features, accuracy, communication protocols, and typical applications:

  1. SHT21 Module:

    • Features: The SHT21 is a digital humidity and temperature sensor with higher accuracy and wider measurement range compared to the DHT11. It often includes an I2C interface, allowing for easier integration into projects.
    • Accuracy: The SHT21 is known for its higher accuracy, typically around ±2% relative humidity and ±0.3°C temperature accuracy.
    • Communication: It uses the I2C (or Two-Wire) communication protocol, which is a standard for many digital sensors.
    • Applications: The SHT21 is suitable for applications where accurate temperature and humidity measurements are crucial, such as meteorology, industrial automation, research, and more.
  2. DHT11 Module:

    • Features: The DHT11 is a low-cost humidity and temperature sensor. It's simpler than the SHT21 and is often used in basic projects.
    • Accuracy: The DHT11 has lower accuracy compared to the SHT21, with around ±5% relative humidity and ±2°C temperature accuracy.
    • Communication: It uses a custom single-wire protocol and may require specific timing for communication.
    • Applications: The DHT11 is suitable for hobbyist projects, simple weather stations, and applications where moderate accuracy is sufficient.
  3. LM75 Module:

    • Features: The LM75 is a digital temperature sensor with a focus solely on temperature measurements. It's straightforward and doesn't measure humidity.
    • Accuracy: The LM75 offers relatively high accuracy, around ±2°C.
    • Communication: It usually uses the I2C communication protocol.
    • Applications: The LM75 is commonly used in applications where precise temperature measurements are required, such as industrial control systems, data centers, and automotive applications.

In summary:

  • SHT21 offers high accuracy for both temperature and humidity, making it suitable for applications requiring precise environmental monitoring.
  • DHT11 is an affordable option for basic projects where moderate accuracy is acceptable.
  • LM75 is a dedicated temperature sensor with good accuracy, often used in scenarios where humidity measurements are not needed.

The choice between these modules depends on the specific requirements of your project, including accuracy needs, cost considerations, and the communication interface you're comfortable working with.