What if your project could 'feel' the air around it and act all by itself?
Why Humidity and temperature (DHT11/DHT22) in Arduino? - Purpose & Use Cases
Imagine you want to measure the air temperature and humidity in your room using simple sensors. Without special tools, you might try guessing or using separate devices and writing down numbers by hand.
Manually checking temperature and humidity is slow and can be inaccurate. Writing down numbers wastes time and can lead to mistakes. You can't easily track changes over time or react quickly to the environment.
Using DHT11 or DHT22 sensors with Arduino lets you automatically read temperature and humidity values. The sensors send data directly to your program, which can display, log, or use it instantly without errors or delays.
// No code, just guessing or writing numbers by hand#include <DHT.h> #define DHTPIN 2 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(9600); dht.begin(); } void loop() { float h = dht.readHumidity(); float t = dht.readTemperature(); Serial.print("Humidity: " + String(h) + "% Temperature: " + String(t) + "C"); delay(2000); }
You can build smart projects that sense and respond to the environment automatically and accurately.
For example, a plant watering system that checks soil humidity and air temperature to water plants only when needed, saving water and keeping plants healthy.
Manual tracking of temperature and humidity is slow and error-prone.
DHT11/DHT22 sensors automate reading these values with Arduino.
This enables smart, responsive projects that react to real-world conditions.
