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 hour40
Butane Gas Sensor

Things used in this project

Hardware components

Grove - Gas Sensor(MQ2)
Seeed Grove - Gas Sensor(MQ2)
×1
Arduino Mega 2560 & Genuino Mega 2560
Arduino Mega 2560 & Genuino Mega 2560
×1
Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud

Story

Read more

Schematics

Schematic

Circuit 1 heprcnh4js

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 • 0 followers

Comments

Add projectSign up / Login