Tuesday, April 26, 2016

Arduino Gas leakage sensor with LCD display

By this Arduino project you can display the amount of LPG and methane gas leakage on 16x2 LCD display.
I set the program to run the buzzer when the value become 15 or more, you can change this level.
you have to use 150 to 220 ohm resistor to protect the backlight LED of display.

Parts list:
LCD display 16x2
buzzer
Resistor 220 ohm
MQ-4 gas sensor module 
Potentiometer 1K
Connecting wires
Arduino board




Arduino Gas leakage sensor with LCD display

Arduino Gas leakage sensor with LCD display


Arduino Gas leakage sensor with LCD display





#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);


int potPin = A4;

int potValue = 0;

int buzzer = 6;


void setup() {

    lcd.begin(16, 2); // lcd rows and columns

    lcd.print("GAS SENSOR");

    pinMode(6, OUTPUT);


}


void loop() {

    potValue = analogRead(potPin);

  

    lcd.setCursor(0, 1);

    lcd.print("Value = ");

    lcd.print(potValue);

    delay(1000);

    lcd.print(" ");

    delay(1);


if (potValue>15)

{

    digitalWrite(6,HIGH);

    delay(1000);

  }

}