Overview
This project deals with fire or smoke detection using a Gas Sensor which senses the threshold value for the smoke and gives input to the buzzer and LED’s accordingly.
In this smoke detector when the gas sensor detects a value greater than 300, the buzzer and LED – Red gets activated and if the value is less than 300 than the LED – Green will be activated.
Hardware required
- Arduino Uno R3
- LED
- Resistor
- Jumper Wires
- Gas Sensor
- Buzzer
Schematic Diagram
![](https://makersmuse.in/wp-content/uploads/2024/06/image-14.png)
Fig 1. Circuit Diagram
Arduino Code :
int redLed = 12;
int greenLed = 11;
int buzzer = 10;
int smokeA0 = A5;
int sensorThres = 300;
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);
if (analogSensor > sensorThres)
{
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, LOW);
tone(buzzer, 1000, 200);
}
else
{
digitalWrite(redLed, LOW);
digitalWrite(greenLed, HIGH);
noTone(buzzer);
}
delay(100);
}
Precautions
- Connections should be done properly.
- Arduino is case Sensitive so code accordingly.
- Give different and appropriate colors to the wires.
- Use resistors for sensors and LED’s.