LPG Gas Leakage Detector Project- Arduino UNO Code



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 dev 

        For 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);
}}

Dhruv dev

Hey there, I am Dhruv dev and I am a student, in short, a "PETERIAN"(St Peter's College), who is invested in blogging. I am the author of the "Techproofblog" and "Android Tackler" and you can also find me on Youtube(Tech Proof). Hope you enjoy the content.

Post a Comment

Thank you for getting in touch with us!

We appreciate you contacting us. We will get back in touch with you soon! Have a great day!

Previous Post Next Post