MQ-5 GAS LEAK DETECTOR
This project is used to detect the gas leak and alert us that the gas is leaking. You can use it for your science projects.
FOR VIDEO :
THING'S NEEDED
- Arduino UNO R3
- MQ-5 Gas Sensor
- 2 - LEDS
- Buzzer
CIRCUIT DIAGRAM
WIRING
SENSOR TO ARDUINO
- Connect the Vcc Pin of sensor to 5V of Arduino.
- Connect the GND pin of sensor to GND of Arduino.
- Connect the AO (analogOutput) of sensor to pin A0 of Arduino.
LED & BUZZER TO ARDUINO
- Connect the Red LED to pin 2 of Arduino.
- Connect the Green LED to pin 3 of Arduino.
- Connect the Buzzer to pin 4 of Arduino.
CODE
// scientist BENIEL'S LAB
// GAS DETECTOR
int Input = A0;
int R_LED = 2;
int G_LED = 3;
int Buzzer = 4;
// VAL INTEGER
int val;
int MAX = 400;
void setup() {
Serial.begin(9600);
pinMode(Input ,INPUT);
pinMode(R_LED ,OUTPUT);
pinMode(G_LED ,OUTPUT);
pinMode(Buzzer ,OUTPUT);
}
void loop() {
val = analogRead(A0);
if (val >= MAX) {
digitalWrite(R_LED ,HIGH);
digitalWrite(Buzzer ,HIGH);
digitalWrite(G_LED ,LOW);
Serial.println("GAS LEAKING");
}
else {
digitalWrite(R_LED ,LOW);
digitalWrite(Buzzer ,LOW);
digitalWrite(G_LED ,HIGH);
Serial.println("NORMAL");
}
}
SUBSCRIBE TO "scientist BENIEL'S LAB" IN YOUTUBE FOR MORE ELECTRONIC'S & ROBOTIC'S PROJECTS.
THANK YOU
Comments
Post a Comment