MQ SENSOR

TINKS027

  1. This is a simple-to-use compressed natural gas (CNG) sensor, suitable for sensing natural gas (composed of mostly Methane [CH4]) concentrations in the air.
  2. We can also use this sensor to get Digital and Analog output from digital and analog pin.
Features:-
  1. High Sensitivity to Methane, NaturalGas
  2. 5V DC operating voltage.
  3. I/O pins are 5V and 3.3V compliant.
  4. Fast Response.
  5. Stable and Long Life.
  6. Range :- Upto 5cms.
  7. Low Cost.
  8. Analog and Digital Outputs.
  9. Detecting Concentration: 200 ~ 10,000 ppm.
Applications:-
  1. Domestic gas leakage detector
  2. Industrial Combustible gas detector
  3. Portable gas detector

    

int AOUTpin=0; //the AOUT pin of the methane sensor goes into analog pin A0 of the arduino
int DOUTpin=8; //the DOUT pin of the methane sensor goes into digital pin D8 of the arduino


int limit;
int value;

void setup()
{
Serial.begin(9600); //sets the baud rate
pinMode(DOUTpin, INPUT);

}

void loop()
{

value= analogRead(AOUTpin); //reads the analaog value from the methane sensor's AOUT pin
limit= digitalRead(DOUTpin); //reads the digital value from the methane sensor's DOUT pin

Serial.print("Methane value: ");
Serial.println(value); //prints the methane value
Serial.print("Limit: ");
Serial.print(limit); //prints the limit reached as either LOW or HIGH (above or below)
delay(1000);

if (limit == HIGH)
{
Serial.println("gas detected");
}
else
{
Serial.println("not detected");
}}