How to Use a Gas Sensor (MQ-2)

How to Use a Gas Sensor (MQ-2)

This project will show you how to use an MQ-2 gas sensor.

  • 13 views
  • 0 comments
  • 2 respects

Components and supplies

Apps and online services

About this project

The Gas Sensor is a sensor which detects gas and smoke with concentration between 300ppm and 10000ppm.

He can detect butane, propane, methane, alcohol, hydrogen and smoke. He can be only used Inside, at ambient temperature.

He has 2 pins for the power, 1 pin for the analogic value and 1 pin for the digital value. For this project, we'll use the analogic pin.

Connections

Arduino --> Sensor

5V --> VCC

GND --> GND

A0 --> A0

+ Green Led --> D13

+ Red Led --> D12

Code

Smoke detector Arduino
void setup(){
  pinMode(13,1);
  pinMode(12,1);
  Serial.begin(115200);
}

void loop() {
  int Value = analogRead(A0);

  Serial.println("Analogic Value coming from the sensor : ");  
  Serial.println(Value);
  delay(100);

  if(value<400){
    digitalWrite(13,1);
  }
  else{
    digitalWrite(12,1);
  }
  delay(20);
}

Comments

Similar projects you might like

Smoke Detection using MQ-2 Gas Sensor

by Aritro Mukherjee

  • 280,716 views
  • 47 comments
  • 178 respects

How to Connect MQ2 Gas Sensor to Arduino

by Junez Riyaz

  • 7,668 views
  • 0 comments
  • 4 respects

MQ-4 Natural Gas Sensor Experiment Based on Arduino

Project tutorial by Andrew85

  • 2,239 views
  • 1 comment
  • 7 respects

Arduino And MQ2 Gas Sensor

Project showcase by Mahamudul Karim Khondaker

  • 9,982 views
  • 7 comments
  • 17 respects
Add projectSign up / Login