You are on page 1of 4

Introduction:

We were asked to provide a solution for a fire safety exit so for that I have
designed a circuit on Proteus using Arduino, Gas Sensor MQ-04 and LCD for
display. The Gas Sensor is connected with a logic toggle which represents 0= No
Fire and 1= Fire. The Coding was being performed in Arduino IDE. When the
logic is 1, the LCD shows that the fire is detected and the one should evacuate
immediately. Buzzer is also connected for alertness.

Coding:
#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

#define MQPin A0

#define buzzer 1

void setup() {

lcd.begin(16, 2);

pinMode(MQPin, INPUT_PULLUP);

pinMode(buzzer, OUTPUT);

lcd.setCursor(5, 0);

lcd.print("FIRE");

lcd.setCursor(3, 1);

lcd.print("DETECTOR");

delay(1000);

lcd.clear();
}

void loop() {

int gas_value = digitalRead(MQPin);

if (gas_value == HIGH)

digitalWrite(buzzer, HIGH);

lcd.setCursor(6, 0);

lcd.print("FIRE");

lcd.setCursor(3, 1);

lcd.print("DETECTED EXIT");

delay(200);

lcd.clear();

delay(200);

else

lcd.clear();

digitalWrite(buzzer, LOW);

}
Simulation:

You might also like