Components Required:
Arduino Uno
MQ-2 (LPG Sensor)
Jumper Wires
Theory:
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.
Connection :
![](https://static.wixstatic.com/media/a27d24_9a722374cd8344cb88c3f698d9309cce~mv2.png/v1/fill/w_980,h_545,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/a27d24_9a722374cd8344cb88c3f698d9309cce~mv2.png)
Code:
int sensor=7; int gas_value; void setup() { pinMode(sensor,INPUT); Serial.begin(9600); } void loop() { gas_value=digitalRead(sensor); Serial.println(gas_value); }