Phone : +8801894-801150 Email : projects.zeronebd@gmail.com
support 24/7
project photo

How to Make Forest Fire Detection Automatic Light Control and Temperature Monitoring with IoT Project.

Now we are going to learn about an exciting new IoT-based project. In this project, we will build a system that can detect forest fires automatically using sensors, control lights based on the environment, and monitor temperature in real-time.

Introduction:

This innovative IoT-based project is designed to enhance environmental safety by detecting potential forest fires, monitoring ambient temperature, and automatically controlling lighting systems in remote or sensitive forest areas. The system integrates multiple sensors—flame sensor, temperature sensor (DHT11 or LM35), and light sensor (LDR)—with a microcontroller (NodeMCU or ESP32) to collect real-time environmental data.

When a fire is detected through sudden temperature rise or flame presence, the system automatically triggers a buzzer alarm and sends an instant alert to a mobile device or web dashboard via platforms like Blynk or ThingSpeak. Additionally, the system controls lights based on ambient conditions—activating them automatically during low light for visibility and safety.

This smart solution is ideal for forest departments, environmental monitoring stations, and wildlife sanctuaries, offering remote access, real-time notifications, and automated safety responses, ensuring rapid action and increased situational awareness in fire-prone zones.

Required Components:

  1. NodeMCU / ESP32

  2. Flame Sensor

  3. Temperature Sensor (e.g., LM35 or DHT11/DHT22)

  4. Light Sensor (LDR or BH1750)

  5. Relay Module (1 or 2 channel)

  6. Bulb or LED (for light control)

  7. Buzzer (for fire alert)

  8. IoT Platform (Blynk / ThingSpeak / Firebase)

  9. Power Supply (SMPS or USB)

  10. Breadboard & Jumper Wires

    CODE:

    #define BLYNK_TEMPLATE_ID "YourTemplateID"

    #define BLYNK_DEVICE_NAME "ForestFireDetector"

    #define BLYNK_AUTH_TOKEN "YourAuthToken"


    #include <ESP8266WiFi.h>

    #include <BlynkSimpleEsp8266.h>

    #include <DHT.h>


    // Wi-Fi credentials

    char ssid[] = "YourWiFiName";

    char pass[] = "YourWiFiPassword";


    // Pin Definitions

    #define FLAME_SENSOR_PIN D1

    #define DHTPIN D2

    #define LDR_PIN A0

    #define RELAY_PIN D3

    #define BUZZER_PIN D4


    // Sensor Type

    #define DHTTYPE DHT11

    DHT dht(DHTPIN, DHTTYPE);


    BlynkTimer timer;


    void setup() {

      Serial.begin(9600);


      pinMode(FLAME_SENSOR_PIN, INPUT);

      pinMode(RELAY_PIN, OUTPUT);

      pinMode(BUZZER_PIN, OUTPUT);


      dht.begin();

      Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

      

      timer.setInterval(2000L, sendSensorData);

    }


    void sendSensorData() {

      // Read Sensors

      int flameStatus = digitalRead(FLAME_SENSOR_PIN);

      float temperature = dht.readTemperature();

      int ldrValue = analogRead(LDR_PIN);


      // Send data to Blynk

      Blynk.virtualWrite(V0, temperature);

      Blynk.virtualWrite(V1, ldrValue);

      Blynk.virtualWrite(V2, flameStatus);


      // Flame Detection Logic

      if (flameStatus == LOW) {  // LOW = Flame Detected

        digitalWrite(BUZZER_PIN, HIGH);

        Blynk.logEvent("flame_alert", "🔥 Fire Detected in the Forest Area!");

      } else {

        digitalWrite(BUZZER_PIN, LOW);

      }


      // Automatic Light Control

      if (ldrValue < 500) {  // Dark environment

        digitalWrite(RELAY_PIN, HIGH); // Light ON

      } else {

        digitalWrite(RELAY_PIN, LOW); // Light OFF

      }


      Serial.print("Temp: ");

      Serial.print(temperature);

      Serial.print("°C | LDR: ");

      Serial.print(ldrValue);

      Serial.print(" | Flame: ");

      Serial.println(flameStatus == LOW ? "🔥 Detected" : "✅ Safe");

    }


    void loop() {

      Blynk.run();

      timer.run();

    }