MQ-6 Gas Sensor Interfacing with Arduino UNO and LCD

Hello friends, this is my 4th post in blog and today we will learn about "How To Interface Gas Sensor with Arduino UNO and LCD."


Before starting we will first understand "What is Gas Sensor ?"
Gas sensor is a type of sensor which is capable to sense LPG gases and can give output HIGH or LOW logic signal to Arduino.
In this project I am using MQ6 GAS SENSOR but we can use other also so don't worry.


OK, lets look circuit in bread-board.
By the way you can use pin-13 as output you can connect buzzer or led to alert. I forget to join buzzer in pin-13. Better to put buzzer.



For video click the following link:-




CODE:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int LED = 13; 
int GAS_DO = 7; 
int STATE = 0; 
void setup() {
  lcd.begin(16,2);
  lcd.print("LPG LEAK SYSTEM");
  delay(1500);
  lcd.clear();
  pinMode(LED, OUTPUT); 
  pinMode(GAS_DO, INPUT);  
}
void loop() {
  STATE = digitalRead(GAS_DO); 
  if (STATE == HIGH) {  
   digitalWrite(LED, LOW); 
    lcd.print("SAFE");
    lcd.setCursor(0,1); 
    lcd.print("NO LPG LEAKAGE"); 
    delay(125);
    lcd.clear();
    
  } else { 
     digitalWrite(LED, HIGH);
    lcd.print("HIGH ALERT");
    lcd.setCursor(0,1);
    lcd.print("GAS IS LEAKED");
    delay(250);
    lcd.clear();
    delay(100);
  }
}

Comments

Post a Comment

Popular posts from this blog

#How to make wireless spy earpiece for your exams

Reed-switch Interfacing with Arduino UNO and LCD