Aathavan karuppusamy
Published © GPL3+

Butane Gas Sensor

This project helps us to detect the leakage and presence of butane gas in the area arround the divice!

IntermediateProtip1 hour2,213
Butane Gas Sensor

Things used in this project

Story

Read more

Schematics

Schematic

Code

Gas code Arduino

Arduino
/*******
 
 All the resources for this project:
 https://www.hackster.io/Aritro

*******/

int redLed = 12;
int greenLed = 11;
int buzzer = 10;
int smokeA0 = A5;
// Your threshold value
int sensorThres = 400;

void setup() {
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(smokeA0, INPUT);
  Serial.begin(9600);
}

void loop() {
  int analogSensor = analogRead(smokeA0);

  Serial.print("Pin A0: ");
  Serial.println(analogSensor);
  // Checks if it has reached the threshold value
  if (analogSensor > sensorThres)
  {
    digitalWrite(redLed, HIGH);
    digitalWrite(greenLed, LOW);
    tone(buzzer, 1000, 200);
  }
  else
  {
    digitalWrite(redLed, LOW);
    digitalWrite(greenLed, HIGH);
    noTone(buzzer);
  }
  delay(100);
}

Credits

Aathavan karuppusamy

Aathavan karuppusamy

1 project • 1 follower

Comments