fire alarm project with arduino uno

Arduino Uno Fire Alarm Project: DIY Safety with Ease

By Amanda Martinez
AD

Embarking on a fire alarm project using Arduino Uno? You're in the right place! This guide will walk you through the process, ensuring your project is both engaging and secure. Arduino Uno, with its simplicity and versatility, is an excellent choice for this task. Let's dive in!

Before we start tinkering with circuits and code, let's understand the project's essence. A fire alarm system should detect fires promptly and raise an alarm. Hence, it involves sensors, processing units (like Arduino), and alert mechanisms. We'll use Arduino Uno as our processing unit, an MQ-2 smoke sensor for detection, and an LED & buzzer for alerts. Let's get hands-on!

Hardware Components and Setup

Gathering our components is the first step. You'll need:

AD
Fire Alarm System using Arduino [In Few Easy Steps]
Fire Alarm System using Arduino [In Few Easy Steps]
Arduino Fire Alarm | Arduino Tutorial
Arduino Fire Alarm | Arduino Tutorial
Fire protection System with Arduino
Fire protection System with Arduino
  • Arduino Uno
  • MQ-2 Smoke Sensor
  • LED (any color)
  • Piezo Buzzer
  • Breadboard and Jumper Wires
  • Resistors (2x 10kΩ, 1x 220Ω)

Assemble them on your breadboard as follows: Connect the MQ-2's DO pin to Arduino's analog pin (A0), the D0 pin to digital pin 2, and Vcc & GND to 5V & GND respectively. Connect the LED's positive leg to Arduino's digital pin 12, and negative leg to GND via a 220Ω resistor. The buzzer connects to digital pin 9.

Understanding the MQ-2 Sensor

The MQ-2 is a basic, yet effective smoke sensor. It has an adjustable sensitivity, requiring a 5V power source and producing 0-10mA in a load resistor when detecting smoke. Its D0 pin goes HI when smoke is detected.

Project - Platform for creating and sharing projects - OSHWLab
Project - Platform for creating and sharing projects - OSHWLab
Arduino Project With Code || Fire Alarm Using Arduino
Arduino Project With Code || Fire Alarm Using Arduino
Fire Detection Alarm Arduino and Flame Sensor
Fire Detection Alarm Arduino and Flame Sensor

Tune your sensor sensitivity using the adjustment screw. Ensure it's sensitive enough to detect fumée cigarette but not overly sensitive, triggering false alarms.

Preparing your Arduino Uno

Upload a simple sketch to confirm your Arduino board is functioning correctly. Here's a simple blink LED test:

AD
```cpp void setup() { pinMode(12, OUTPUT); } void loop() { digitalWrite(12, HIGH); delay(500); digitalWrite(12, LOW); delay(500); } ```

Arduino Coding for the Fire Alarm

Now, let's write the main Arduino code. We'll read the MQ-2 sensor, turn on the LED and sound the buzzer when smoke is detected. Here's a simple sketch:

Fire 🔥 Detector Alarm Using Arduino Uno || Flame Sensor
Fire 🔥 Detector Alarm Using Arduino Uno || Flame Sensor
Arduino-based Burglar and Fire Alarm System
Arduino-based Burglar and Fire Alarm System
DIY Fire Security Alarm with Arduino Nano 🚨 | Easy Circuit + Materials
DIY Fire Security Alarm with Arduino Nano 🚨 | Easy Circuit + Materials
IoT based Fire Security Alarm System using NodeMCU | Custom Android App - IoT Starters
IoT based Fire Security Alarm System using NodeMCU | Custom Android App - IoT Starters
Fire Alarm System Project by Interfacing Arduino with Temperature & Gas Sensor using TinkerCad
Fire Alarm System Project by Interfacing Arduino with Temperature & Gas Sensor using TinkerCad
Arduino Security Alarm
Arduino Security Alarm

Initializing and Reading the Sensor

```cpp const int smokePin = A0; const int smokeDigitalPin = 2; const int ledPin = 12; const int buzzerPin = 9; void setup() { pinMode(smokeDigitalPin, INPUT); pinMode(ledPin, OUTPUT); pinMode(buzzerPin, OUTPUT); Serial.begin(9600); Serial.println("Smoke Sensor Testing"); } void loop() { int smokeAnalog = analogRead(smokePin); int smokeDigital = digitalRead(smokeDigitalPin); Serial.print("Analog Value: "); Serial.print(smokeAnalog); Serial.print(", Digital Value: "); Serial.println(smokeDigital); if (smokeDigital == HIGH) { alarm(); } } ```

In this code, we use both analog (smokeAnalog) and digital (smokeDigital) readings from the sensor. This dual approach enhances reliability. When smoke is detected (smokeDigital is HIGH), the alarm() function is called.

Implementing the Alarm Function

```cpp void alarm() { digitalWrite(ledPin, HIGH); tone(buzzerPin, 1000, 200); // Beep for 200ms delay(50); // Wait 50ms before the next beep digitalWrite(ledPin, LOW); noTone(buzzerPin); delay(50); // Wait 50ms before checking again } ```

In the alarm function, we light the LED and sound the buzzer. The buzzer's frequency (1000 Hz) creates a piercing sound that catches attention. We use tone() and noTone() functions for easy control over the buzzer.

AD

This project demonstrates the versatility of Arduino Uno. You've created a simple yet effective fire alarm system! But remember, this is a basic project. For real-world applications, consider using IO expanders and more sensors for better accuracy. Also, consider using an integrated circuit like the ESP32 for wireless capabilities.

Arduino Flame Detector With Alarms and Automatic Fire Extinguishing
Arduino Flame Detector With Alarms and Automatic Fire Extinguishing
How to make a DIY Fire truck with Arduino UNO R4 MINIMA board
How to make a DIY Fire truck with Arduino UNO R4 MINIMA board
fire alarm working model science project - diy - simple and easy - tubelight starter | howtofunda
fire alarm working model science project - diy - simple and easy - tubelight starter | howtofunda
a computer screen with an electronic device on it's display board and circuit diagram
a computer screen with an electronic device on it's display board and circuit diagram
GSM SIM800L FIRE Alert (SMS & CALL) || Arduino SIM800L Project || SIM800L SMS & CALL Alert
GSM SIM800L FIRE Alert (SMS & CALL) || Arduino SIM800L Project || SIM800L SMS & CALL Alert
Arduino Security and Alarm System Project
Arduino Security and Alarm System Project
Testing Homemade Fire Alarm Circuit
Testing Homemade Fire Alarm Circuit
GSM based Fire Alert System Using Arduino and Flame Detector Sensor
GSM based Fire Alert System Using Arduino and Flame Detector Sensor
How to make a Fire protection system with Arduino
How to make a Fire protection system with Arduino
Fire Alarm System GSM Based Using Arduino
Fire Alarm System GSM Based Using Arduino
DIY Arduino based RC Hovercraft
DIY Arduino based RC Hovercraft
FlameGuard: Arduino-Based Fire Detection System
FlameGuard: Arduino-Based Fire Detection System
Fire Alarm with Siren and Water Sprinkler System Using Arduino
Fire Alarm with Siren and Water Sprinkler System Using Arduino
Fire Alarm Circuit Using LM358 IC
Fire Alarm Circuit Using LM358 IC

Now that you've successfully built and tested your fire alarm, it's time to share your creation with the world. Post your project on Arduino forums, GitHub, or Hackster, and inspire others to learn and build. Happy hacking!

AD