Analog Gas Sensor(MQ4) (SKU:SEN0129)

From DFRobot Electronic Product Wiki and Tutorial: Arduino and Robot


The MQ4 is used in gas leakage detecting equipment in consumer and industry markets,this sensor is suitable for detecting CH4,Natural gas, LNG, avoid exposure to alcohol, cooking fumes, and cigarette smoke. The sensitivity can be adjusted by the potentiometer.


  • Power supply needs: 5V
  • Interface type: Analog
  • Pin Definition: 1-Output 2-VCC 3-GND
  • High sensitivity to CH4£¬Natural gas
  • Small sensitivity to alcohol, smoke
  • Fast response
  • Stable and long life
  • Simple drive circuit
  • Size: 40x20mm

Pin Definition

  1. Signal Output
  2. Power
  3. GND
Analog Sensor Pin Definition


Potentiometer is used to calibrate the readings from this sensor as stated on the datasheet:


Resistance value of MQ-4 is difference to various kinds and various concentration gases. So,When using this components, sensitivity adjustment is very necessary. we recommend that you calibrate the detector for 5000ppm of CH4 concentration in air and use value of Load resistance ( RL) about 20KΩ(10KΩ to 47KΩ). When accurately measuring, the proper alarm point for the gas detector should be determined after considering the temperature and humidity influence.

Connection Diagram

Analog sensor connection diagram

Sample Code

///Arduino 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

Nextredirectltr.pngGo Shopping 3 Analog Gas Sensor(MQ4) (SKU:DFR0129)

Category: DFRobot > Sensors & Modules > Sensors > Air Sensors