Description:
The code basically works on Arduino UNO or similar Arduinos. It accepts signal from the MQ-5 Gas Sensor and forwards it to Relay Module that in turn controls the LED, Exhaust fans and motors etc.
Code currently turns off lightings for 10 seconds and turns on exhaust and Buzzer for the escape of gas for the 10seconds which can be edited as per your choice. LPG Gas leakage detector project Arduino coding
Materials Used:
1) Arduino UNO
2) MQ-5 Gas Sensor
3) Relay Module(Single Channel)
4) LED light
5) Piezo Buzzer
6) Exhaust Fan
7) 9V Batteries-3 #to power the whole system
COPY THE CODE INTO ARDUINO EDITOR FROM BELOW-:
/*Code started#define Sensor pin = A0;#define relay pin = D9;#define Buzzer Pin = D8;Code last edited by Dhruv devFor any help DM on*/float sensor=A0;float relay=9;float buzzer=8;float gas_value;void setup(){pinMode(sensor,INPUT);pinMode(relay ,OUTPUT);pinMode(buzzer,OUTPUT);Serial.begin(9600);}void loop(){gas_value=analogRead(sensor);Serial.println(gas_value);if(gas_value >= 100){digitalWrite(relay, LOW);digitalWrite(buzzer, HIGH);delay(10000);digitalWrite(relay, HIGH);digitalWrite(buzzer, LOW);}else{digitalWrite(relay, HIGH);digitalWrite(buzzer, LOW);}}
Tags:
Arduino code for LPG gas leakage detector
Arduino UNO
LPG Detector
LPG Gas leakage detector code
