Skip to content

Jarenas-py/Multi-Hazard-Detector-System

Repository files navigation

⚠️ Multi-Hazard Detector System (ESP32)

A real-time, multi-functional safety monitoring system powered by the ESP32 microcontroller.

This project, affectionately titled "In-Heat Earthquickie Detector", integrates four distinct detection capabilities—Earthquake, Fire, Gas, and Intrusion—into a single compact device. It utilizes the Blynk IoT platform for data visualization and the Telegram Bot API for instant remote alert notifications.

Project Status: Complete [December 2025]
Institution: Technological University of the Philippines - Manila
Course: CPET11L-M (Microprocessor and Microcontroller Systems)


🌟 Key Features

The system continuously monitors environmental data and triggers alerts based on specific thresholds:

  • 🌍 Earthquake Detection: Uses an MPU6050 accelerometer to detect seismic vibrations. It calculates magnitude intensity and classifies alerts (Minor, Mild, Harmful).
  • 🔥 Fire & Heat Detection: Uses a DHT11 sensor to monitor temperature spikes. Triggers an alarm if the temperature exceeds 33°C (configurable).
  • 💨 Gas & Smoke Detection: Uses an MQ-137/MQ-2 gas sensor to detect hazardous gases (LPG, Propane) and smoke density.
  • 🏃 Motion/Intrusion Detection: Uses a PIR Sensor to detect human movement and send security alerts.
  • 📱 Smart Notifications: Sends real-time alerts to your smartphone via Telegram and visualizes data on the Blynk app.

🛠️ Hardware Requirements

  • Microcontroller: ESP32 Development Board (DOIT DEVKIT V1)
  • Sensors:
    • MPU6050 (Accelerometer/Gyroscope)
    • DHT11 (Temperature & Humidity)
    • MQ-137 or MQ-2 (Gas/Smoke Sensor)
    • PIR Motion Sensor (HC-SR501)
  • Display: LCD 20x4 with I2C Interface
  • Power: 5V Power Supply (via USB or external source)
  • Miscellaneous: Breadboard, Jumper Wires, 220Ω Resistors.

🔌 Pin Configuration

Component ESP32 GPIO Pin Description
MPU6050 (SDA) GPIO 21 I2C Data
MPU6050 (SCL) GPIO 22 I2C Clock
LCD (SDA) GPIO 21 I2C Data
LCD (SCL) GPIO 22 I2C Clock
MQ Gas Sensor GPIO 34 Analog Input (A0)
PIR Sensor GPIO 33 Digital Input
DHT11 Sensor GPIO 4 Digital Signal
Onboard LED GPIO 2 Status Indicator

💻 Software & Libraries

This project is built using the Arduino IDE. You will need to install the following libraries via the Library Manager:

  • WiFi.h & WiFiClientSecure.h (Built-in)
  • UniversalTelegramBot by Brian Lough
  • ArduinoJson by Benoit Blanchon
  • LiquidCrystal_I2C by Frank de Brabander
  • DHT sensor library by Adafruit
  • MPU6050 by Electronic Cats
  • Blynk by Blynk Inc.

🚀 Installation & Setup

1. Hardware Assembly

Assemble the circuit according to the pinout table above. Ensure the I2C devices (LCD and MPU6050) share the same SDA/SCL lines.

2. Configuration (Crucial Step!)

The source code contains placeholders for your personal credentials. You must edit these lines in multiHazardDetectorSystem_SourceCode.ino before uploading:

// ==========================================
// IMPORTANT: CONFIGURATION REQUIRED
// ==========================================

// 1. BLYNK SETTINGS (Found in your Blynk Console)
#define BLYNK_TEMPLATE_ID   "Your_Template_ID"
#define BLYNK_TEMPLATE_NAME "Your_Template_Name"
#define BLYNK_AUTH_TOKEN    "Your_Blynk_Auth_Token"

// 2. WIFI CREDENTIALS
#define WIFI_SSID "Your_WiFi_Name"
#define WIFI_PASS "Your_WiFi_Password"

// 3. TELEGRAM BOT SETTINGS (Get these from @BotFather and @IDBot)
#define BOT_TOKEN "Your_Telegram_Bot_Token"
#define CHAT_ID   "Your_Telegram_Chat_ID"

3. Telegram Bot Setup

  1. Open Telegram and search for @BotFather.

  2. Send the command /newbot.

  3. Follow the instructions to name your bot. BotFather will provide you with a HTTP API Token (this is your BOT_TOKEN).

  4. Search for @IDBot (or similar user ID bots) and send /getid to retrieve your personal Chat ID (this is your CHAT_ID).

  5. Paste both the Token and Chat ID into the code variables mentioned above.

4. Uploading

  1. Connect your ESP32 to the computer via USB.

  2. Open the project in Arduino IDE.

  3. Go to Tools > Board and select DOIT ESP32 DEVKIT V1.

  4. Go to Tools > Port and select the correct COM port.

  5. Click the Upload button (Right Arrow icon).

  6. Once uploaded, open the Serial Monitor (set baud rate to 115200) to verify connection status.


👥 Authors

  1. Joseph C. Arenas
  2. Adriene Cyruz Estrada
  3. Geo Kentzer Gutierrez
  4. Lian Gil B. Pacis
  5. Jordan Recaña

About

A comprehensive safety system powered by ESP32 that detects Earthquakes, Fire, Gas, and Intrusion. Features real-time mobile alerts via Telegram and a live data dashboard on the Blynk IoT app.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages