Mq-4 Sensor

Working Principle:

This is a simple-to-use comprssed natural gas sensor, suitable for sensing natural gas (composed of mostly Methane [CH4]) concentrations in the air. The MQ-4 can detect natural gas concentrations anywhere from 200 to 10000ppm.The principal use of methane is as a fuel. The combustion of methane is highly exothermic, meaning reactions create the release of a great deal of energy. The energy released by the combustion of methane, in the form of natural gas, is used directly to heat homes and commercial buildings. It is also used in the generation of electric power. During the past decade, natural gas accounted for about 1/5 of the total energy consumption worldwide 

 Arduino Interfacing

Pin Configuration:

 Vcc: 5v


A0: Analog pin of arduino

D0: Digital pin of arduino




const int AOUTpin=0;//the AOUT pin of the methane sensor goes into analog pin A0 of the arduino
const int DOUTpin=8;//the DOUT pin of the methane sensor goes into digital pin D8 of the arduino
const int ledPin=13;//the anode of the LED connects to digital pin D13 of the arduino

int limit;

int value;

void setup() {

Serial.begin(115200);//sets the baud rate
pinMode(DOUTpin, INPUT);//sets the pin as an input to the arduino
pinMode(ledPin, OUTPUT);//sets the pin as an output of the arduino
}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 underneath)
if (limit == HIGH){
digitalWrite(ledPin, HIGH);//if limit has been reached, LED turns on as status indicator
digitalWrite(ledPin, LOW);//if threshold not reached, LED remains off


  • High sensitivity
  • High response
  • longer sustain
  • Highly capable



  • Domestic gas leakage detector
  • Industrial Combus
  • tible gas detector
  • Portable gas detector