All Gas Sensors have 6 pins ,whether it is MQ2 (smoke), MQ3 (alcohol), MQ6 (LPG) or MQ7 (carbon monoxide).So , the following details apply to all types of MQ sensors.
MQ-2 is a Semiconductor Sensor for Combustible Gas and Smoke
This sensor detects the concentrations of combustible gas in the air and output its reading as an analog voltage.
MQ-2 gas sensor has high sensitivity to LPG, Propane and Hydrogen, also could be used to Methane and other combustible gas.
Sensitive material of MQ-2 gas sensor is Tin Di-Oxide SnO2, which has lower conductivity in clean air. When the target combustible gas exist, MQ 2 senses and its conductivity is more higher along with the gas concentration rising.
A simple electronic circuit is used to convert change of conductivity to corresponding output signal of gas concentration.
MQ-2 has 6 pins, 4 of them are used to fetch signals, and other 2 are Heater coil used for providing heating current.
You can use 5v DC or AC across H – H pins. And as you can see one of H pins goes to the power and the other one is connected to the ground. The pin A (you can connect both pins A )is connected between the power and the ground.The pin B gets an analog voltage when the sensor is active. Also across the output, you need the resistor RL. Before you connect the resistor use a potentiometer to tune and get accurate values. Generally RL value is between 20k and 200k.
Connecting five volts (AC or DC) across the heating (H) pins keeps the sensor hot enough to function correctly. Connecting five volts at either the A or B pins causes the sensor to emit an analog voltage on the other pins. A resistive load between the output pins and ground sets the sensitivity of the detector.
Generally in the market you get these sensors fixed on a breakout board.
This breakout board is designed to work with any of the MQ-series gas sensors, simplifying the interface from 6 to 3 pins—ground, +5V VCC, and an analog voltage output.
Connect VCC to 5 V, GND to ground, and OUT to an analog-to-digital converter (ADC). The board has two pairs through-hole pins for the required sensitivity-selecting resistor RL across GND and OUT. The resistance of RL should be calculated using the datasheet for your particular gas sensor.
The MQ gas sensors have no polarity, so the gas sensor will work with the board all the ways it fits into the 6 pins (there are two possible orientations on each side of the board).