The RHT03 sensor, also known as the DHT-22, is a reliable sensor that measures both humidity and temperature in the surrounding environment. It is a digital sensor that provides calibrated digital signals output, allowing for easy interfacing with various microcontrollers, such as the Arduino UNO. Common applications include HVAC systems, weather stations, home automation systems, and any application where environmental monitoring is necessary.
Pin Number | Name | Description |
---|---|---|
1 | VDD | Power supply (3.3 to 6V DC) |
2 | DATA | Digital data output |
3 | NC | Not connected |
4 | GND | Ground |
Connecting the Sensor:
Programming the Arduino:
#include "DHT.h"
#define DHTPIN 2 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT22 // DHT 22 (RHT03)
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
// Wait a few seconds between measurements.
delay(2000);
// Reading temperature or humidity takes about 250 milliseconds!
float humidity = dht.readHumidity();
// Read temperature as Celsius (the default)
float temperature = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Compute heat index in Celsius (isFahrenheit = false)
float heatIndex = dht.computeHeatIndex(temperature, humidity, false);
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print("% Temperature: ");
Serial.print(temperature);
Serial.print("°C Heat index: ");
Serial.print(heatIndex);
Serial.println("°C");
}
Q: How often can I get readings from the sensor? A: The RHT03 can provide data up to once per second (1Hz).
Q: Can I use the RHT03 sensor with a 3.3V system? A: Yes, the RHT03 can operate with a supply voltage from 3.3V to 6V.
Q: Is calibration required for the RHT03 sensor? A: The RHT03 comes pre-calibrated from the factory. However, for critical applications, you may want to perform additional calibration.
Q: What is the purpose of the pull-up resistor on the data line? A: The pull-up resistor is necessary for the one-wire communication protocol to function correctly.
For further assistance, consult the manufacturer's datasheet and technical support forums.