Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views4 pages

Gas Sensor

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Gas Sensor

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Gas Sensor

By:

Hussam Alakhram, Ahmed Abo Hosain, Shady Baqesh, Mohammed Jamal


MQ-4 Sensor:

How it works
Gas sensors work on the principle of transforming the gas adsorption effects on the
surface of the active material into a detectable signal in terms of its changed
electrical, optical, thermal, mechanical, magnetic (magnetization and spin), and
piezoelectric properties.
Configuration:

Code:
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2);

// scientist BENIEL'S LAB

// GAS DETECTOR

int Input = A0;

int R_LED = 2;

int G_LED = 3;

int Buzzer = 4;

// VAL INTEGER

int val;

int MAX = 700;

void setup() {

lcd.init();

lcd.backlight();

lcd.setCursor(4.0);

lcd.print("Gas Sensor")
Serial.begin(9600);

pinMode(Input ,INPUT);

pinMode(R_LED ,OUTPUT);

pinMode(G_LED ,OUTPUT);

pinMode(Buzzer ,OUTPUT);

void loop() {

val = analogRead(A0);

if (val >= MAX) {

lcd.setCursor(3.1);

lcd.print("Gas Leakage");

digitalWrite(R_LED ,HIGH);

digitalWrite(Buzzer ,HIGH);

digitalWrite(G_LED ,LOW);

Serial.println("GAS LEAKING");

else {

lcd.setCursor(3.1);

lcd.print("No leakage");

digitalWrite(R_LED ,LOW);

digitalWrite(Buzzer ,LOW);

digitalWrite(G_LED ,HIGH);

Serial.println("NORMAL");

You might also like