Skip to main content

How to use MQ2 Gas Sensor



Gas Sensor

Introduction 
The MQ series of gas sensors use a small heater inside with an electro-chemical sensor. They are sensitive for a range of gasses and are used indoors at room temperature. The output is an analog signal and can be read with an analog input of the Arduino.
The MQ-2 Gas Sensor module is useful for gas leakage detecting in home and industry. It can detect LPG, i-butane, propane, methane ,alcohol, hydrogen and smoke.

Picture
Some modules have a built-in variable resistor to adjust the sensitivity of the sensor.
Note: The sensor becomes very hot after a while, don't touch it!
In this tutorial we will use the serial monitor of  Arduino IDE  to see how the sensor acts in variable gasses.

What you will need - Hardware

For this project you will need:
  • Arduino uno
  • Breadboard
  • MQ-2 Gas sensor module
Picture

The Circuit

The connections are pretty easy, see the image above with the breadboard circuit schematic.
  • Vcc & GND pins of sensor --> Arduino GND
  • Signal (middle pin) --> Arduino Pin 2
  • 4.7K Resistor between signal pin and 5V pin

The Code:
*******************************************************************
/* Testing MQ-2 GAS sensor with serial monitor
   Suitable for detecting of LPG, i-butane, propane, methane ,alcohol, Hydrogen or smoke

const int gasPin = A0; //GAS sensor output pin to Arduino analog A0 pin
void setup()
{
Serial.begin(9600); //Initialize serial port - 9600 bps
}

void loop()
{
Serial.println(analogRead(gasPin));
delay(1000); // Print value every 1 sec.
}

*******************************************************************
 

Well done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use the MQ-2 Gas sensor with Arduino.
Tip: You can use this tutorial to read values from all MQ gas sensors (MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, etc)
I hope you liked this, let me know in the comments.

Comments

Popular posts from this blog

Arduino ​Obstacle Avoiding Robot Ardunio Computer

Build Your Own Arduino Weather Station

Complete Guide for Nokia 5110 LCD with Arduino