Tuesday, April 26, 2016

Arduino Gas leakage sensor with LCD display

Arduino Gas leakage sensor with LCD display

Parts list:
Arduino board https://goo.gl/XR3mXG
LCD display 16x2 https://goo.gl/yTjFJS
Resistor 220 ohm (Resistor kit https://goo.gl/p4JvQY)
MQ-2 gas sensor module  https://goo.gl/eFg3Se
Potentiometer 1K (Potentiometer Kit https://goo.gl/z5b4X1)
Connecting wires https://goo.gl/BVC3pM



Arduino Gas leakage sensor with LCD display

Arduino Gas leakage sensor with LCD display


Arduino Gas leakage sensor with LCD display

Please subscribe to my YouTube channel here: 


Code:

#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);

  }

}