MQ5 LPG Sensor
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!
Circuit Diagram
The Program
int sensor=7; int gas_value; void setup() { pinMode(sensor,INPUT); Serial.begin(9600); } void loop() { gas_value=digitalRead(sensor); Serial.println(gas_value); }
Interfacing MQ5 Gas Sensor Module to Arduino using Analog Out Pin
The connections are very simple, just like we interfaced MQ5 using digital out pin. In this method, instead of DO, connect analog out pin AO of MQ5 to any of the arduino analog pins. In this tutorial, we are connecting analog out pin of MQ5 to A0 pin of Arduino. Connect Vcc and Ground properly as shown in circuit diagram and we are finished wiring part. Now there’s a little change in the program part. Instead of digitalRead, we need analogRead command of arduino to read sensor values. Output values are also different, instead of 0 and 1 we have a series of integer values ranging from 0 to 1023
The Program
float sensor=A0; float gas_value; void setup() { pinMode(sensor,INPUT); Serial.begin(9600); } void loop() { gas_value=analogRead(sensor); Serial.println(gas_value); }Output screenshots!
The outputs as seen in serial monitor of arduino are given below. Let’s first see the default output values (when no gas leak is applied) where MQ5 senses atmospheric air concentration only.
Comments
Post a Comment