Project:Smoke Detection with Arduino and MQ-2 Gas Sensor

Hello,and welcome back to enghme.Detecting smoke is very important because it is dangerous and can cause accidents. In this tutorial we will be making a smoke detector using an Arduino and an MQ-2.
Inside the smoke sensor is a built-in potentiometer that allows sensitivity to be adjusted depending on how accurate you want the gas to be to detect. The resistance of the sensor depends on the type of gas. The MQ-2 sensor is sensitive to smoke and various flammable gases such as LPG, methane, alcohol, butane, hydrogen, butane and propane.

How the project works:

The sensor voltage changes according to the levels of smoke or gas in the atmosphere. The sensor output voltage is directly proportional to the smoke concentration. The higher the gas the higher the voltage the lower the gas the lower the voltage. When gas is detected in the atmosphere, the red LED will turn green the other.

In this project we will need an Arduino, MQ-2, Resistor, Lcd display and LED

circuit diagram


project code:Smoke Detection with Arduino and MQ-2 Gas Sensor


LiquidCrystal lcd(12 , 11 , 5 ,4 ,3 ,2);
int Gas = 9;
int redLed = 7;
int greenLed = 6;

void setup() {

pinMode(Gas , INPUT);


void loop() {

if(digitalRead(Gas) == HIGH){
lcd.print(” Alert Gas Detected”);// Msg on lcd and red lcd will be on
digitalWrite(7 , HIGH);
digitalWrite(6, LOW);
lcd.print(” No Gas detected “);// Msg on lcd and green lcd will be on
digitalWrite(6, HIGH);
digitalWrite(7 ,LOW);


Post a Comment

Previous Post Next Post