Arduino and MQ-4 Gas sensor example

The MQ-4 gas sensor modules are used in gas leakage detecting equipments, they are suitable for the detection of CH4,Natural gas.LNG, avoid alcohol and cooking fumes and cigarette smoke with this sensor.

Features

  • High sensitivity to CH4 and Natural gas
  • Slight sensitivity to alcohol, smoke
  • Fast response
  • Stable and long life
  • Simple drive circuit

Connection was as follows

VCC - 5V
GND - GND
A0  - Analog pin0
D0  - Not connected

Code

void setup() 
{
  Serial.begin(9600);
}
 
void loop() 
{
  float sensorVoltage; 
  float sensorValue;
 
  sensorValue = analogRead(A0);
  sensorVoltage = sensorValue/1024*5.0;
 
  Serial.print("sensor voltage = ");
  Serial.print(sensorVoltage);
  Serial.println(" V");
  delay(1000);
}

 

Results

Again via the serial monitor

sensor voltage = 0.22 V
sensor voltage = 0.22 V
sensor voltage = 0.22 V
sensor voltage = 0.23 V
sensor voltage = 0.23 V
sensor voltage = 0.23 V
sensor voltage = 0.24 V

 

Links

Mq-4 datasheet
MQ4 Methane Gas Sensor

Related