Interfacing MQ5 LPG Sensor to Arduino

In this guide, we learn how to interface MQ5 Gas sensor (which is a generic Gas Sensor more suited to detect and determine LPG concentrations) with Arduino.

In this tutorial, we are using the MQ5 Gas sensor module (which is widely available in market) . This module has two output possibilities – an analog out (A0) and a digital out (D0). The analog out can be used to detect Gas leakage and to measure volume of Gas leakage (by doing proper calculation of the sensor output inside program) in specific units (say ppm). The digital out can be used to detect Gas leakage and hence trigger an alert system (say a sound alarm or an sms activation etc). The digital out gives only two possible outputs – High and Low (hence its more suited for detection of gas leak than to measure volume of gas presence).


Note:- We have developed a Gas Leakage Detector using Arduino and MQ5 with SMS Alert, Sound Alarm and Relay activation. You can try this interesting project to gain more knowledge and build a practical application using MQ5 sensor.

Note 2:- We have created 100+ simple and advanced arduino projects – which you can try yourself for your electronics engineering course or to gain knowledge! You can also try most of these circuits and projects for your hobby and fun!

Interfacing MQ5 Gas Sensor Module to Arduino using Digital Out Pin

This is pretty simple. Connect the D0 pin of MQ5 module to any digital pin of arduino. Lets connect D0 to pin 7 of arduino. Now we need to give power supply (Vcc) and complete the circuit by connecting to ground (Gnd).

Refer the circuit diagram given below. Take a +5V connection from arduino and connect it to Vcc of MQ5 module. Finally connect the GND pin of MQ5 module to GND of arduino. That’s all and we have finished the circuit.

Circuit Diagram of Interfacing MQ5 to Arduino (Digital Out)

Note:- MQ5 sensor has preheating requirement. We advise to keep the sensor powered on (from arduino) for some 15 minutes before applying gas to it.

The Program
int sensor=7;
int gas_value;
void setup()



void loop()


Note:- To apply a “gas leak” to MQ5 sensor, you can simply use a cigarette or cigar lighter! Press the trigger switch of cigarette lighter gently (gentle enough so as gas leaks and spark is not triggered) to get gas leaked continuously and place the lighter near MQ5 sensor.

Read More: Interfacing MQ5 LPG Sensor to Arduino

Leave a Comment

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

Scroll to Top