Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Make a fire alarm with a fire sensor module

Status
Not open for further replies.

Deva Zahra

New Member
The fire alarm project based on Arduino is one of the most suitable projects for beginners. Apart from being a simple and easy to understand series, it is also due to the relatively cheap price of materials. For flame sensors, it can be found on the market for only 2 dollars. This project is also suitable for people who are very unfamiliar with circuits in electrical engineering.

Schematic
alarm-kebakaran.jpg


Tools and Materials

  1. Flame Sensor / Flame Sensor Module
  2. Project Board
  3. Jumper Cables
  4. 5V buzzer
  5. Battery

Pin Configuration

Flame Sensor
  • Pin DO is connected to pin D7 (Digital 7 Arduino)
  • The GND pin is connected to the Arduino GND pin
  • The VCC pin is connected to the 5V Arduino

LED
  • Positive Pole (Long leg) connected to the D5 Arduino
  • The Negative Pole is connected to the Arduino GND

Buzzer
  • Positive Pole connected to the Arduino D3
  • The Negative Pole is connected to the Arduino GND

How Circuits Work
The way this circuit works is very simple, so the fire sensor is used to detect the presence of fire based on the wavelength of light, which is between 760nm - 1100nm. Based on the measurement results of the flame sensor, the output of the sensor is HIGH or LOW.

The output will then be a parameter to turn on the alarm and LED. If the sensor output is HIGH, the LED and alarm will light. However, if the sensor output is LOW, the LED and alarm will turn off.

Coding on Arduino
// Initialize sensor pin, alarm / buzzer, and LED
const int pinFlameSensor = 7;
const int pinAlarm = 3;
const int redLED = 5;
// initialize data variables
int data;

// ----------- Setup ----------- //
void setup()
{
// initializes the I / O pin status
pinMode(pinFlameSensor, INPUT); // pin as input
pinMode(pinAlarm, OUTPUT); // pin as output
pinMode(redLED, OUTPUT);
Serial.begin(9600);
}
// ----- Program that is repeated continuously ----- //
void loop()
{
// the data variable is the result of the sensor readings in the form of LOW or HIGH
data = digitalRead(pinFlameSensor);
//If the sensor output is LOW
if (data == LOW)
{
// alarm On
digitalWrite(pinAlarm, HIGH);
digitalWrite(redLED, HIGH);
Serial.print("Fire !!! Alarm Is On");

delay(100);
}
// When the sensor output is HIGH
else
{
//Lights are turned off
digitalWrite(redLED, LOW);
// the alarm is off
digitalWrite(pinAlarm, LOW);
Serial.print("Safe");

delay(100);
}
}


Explains coding on Arduino

1. At the top of the coding we initialize the pins of each component where
  • The Flame Sensor pin is connected to the Arduino D7
  • Pin LED connected to D5 Arduino
  • Buzzer pins are connected to D3 Arduino

2. In Void Setup we define each component as input or output.
  • Input is a component that issues data in the form of measurements to be processed by Arduino. This data can be either an analog value or a digital value, namely HIGH and LOW. This input is usually a sensor, whether it is a fire sensor, a humidity sensor, a sound sensor, and others.
  • Output is a component controlled by Arduino. This control is done by coding or a program written by us in the Arduino IDE application.

3. The VOID Loop is a command that Arduino will continue to perform. In the void coding loop, you can see that:
  • We read the output from the HIGH or LOW sensor.
  • Based on the OUTPUT, we program that: When the sensor output is HIGH, the alarm and LED will light up. Conversely, if the sensor output is LOW, the alarm and LED turn off.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top