Arduino Fire Alarm System

What is an Arduino UNO? An Arduino UNO is a programmable microcontroller circuit board. The Arduino code syntax is similar with C++ and the Arduino IDE is used to connect and program the UNO board with your computer.

For the project, at first, my partner and I attached a flame sensor for temperature detecting. However, we encountered problems with the testing of the circuit board. My partner and I decided to replace the sensor with a normal switch that will serve as a sensor or fire alarm switch. Turning on the switch will trigger a positive voltage across the circuit board and while the switch is on, the buzzer will begin to make a synchronous noise. At the same time, the Arduino IDE console will also output a “Flame Detected!” message if the switch is turned on and “No flame detected!” if the switch is turned off.

Here is the code overview:

int buzzer = 8;
int LED = 7;
int flame_sensor = 4;
int flame_detected;

void setup()
{
  Serial.begin(9600);
  pinMode(buzzer, OUTPUT);
  pinMode(LED, OUTPUT);
  pinMode(flame_sensor, INPUT);
}
void loop()
{
  flame_detected = digitalRead(flame_sensor);
  if (flame_detected == 1)
  {
    Serial.println("Flame detected! Please take proper action.");
    digitalWrite(buzzer, HIGH);
    tone(buzzer, 1000, 500);
    digitalWrite(LED, HIGH);
    delay(200);
    digitalWrite(LED, LOW);
    delay(200);
  }
  else
  {
    Serial.println("No flame detected! Temperature is normal.");
    digitalWrite(buzzer, LOW);
    digitalWrite(LED, LOW);
  }
 delay(1000);
}