DHT11 and DHT22 - Measure temperature and humidity
FunduinoPublished on
Zwei Sensoren im Vergleich – Messbereiche, Verkabelung und Sketch
You need this
DHT11 temperature sensor - humidity, 3.3-5.5 V, without breakout board
2,32 € *Item no. F23106840About the product — DHT11 temperature sensor - humidity, 3.3-5.5 V, without breakout board
DHT22 temperature and humidity sensor - without board, 3.3-5.5 V
6,59 € *Item no. F23106799About the product — DHT22 temperature and humidity sensor - without board, 3.3-5.5 V
Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
11,12 € *Item no. F23107480About the product — Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
830-point Breadboard - solderless breadboard for Arduino
2,90 € *Item no. FUN-1010553About the product — 830-point Breadboard - solderless breadboard for Arduino
Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
1,74 € *Item no. FUN-1010558About the product — Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
All 5 parts together 24,67 € *Ready to ship immediately · Delivery time: 1-3 business days
* All prices include statutory VAT, plus shipping costs.
The circuit diagram (DHT11 on the Arduino UNO)
The program code (DHT11 on the Arduino UNO)
DHT11 on Arduino UNO
#include <DHT.h>
DHT dht(2, DHT11); // DHT11 on pin 2
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float t = dht.readTemperature(); // Read temperature
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" °C");
delay(2000); // 2-second pause
}The DHT22 on the Arduino microcontroller
The wiring (DHT22 on the Arduino UNO)
The program code (DHT22 on Arduino UNO)
DHT22 on Arduino UNO
#include <DHT.h> // Include the DHT library
#define DHTPIN 2 // DHT22 data pin on pin D2
#define DHTTYPE DHT22 // Sensor type: DHT22
DHT dht(DHTPIN, DHTTYPE); // Create the sensor object
void setup() {
Serial.begin(9600); // Start the serial interface
dht.begin(); // Start the DHT sensor
Serial.println("Starting measurement with DHT22…");
}
void loop() {
delay(2000); // Wait 2 seconds (recommended for DHT22)
float temperatur = dht.readTemperature(); // Read the temperature (in °C)
Serial.print("Temperature: ");
Serial.print(temperatur); // Output the value
Serial.println(" °C"); // Add the unit
}Rate the instructions