Contents

Interfacing MQ-4 Smoke Gas Sensor Module with Arduino

MQ-4 Smoke Gas Module Features

MQ series sensors use a small heater inside with an electrochemical sensor in order to measure different kinds of gases combination. This is a simple-to-use compressed natural gas (CNG) sensor, suitable for sensing natural gas (composed of mostly Methane [CH4]) concentrations in the air. MQ-4 has a high switching speed, no noise when switching, and also has a long life.

It has a low sensitivity to alcohol and smoke. The sensor normally has a zero output, and its output increases with gas detection.

Note

After turning on the module, wait 2 minutes for the heater inside the sensor to be ready to work.

You can download the datasheet of this module here.

MQ-4 Smoke Gas Module Pinout

This sensor has 4 pins:

  • 5V: Module power supply – 5 V
  • GND: Ground
  • DOUT: Digital output
  • AOUT: analog output

You can see pinout of this module in the image below.

Required Materials

Hardware Components

Arduino UNO R3 × 1
MQ-4 Smoke Gas Module × 1
Male to Female jumper wire × 1

Software Apps

Arduino IDE

Interfacing MQ-4 Smoke Gas Module with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to MQ-4 module. Connect wires accordingly.

Step 2: Code

Upload the following code to your Arduino.

    /*
  modified on Sep 28, 2020
  Modified by MohammedDamirchi from Arduino Examples
  
Home
*/ // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // print out the value you read: Serial.println(sensorValue); delay(20); }

After uploading the code, you can see the output in the serial monitor.

Liked What You See?​
Get Updates And Learn From The Best​

Leave a Reply

Your email address will not be published. Required fields are marked *