srajandikshit147
Published © GPL3+

Smoke Detector using Gas Sensor

In this project, we will learn how to create a smoke detector using Arduino. This will help us detect the intensity of gases.

IntermediateFull instructions provided19,330
Smoke Detector using Gas Sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Seeed Studio Gas Sensor
×1
Buzzer, Piezo
Buzzer, Piezo
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1
Resistor 220 ohm
Resistor 220 ohm
×4
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Tinkercad
Autodesk Tinkercad
This CAD tool helps to create and simulate the requisite circuit

Story

Read more

Schematics

Schematic of Smoke Detector

Code

Code for smoke Detector

Arduino
int red_LED_PIN = 11;
int green_LED_PIN = 9;
int blue_LED_PIN = 10;
int buzzer = 6;
int smoke_detector = A0;
int safety_lim = 60; //Sets smoke density safe limit

void setup() {
  pinMode(red_LED_PIN, OUTPUT);
  pinMode(green_LED_PIN, OUTPUT);
  pinMode(blue_LED_PIN, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(smoke_detector, INPUT);
  Serial.begin(9600); //baud rate
}

void loop() {
  int sensor_read = analogRead(smoke_detector); 
  	//reads and stores the reading from the detector in sensor_read

  Serial.print("Smoke Density: ");
  Serial.println(sensor_read);
  
  if (sensor_read > safety_lim)
    // Checks if reading is beyond safety limit
  {
	analogWrite(red_LED_PIN,255);
    analogWrite(green_LED_PIN, 0);
    tone(buzzer,500, 100); //piezo rings 
  }
  else
  {
    analogWrite(green_LED_PIN, 255);
    analogWrite(red_LED_PIN,0);
    noTone(buzzer); //peizo wont ring
  }
  delay(50);
}

Credits

srajandikshit147

srajandikshit147

0 projects • 2 followers

Comments