Gas Sensor With LCD

Introduction: Gas Sensor With LCD

We are a group of UQD10801 (Robocon1) students from Universiti Tun Hussein Onn Malaysia (UTHM) that will show how to set up a circuit with Gas sensor and LCD.
The reason we chose Tinkercad is because they provide pre-built circuits that can help users to not complicate their circuits by building from scratch.

INTRODUCTION

MQ gas sensors are a family of devices designed to detect the presence of different chemical components in the air. We can connect these devices to an automaton or processor like Arduino. There is a wide variety of MQ sensors. Each model is designed to detect one or more substances, designed for a specific use, such as detection of flammable gases, air quality or detection of alcohol in breathed air. MQ gas sensors are usually provided with a standard measuring plate with the comparator LMC662 or similar, which allows the reading to be obtained both as an analog value and as a digital value when a certain regulated threshold is exceeded through a potentiometer located in the license plate. The gas sensors must be calibrated before obtaining an accurate measurement. Even calibrated these sensors do not have the necessary guarantee to be part of a security system. The sensors output is presented by a LCD screen.

Set up the circuit as the diagram above.

Supplies

Arduino board

Breadboard small x2

Gas sensor

LCD

Buzzer

Led

Resistor x3

Step 1: Code

CODES

#include

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

#define buzzerPin 8

#define gasPin A0

void setup() {

Serial.begin(9600);

lcd.begin(16, 2);

pinMode(buzzerPin,OUTPUT);

lcd.setCursor(0, 0);

lcd.print("Calibrating");

for(int i = 0; i <10; i++){

if (i==4)

{

lcd.setCursor(0, 1);

lcd.print(".");

}

else lcd.print(".");

delay(500);

}

lcd.setCursor(5, 1);

lcd.print("done");

delay(1000);

lcd.clear();

lcd.setCursor(1, 0);

lcd.print("SENSOR ACTIVE");

delay(1500);

lcd.clear();

}

void loop() {

int gasSensor = analogRead(gasPin);

if (gasSensor > 350)

{

digitalWrite(buzzerPin,HIGH);

lcd.setCursor(0, 0);

lcd.print("Value : ");

lcd.print(gasSensor);

Serial.print(gasSensor);

Serial.print("\t");

lcd.setCursor(0, 1);

Serial.println("Gas is Detected");

lcd.print("Gas is Detected");

delay(300);

lcd.clear();

}

else if (gasSensor < 350)

{

digitalWrite(buzzerPin,LOW);

lcd.setCursor(0, 0);

lcd.print("Value : ");

lcd.print(gasSensor);

Serial.print(gasSensor);

Serial.print("\t");

lcd.setCursor(0, 1);

Serial.println("Gas level is LOW");

lcd.print("Gas leve is LOW");

delay(300);

}

}

Step 2: Output

This is how it appears when the gas detected is low.

Step 3: When the Gas Detected Is HIGH

The LED and Buzzer will be turned on.

Step 4: OUR TUTORIAL VIDEO

Watch our video for a full expalnations.

Step 5:

Be the First to Share

    Recommendations

    • First Time Author Contest

      First Time Author Contest
    • Make it Fly Challenge

      Make it Fly Challenge
    • Fruit and Veggies Speed Challenge

      Fruit and Veggies Speed Challenge

    Comments