Smoke Detector Menggunakan MQ-2 Gas Sensor

Overview

Hari ini kita akan bereksperiment dengan MQ-2, MQ-2 dapat mengukur gas Methane, Butane, LPG, Smoke.  Untuk interface dengan arduino, bisa menggunakan salah satu dari pin analog (a0-a5).

Specifications

Power Supply: 4.5V to 5V DC 
High sensitivity to Propane, Smoke, LPG and Butane 
Wide range high sensitivity to Combustible gases
Long life and low cost
Analog and Digital output available 
Onboard visual indicator (LED) for indicating alarm 
Compact design and easily mountable 
Simple 4 PIN header interface 
Drive circuit is simple. 
Sensor Type : Semiconductor 
Concentration : 300-10000ppm ( Combustible gas)
Supply voltage =5v

Internal Schematic MQ-2

where to buy
what we need
Schematic, frizting


Program

#include <MQ2.h>

//change this with the pin that you use
int pin = A0;
int lpg, co, smoke;

MQ2 mq2(pin);

void setup(){
  Serial.begin(9600);
  
  mq2.begin();
}

void loop(){
  
  /*read the values from the sensor, it returns
  *an array which contains 3 values.
  * 1 = LPG in ppm
  * 2 = CO in ppm
  * 3 = SMOKE in ppm
  */
  float* values= mq2.read(true); //set it false if you don't want to print the values in the Serial
  
  //lpg = values[0];
  lpg = mq2.readLPG();
  //co = values[1];
  co = mq2.readCO();
  //smoke = values[2];
  smoke = mq2.readSmoke();
  
  delay(1000);
}

Demonstration

Next Project

 

Leave a Reply

Your email address will not be published. Required fields are marked *