This is an old revision of the document!


Fire Detector Based on Temperature

Nume si Prenume: Pacuraru Macedoniu-Nicolae
Grupa: 335CA

Introduction

This project is a fire detection system that continuously monitors ambient temperature using a DHT11 sensor connected to an ESP8266 microcontroller. When the sensor reading exceeds a set temperature (50 °C for example), a buzzer is activated and an SMS alert is sent via a SIM800L GSM module to a predefined phone number. This device provides immediate local warning and remote notification, helping to prevent fire-related incidents in homes or workspaces.

General Description

The system consists of both hardware and software modules working together:

  • ESP8266 Microcontroller: Reads temperature data, processes the threshold logic, controls the buzzer, and interfaces with the GSM module.
  • DHT11 Temperature Sensor: Provides real-time temperature readings to the microcontroller over a digital signal.
  • Buzzer: Emits an audible alarm when the temperature crosses a set value.
  • SIM800L GSM Module: Sends SMS alerts over UART to notify remote users.
  • Push button: Stops the buzzer alarm.

Hardware Design

Component Description Link
ESP8266EX + CH340 Microcontroller board (Plusivo) Link
DHT11 Temperature Sensor Digital temperature and humidity sensor Link
SIM800L GSM Module GSM communication module Link
1571563-8 Push Button Link
Passive Buzzer Passive Buzzer Link
LM2596 Converter Adjustable voltage regulator module Link

Connections Between Components

- Temperature Sensor DHT11

  • Data (OUT) → pin D2 (GPIO4) of the ESP8266 board
  • VCC → 3.3V
  • GND → GND

- Button (Reset Alarm)

  • First pin → pin D1 (GPIO5) of the ESP8266
  • Second pin → 3.3V
  • Third pin → GND
  • Software configuration: internal pull-up resistor is enabled with pinMode(D1, INPUT_PULLUP);
  • Purpose: Temporarily stops the alarm and resets the alert state.

- Passive Buzzer

  • Signal pin → pin D0 (GPIO16)
  • GND → GND
  • Purpose: Emits a warning sound when the temperature exceeds the threshold. Controlled with tone() and noTone().

- SIM800L GSM Module

  • TX (SIM800L output) → pin D7 (ESP8266 RX)
  • RX (SIM800L input) → pin D8 (ESP8266 TX)
  • Note: A voltage divider is recommended on ESP8266 TX → SIM800L RX, as the ESP outputs 3.3V and the SIM800L is sensitive.
  • VCC → separate 3.7V power source (Li-ion battery) or stabilized step-down converter
  • GND → Common GND with ESP8266
  • Purpose: Sends a warning SMS only once for each alarm trigger.

- ESP8266 (NodeMCU)

  • USB → PC (for power and serial communication)
  • Purpose: Acts as the system's control unit. It receives data from the sensor, decides whether to activate the alarm, and communicates via GSM.

Software Design

The firmware is developed in the Arduino IDE targeting the ESP8266 platform. It follows these steps:

1. Initialize the DHT11 sensor, buzzer pin, and UART communication with the SIM800L.
2. Enter a loop where temperature is read every two seconds.
3. If the temperature reading exceeds 50 °C, activate the buzzer and transmit an SMS alert via the GSM module using standard AT commands.
4. Otherwise, keep the buzzer silent and continue monitoring.

Purpose of the Code

This program implements a fire detection system based on temperature monitoring using the ESP8266 microcontroller. It uses a DHT11 sensor to read ambient temperature, a passive buzzer to sound an alarm when the temperature exceeds a certain threshold, a button to temporarily disable the alarm, and a SIM800L GSM module to send an SMS alert. The system is designed to notify the user remotely in case of overheating or fire risk.

Main Software Components

- DHT11 Temperature Sensor

  • Reads the ambient temperature through digital pin D2 (GPIO4).
  • If the temperature exceeds 26.1°C, an alarm state is triggered.
  • The reading is done using the `Adafruit_Sensor`, `DHT`, and `DHT_U` libraries.
  • Temperature is read periodically (every ~0.5 seconds) and logged to the serial monitor.

- Alarm System (Passive Buzzer and Button)

  • The buzzer is connected to pin D0 (GPIO16) and activated using the `tone()` function when an alarm is triggered.
  • A push button connected to D1 (GPIO5) is configured with an internal pull-up resistor (`INPUT_PULLUP`).
  • When the button is pressed, the alarm is silenced, and the system enters a cooldown period of 1 minute to prevent retriggering.
  • `alarmActive` and `smsSent` boolean flags are used to manage system state.

- SIM800L GSM Module

  • Communicates with the ESP8266 via `SoftwareSerial` on pins D7 (RX) and D8 (TX).
  • During setup, AT commands are used to initialize the module and verify signal/SIM status.
  • Sends an SMS alert once per alarm event using the `sendSMS()` function.
  • The SMS content is: *”ALERTA: Temperatura depaseste 26.1C!”*

Flow Overview

  • Upon startup:
    1. Serial communication is initialized.
    2. The DHT11 and SIM800L modules are set up.
    3. AT commands check SIM status, signal quality, and configure SMS mode.
  • In the main loop:
    1. The system reads temperature from the DHT11 sensor.
    2. If temperature > 26.1°C and no alarm is active:
      1. The buzzer is activated.
      2. An SMS is sent (only once per event).
    3. If the user presses the button:
      1. The alarm stops.
      2. A 60-second cooldown prevents immediate retriggering.
  • Messages and debug information are printed to the serial monitor for monitoring and troubleshooting.

Libraries Used

- `Adafruit_Sensor.h`, `DHT.h`, `DHT_U.h`: For interfacing with the DHT11 temperature sensor. - `SoftwareSerial.h`: Enables serial communication between the ESP8266 and the SIM800L GSM module.

Results

Conclusions

Bibliography/Resources

pm/prj2025/abirlica/macedoniu.pacuraru.1748540114.txt.gz · Last modified: 2025/05/29 20:35 by macedoniu.pacuraru
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0