Skip to content

mudricdullah/GasLevel-Detection

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Gas Leak Detection System 🚨

This project implements a Gas Leak Detection System using an ESP32 microcontroller, an OLED display, a gas sensor (e.g., MQ-2), a buzzer, and Blynk for remote monitoring. When the gas level exceeds a certain threshold, the system triggers an alert using a buzzer and sends an SMS through the Notify.lk API. Additionally, the gas level is monitored and displayed in real-time using the Blynk app.

Features:

  • Monitors gas levels using an analog gas sensor.
  • Displays gas level and status on an OLED screen.
  • Sends SMS alert when a gas leak is detected.
  • Real-time monitoring via the Blynk app πŸ“±.
  • Buzzer activation for gas leak warning ⚠️.
  • Optional QR Code-based local monitoring

QR Code-Based Local Monitoring (Optional)

In addition to Blynk remote monitoring, the ESP32 can host a local web server that allows real-time gas level monitoring through a web browser. This feature enables users to access the system by simply scanning a QR code while connected to the same WiFi network.

This approach provides:

  • Offline monitoring (no internet required)
  • No mobile app dependency
  • Improved privacy (local network only)
  • Reduced reliance on third-party cloud services

How It Works

  1. The ESP32 connects to a WiFi network.
  2. A local web server starts on port 80.
  3. The device generates a local IP address (e.g., 192.168.1.105).
  4. A QR code encodes the URL:

Requirements:

  • ESP32 board
  • OLED Display (SSD1306)
  • Gas sensor (MQ-2)
  • Buzzer
  • Blynk account

Libraries Used:

  • Adafruit_SSD1306: For controlling the OLED display.
  • BlynkSimpleEsp32: For connecting the ESP32 to the Blynk app.
  • WiFi: For Wi-Fi connectivity.
  • HTTPClient: For sending HTTP requests to the Notify.lk API.

Setup:

  1. Clone the repository to your local machine.

  2. Install the required libraries:

    • Adafruit_SSD1306
    • BlynkSimpleEsp32
    • WiFi
    • HTTPClient
  3. Update the code:

    • Replace the Wi-Fi credentials (ssid and pass).
    • Replace the Blynk authentication token (auth).
    • Replace Notify.lk API credentials (notifylk_user_id, notifylk_api_key, notifylk_sender_id, recipient_number).
  4. Hardware setup:

    • Connect the gas sensor (e.g., MQ-2) to the sensor pin (GPIO 34 on ESP32).
    • Connect the buzzer to the buzzer pin (GPIO 2 on ESP32).
    • Connect the OLED display (SSD1306) to the I2C pins (default SDA and SCL on ESP32).
  5. Upload the code to the ESP32.

  6. Open the Blynk app to monitor gas levels in real-time πŸ“².

Optional: Enable QR Code-Based Local Monitoring

  1. Ensure the ESP32 connects to your WiFi network.

  2. Upload the firmware that includes WebServer functionality.

  3. Open Serial Monitor after upload.

  4. Copy the displayed IP address (e.g., 192.168.1.105).

  5. Generate a QR code using:

    http://

  6. Scan the QR code from a device connected to the same WiFi network.

  7. View the real-time gas monitoring dashboard in your browser.

About

Gas Leak Detection System 🚨 A smart gas leak detection system using ESP32, MQ-2 sensor, OLED display, buzzer, and Blynk for real-time monitoring. Alerts are sent via SMS using Notify.lk when gas levels exceed the threshold.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 100.0%