Daini
Published © CC BY-SA

How to Make Gas Leak Detector & Auto Exhaust Fan

How to Make Gas Leak Detector & Auto Exhaust Fan Using Arduino

IntermediateFull instructions provided1 hour8,628
How to Make Gas Leak Detector & Auto Exhaust Fan

Things used in this project

Story

Read more

Schematics

Circuit

Code

Programming

Arduino
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
#include <SoftwareSerial.h>
 
SoftwareSerial mySerial(9,8);
 
int gasValue = A0; 
int data = 0;
int relay = 6; 
int pir_Status; 
int buzzerPin = 7;

void setup()
{
randomSeed(analogRead(0));
mySerial.begin(9600); 
Serial.begin(9600); 
 lcd.init();
 lcd.backlight();
pinMode(gasValue, INPUT);
pinMode(relay, OUTPUT);
pinMode(buzzerPin, OUTPUT);
lcd.setCursor(2,0);
lcd.print ("WELCOME TO  ");
lcd.setCursor(2,1);
lcd.print ("JUSTDOELECTRONICS");
lcd.setCursor(6,2);
lcd.print ("DESIGN By :-");
lcd.setCursor(6,3);
lcd.print ("PRATEEK");
delay(3000);
lcd.clear();
}
 
void loop(){
data = analogRead(gasValue);
 
Serial.print("Gas Level: ");
Serial.println(data);
lcd.clear();
lcd.setCursor(1,0);
lcd.print ("Exhaust fan :- OFF");
lcd.setCursor(2,1);
lcd.print("Gas Level: ");
lcd.print(data);
delay(1000);
 
if ( data > 700) 
{
SendMessage();
Serial.print("Gas detect alarm");
lcd.clear();
lcd.setCursor(1,0);
lcd.print ("Exhaust fan :- ON");
lcd.setCursor(2,2);
lcd.print("Gas Level Exceed");
lcd.setCursor(2,3);
lcd.print("SMS Sent");
delay(1000);
 digitalWrite(buzzerPin, HIGH);
 digitalWrite(relay, HIGH);

}
else
{
 
Serial.print("Gas Level Low");
lcd.clear();
lcd.setCursor(2,3);
lcd.print("Gas Level Normal");
delay(1000);
digitalWrite(buzzerPin, LOW);
 digitalWrite(relay, LOW);

}
 
//lcd.clear();
}
 
void SendMessage()
{

delay(1000);
}

Credits

Daini
31 projects • 17 followers

Comments