Intermediate Safety Project

Build a Smoke Alarm System

A smoke alarm provides early warning of smoke that may indicate a developing fire. It is one of the most important safety devices for homes, offices, workshops and industrial buildings. Early detection allows occupants to respond quickly, reducing the risk of injury and property damage. This project demonstrates how to build a smoke alarm using an Arduino or ESP32 together with an MQ-2 smoke sensor, buzzer and optional Wi-Fi notification system.

Smoke Alarm System

Project Overview

The smoke sensor continuously monitors the surrounding air for smoke and combustible gases.

When the measured concentration exceeds a predefined threshold, the microcontroller activates a loud buzzer, flashes warning LEDs and can send notifications to a smartphone or home automation system.

Additional sensors may be added to monitor temperature, carbon monoxide or flammable gases for enhanced protection.

Project Difficulty

ItemValue
Difficulty⭐⭐⭐ Intermediate
Build Time3–6 Hours
Supply Voltage5 V DC
ControllerESP32 or Arduino
Detection MethodGas/Smoke Sensor

Main Sections

Section Function
Smoke Sensor Detects smoke and combustible gases.
Microcontroller Processes sensor data and controls the alarm.
Buzzer Provides an audible warning.
Warning LEDs Provide visual indication.
Relay Module (Optional) Activates external alarms or ventilation.
Wi-Fi Module Sends remote notifications.

Typical Smoke and Gas Sensors

Sensor Typical Detection
MQ-2 Smoke, LPG, methane and hydrogen.
MQ-5 LPG and natural gas.
MQ-7 Carbon monoxide.
MQ-135 Air quality and several harmful gases.
Photoelectric Smoke Sensor Smoke particles from slow, smouldering fires.

Typical Components

QuantityComponent
1ESP32 or Arduino Nano
1MQ-2 Smoke Sensor Module
1Piezo Buzzer or Siren
2Red and Green LEDs
1Push Button (Alarm Reset/Test)
1Relay Module (Optional)
15 V Power Supply
1Fire-Resistant Enclosure

How the System Works

The MQ-2 sensor contains a sensitive element whose resistance changes when exposed to smoke or combustible gases.

The microcontroller continuously reads the sensor output and compares it with a programmed alarm threshold.

If the threshold is exceeded, the buzzer sounds, warning LEDs flash and optional relay outputs or Wi-Fi notifications are activated.

The alarm remains active until the smoke level falls below the threshold or the user acknowledges the alarm, depending on the software design.

Typical Features

Feature Description
Smoke Detection Monitors airborne smoke particles and gases.
Audible Alarm Loud warning buzzer or siren.
Visual Warning Flashing LEDs.
Wi-Fi Notifications Send alerts to smartphones.
Self-Test Button Verifies correct operation.
Relay Output Controls ventilation or additional alarms.

Applications

  • Homes and apartments.
  • Electronics workshops.
  • Server rooms.
  • Warehouses.
  • Factories.
  • Garages.
  • Laboratories.
  • Smart home safety systems.

Testing

  1. Verify the power supply voltage.
  2. Allow the MQ-2 sensor to warm up according to the manufacturer's recommendations.
  3. Check that the status LED indicates normal operation.
  4. Verify that the buzzer and LEDs operate during a self-test.
  5. Adjust the alarm threshold if required.
  6. Test Wi-Fi notifications if implemented.
  7. Confirm relay operation if connected.
  8. Perform regular functional checks to ensure reliable operation.

Troubleshooting

Problem Possible Cause
No alarm Incorrect wiring, sensor fault or software error.
Frequent false alarms Threshold set too low or sensor exposed to fumes.
Buzzer silent Faulty buzzer or incorrect wiring.
Unstable readings Sensor not warmed up or unstable power supply.
Cannot connect to Wi-Fi Network configuration problem.

Project Improvements

  • Add a photoelectric smoke detector for improved smoke sensing.
  • Include a carbon monoxide sensor.
  • Display sensor readings on an OLED screen.
  • Log alarm events to a MicroSD card.
  • Send email or MQTT notifications.
  • Add battery backup.
  • Integrate with Home Assistant.
  • Monitor multiple rooms using several sensors.

Skills Learned

  • Gas and smoke sensing.
  • Analogue sensor interfacing.
  • Alarm system design.
  • ESP32 programming.
  • Relay control.
  • IoT monitoring.

Safety Notes

  • This DIY project is intended for education, experimentation and learning.
  • Do not rely on a homemade smoke alarm as the only means of fire protection.
  • Install certified commercial smoke alarms where required by local regulations.
  • Test the system regularly and replace faulty sensors promptly.
  • Keep the sensor clean and free from dust, grease and insects for reliable operation.

Key Points

  • Smoke alarms provide early warning of potential fire hazards.
  • The MQ-2 sensor can detect smoke and several combustible gases.
  • An ESP32 allows remote monitoring and smartphone notifications.
  • Regular testing and calibration improve reliability.
  • A DIY smoke alarm is an excellent educational project but should complement—not replace—certified fire safety equipment.

Next Project

Continue by building a Gas Leak Detector, capable of detecting LPG, propane, methane and natural gas leaks while providing local alarms and remote notifications.

Next Project → Gas Leak Detector