Hello Friends, Welcome to Official Website of Mr. Modify GamerzContact Me
Follow on Instagraminstagram.com/itz_mr269
Eye Comfort Full Screen Original Screen
Posts

Gas Leakage Detector












COMPONENT LIST

Arduino UNO - ₹360
Gas Sensor - ₹90
Servo Motor - ₹60
Breadboard - ₹50
9V Battery - ₹25
Jumping Wires - ₹20
DC Motor - ₹10
LED ๐Ÿ”ด๐ŸŸก๐ŸŸข - ₹10
Resistor - ₹10
Buzzer - ₹10
Potentiometer - ₹5
#include <Servo.h> 
Servo servo;

int gas = A0;
int green1 = 2;
int green2 = 4;
int green3 = 7;
int yellow1 = 8;
int yellow2 = 9;
int red1 = 10;
int red2 = 11;
int buzz = 5;
int motor = 3;
int pp = A1;

void setup() {
  pinMode(gas, INPUT);
  pinMode(green1, OUTPUT);
  pinMode(green2, OUTPUT);
  pinMode(green3, OUTPUT);
  pinMode(yellow1, OUTPUT);
  pinMode(yellow2, OUTPUT);
  pinMode(red1, OUTPUT);
  pinMode(red2, OUTPUT);
  pinMode(buzz, OUTPUT);
  pinMode(motor, OUTPUT);
  servo.attach(6);

  Serial.begin(9600);
}

void loop() {
  int pv = analogRead(pp);                          
  int range = map(pv, 0, 1023, 180, 600);            
  int gasValue = analogRead(gas);                    

  
  Serial.print("gas- ");
  Serial.print(gasValue);
  Serial.print("  threshold base- ");
  Serial.println(range);

  delay(200);

  digitalWrite(green1, LOW);
  digitalWrite(green2, LOW);
  digitalWrite(green3, LOW);
  digitalWrite(yellow1, LOW);
  digitalWrite(yellow2, LOW);
  digitalWrite(red1, LOW);
  digitalWrite(red2, LOW);
  digitalWrite(buzz, LOW);
  digitalWrite(motor, LOW);


  if (gasValue > range) {
    digitalWrite(green1, HIGH);
    servo.write(0);
  }
  if (gasValue > range + 70) {
    digitalWrite(green2, HIGH);
  }
  if (gasValue > range + 100) {
    digitalWrite(green3, HIGH);
  }
  if (gasValue > range + 130) {
    digitalWrite(yellow1, HIGH);
  }
  if (gasValue > range + 160) {
    digitalWrite(yellow2, HIGH);
  }
  if (gasValue > range + 220) {
    digitalWrite(red1, HIGH);
    digitalWrite(buzz, HIGH);
    digitalWrite(motor, HIGH);
    servo.write(90);
  }
  if (gasValue > range + 240) {
    digitalWrite(red2, HIGH);
  }

  delay(500);
}
TROUBLESHOOTING 1. LEDs not glowing due to loose connection - Circuit to be handled carefully to avoid loose connection. 2. DC motor of fan not rotating due to less voltage from battery - Backup battery to be kept if battery is discharged.

Post a Comment

Cookies Policy
We can ensure your information is completely secure and private on our website and is not leaked. Google collects minor cookies for your better experience and we are not responsible for it.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.