The SHT21 is a precision sensor for measuring relative humidity and temperature. It offers a calibrated digital output using an I2C interface, which makes it simple to integrate with microcontrollers such as the Arduino UNO. The SHT21 is widely used in weather stations, HVAC systems, medical devices, and consumer electronics due to its high accuracy, reliability, and low power consumption.
Pin Number | Name | Description |
---|---|---|
1 | VDD | Power supply voltage |
2 | SDA | Serial Data Line for I2C communication |
3 | SCL | Serial Clock Line for I2C communication |
4 | GND | Ground |
To use the SHT21 sensor in a circuit:
#include <Wire.h>
#include "SHT21.h"
SHT21 sht21;
void setup() {
Serial.begin(9600);
Wire.begin();
sht21.begin();
}
void loop() {
float humidity = sht21.getHumidity(); // Get humidity reading
float temperature = sht21.getTemperature(); // Get temperature reading
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println("%");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println("C");
delay(2000); // Wait for 2 seconds before reading again
}
Q: Can the SHT21 operate at 5V? A: No, the SHT21 is designed to operate between 2.1V and 3.6V. Using a higher voltage can damage the sensor.
Q: How can I calibrate the sensor? A: The SHT21 comes factory-calibrated. However, for critical applications, you may perform additional calibration using known humidity and temperature sources.
Q: What is the I2C address of the SHT21? A: The SHT21 has a fixed I2C address of 0x40.
Q: How long should I wait between measurements? A: The SHT21 requires a minimum of 20ms for a humidity measurement and 85ms for a temperature measurement. However, for power saving, a longer delay can be used.
For further assistance, please refer to the manufacturer's datasheet or contact technical support.