Temperature & humidity sensor DHT22 with ESP32 & Firebase
Автор: Ezzaldeen Edwan
Загружено: 2025-07-29
Просмотров: 221
Описание:
في هذا الفيديو، نقوم بمحاكاة مشروع محطة طقس بسيطة باستخدام لوحة ESP32 ومستشعر DHT22 لقراءة درجة الحرارة والرطوبة، وحساب مؤشر الحرارة (Heat Index) بالدرجة المئوية والفهرنهايت.
المشروع يتم تنفيذه بالكامل على محاكي Wokwi دون الحاجة لأي قطع إلكترونية فعلية – مناسب جدًا للمتعلمين والمبتدئين!
Link on Wokwi:
https://wokwi.com/projects/3783264662...
In this video, we demonstrate how to build a simple weather station using an ESP32 and the DHT22 sensor to measure temperature and humidity. The project is simulated using the Wokwi online simulator, making it ideal for learning without physical hardware!
✅ What You'll Learn:
How to connect the DHT22 sensor to ESP32
Circuit diagram explanation
ESP32 code to read temperature & humidity
Real-time simulation using Wokwi
🧰 Components Used:
ESP32 development board
DHT22 sensor
10kΩ resistor
Breadboard and jumper wires
💻 Code Overview:
We use the DHT library to read values from the DHT22 sensor every 2 seconds and print them to the Serial Monitor.
#include "DHT.h"
#define DHTPIN 4 // GPIO4 (D4 pin on ESP32)
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
Serial.println(F("DHTxx test!"));
dht.begin();
}
void loop() {
// Wait a few seconds between measurements
delay(2000);
// Reading humidity and temperature (C and F)
float h = dht.readHumidity();
float t = dht.readTemperature(); // Celsius
float f = dht.readTemperature(true); // Fahrenheit
// Validate sensor readings
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
// Compute heat index
float hif = dht.computeHeatIndex(f, h); // Fahrenheit
float hic = dht.computeHeatIndex(t, h, false); // Celsius
// Display results
Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("°C "));
Serial.print(f);
Serial.print(F("°F Heat index: "));
Serial.print(hic);
Serial.print(F("°C "));
Serial.print(hif);
Serial.println(F("°F"));
}
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: