Skip to content

Smart temperature monitoring system with ESP32, DHT11/DHT22 sensor, real-time web display, and temperature alert.

Notifications You must be signed in to change notification settings

omidkarami1337/TempGuard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

ESP32 TempGuard

ESP32 TempGuard is a simple project that reads temperature from a DHT11 or DHT22 sensor using an ESP32, hosts a web server showing the current temperature and timestamp, and provides a visual warning via an LED when the temperature exceeds a configurable threshold.

GitHub: omidkarami1337

Features

  • Read temperature from DHT11 or DHT22 sensors
  • Measure temperature periodically (default every 5 seconds)
  • Web server showing real-time temperature, timestamp, and warning status
  • Visual LED warning when temperature exceeds threshold (default 30 °C)
  • NTP time synchronization for readable timestamps (optional)

Hardware Requirements

  • ESP32 development board
  • DHT11 or DHT22 temperature sensor
  • 10k resistor (recommended for DHT data line pull-up when using DHT22)
  • LED (or use on-board LED) and appropriate resistor (220–330 Ω)
  • Jumper wires and breadboard

Software Requirements

  • Arduino IDE (or VS Code with PlatformIO)
  • ESP32 board support installed in Arduino IDE
  • Libraries: DHT sensor library (included as DHT.h), WiFi, WebServer (built-in)

Wiring

  • DHT VCC -> 3.3V
  • DHT GND -> GND
  • DHT DATA -> GPIO4 (change DHTPIN in code if you use another pin)
  • LED -> GPIO2 (through resistor) -> GND (or use on-board LED on many ESP32 boards)

Setup Instructions

  1. Clone or download this project to your machine.
  2. Open TempGuard.ino in the Arduino IDE.
  3. Update Wi-Fi credentials at the top of TempGuard.ino:
    • const char* ssid = "YOUR_SSID";
    • const char* password = "YOUR_PASSWORD";
  4. If you use DHT11 instead of DHT22, comment/uncomment the DHTTYPE lines accordingly.
  5. Optionally adjust TEMP_THRESHOLD and MEASURE_INTERVAL constants.
  6. Select your ESP32 board and the correct COM port in Arduino IDE.
  7. Upload the sketch to your ESP32.
  8. Open the Serial Monitor at 115200 baud to see debug logs and IP address.
  9. Open the shown IP address in a web browser to view the temperature page.

Usage Example

  • Once uploaded and connected, open the ESP32 IP (e.g., http://192.168.1.50/) in a browser.
  • The page auto-updates every 2 seconds and shows current temperature, timestamp, and status.
  • If temperature > threshold, LED lights and the page shows WARNING in red.

ESP32 TempGuard (فارسی)

ESP32 TempGuard یک پروژه ساده است که دما را از سنسور DHT11 یا DHT22 با استفاده از ESP32 می‌خواند، یک وب‌سرور راه‌اندازی می‌کند که دمای فعلی و زمان را نمایش می‌دهد و وقتی دما از مقدار آستانه عبور کند با LED هشداری را نمایش می‌دهد.

GitHub: omidkarami1337

ویژگی‌ها

  • خواندن دما از سنسور‌های DHT11 یا DHT22
  • اندازه‌گیری دوره‌ای دما (پیش‌فرض هر ۵ ثانیه)
  • وب‌سرور نمایش دما، زمان و وضعیت هشدار
  • نمایش هشدار بصری با LED وقتی دما از آستانه عبور کند (پیش‌فرض ۳۰ درجه)
  • همگام‌سازی زمان با NTP برای نمایش زمان خوانا (اختیاری)

الزامات سخت‌افزاری

  • برد توسعه ESP32
  • سنسور دما DHT11 یا DHT22
  • مقاومت ۱۰ کیلو (برای کشش داده در DHT22 پیشنهاد می‌شود)
  • LED (یا استفاده از LED روی برد) و مقاومت مناسب (۲۲۰–۳۳۰ اهم)
  • سیم‌اتصال و برد بورد

الزامات نرم‌افزاری

  • Arduino IDE (یا VS Code با PlatformIO)
  • پکیج برد ESP32 نصب شده در Arduino IDE
  • کتابخانه‌ها: DHT (DHT.h)، WiFi و WebServer (داخلی)

سیم‌کشی

  • VCC سنسور DHT -> 3.3V
  • GND سنسور DHT -> GND
  • DATA سنسور DHT -> GPIO4 (در صورت تغییر، متغیر DHTPIN را در کد تغییر دهید)
  • LED -> GPIO2 (از طریق مقاومت) -> GND (یا استفاده از LED داخلی)

دستورالعمل نصب

  1. این پروژه را دانلود یا کلون کنید.
  2. فایل TempGuard.ino را در Arduino IDE باز کنید.
  3. اطلاعات Wi-Fi را در بالای فایل TempGuard.ino وارد کنید:
    • const char* ssid = "YOUR_SSID";
    • const char* password = "YOUR_PASSWORD";
  4. اگر از DHT11 استفاده می‌کنید، خط مربوط به DHTTYPE را مطابق نیاز تغییر دهید.
  5. در صورت نیاز، TEMP_THRESHOLD و MEASURE_INTERVAL را تغییر دهید.
  6. برد ESP32 و پورت COM مناسب را در Arduino IDE انتخاب کنید.
  7. کد را آپلود کنید.
  8. Serial Monitor را با باود ریت 115200 باز کنید تا آدرس IP و لاگ‌ها را ببینید.
  9. آدرس IP نمایش داده‌شده را در مرورگر باز کنید تا صفحه دما را مشاهده کنید.

مثال استفاده

  • پس از آپلود و اتصال، آدرس IP ESP32 را در مرورگر وارد کنید (مثلاً http://192.168.1.50/).
  • صفحه هر ۲ ثانیه به‌روزرسانی می‌شود و دما، زمان و وضعیت را نشان می‌دهد.
  • اگر دما از آستانه بیشتر شود، LED روشن می‌شود و پیام هشدار به رنگ قرمز نمایش داده می‌شود.

If you need code adjustments (different pins, thresholds, or adding authentication), tell me what to change.

About

Smart temperature monitoring system with ESP32, DHT11/DHT22 sensor, real-time web display, and temperature alert.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages