5% OFF Over $19, Code: Elephant5; 10% OFF Over $59, Code: Elephant10



Arduino UNO R3/MEGA 2560 R3 Project 24: Analog Gas Sensor

Posted by Fiona Su on

Introduction

This analog gas sensor - MQ2 is used in gas leakage detecting equipment in both consumer electronics and industrial markets. This sensor is suitable for LPG, I-butane, propane, methane, alcohol, Hydrogen and smoke detection. It has high sensitivity and quick response. In addition, the sensitivity can be adjusted by the potentiometer.

Video Tutorial

Specification

  • Power supply: 5V
  • Interface type: Analog
  • Wide detecting scope
  • Quick response and high sensitivity
  • Simple drive circuit
  • Stable and long lifespan

Connection

Connection for REV4:

thumb

Connection for 2560 R3:

thumb

Sample Code:

void setup()
{
  Serial.begin(9600); //Set serial baud rate to 9600 bps
}
void loop()
{int val;
val=analogRead(0);//Read Gas value from analog 0
Serial.println(val,DEC);//Print the value to serial port
delay(100);
} 

Result

Done wiring and powered up, upload well the code, then open the serial monitor and set the baud rate as 9600, you will see the analog value. When detecting the gas, the value will make a change.

thumb

All Tutorial

Buy 

0 comments

Leave a comment

Please note, comments must be approved before they are published