How to make smoke detector alarm | Fire detector alarm

Robotica DIY
Robotica DIY
13.3 هزار بار بازدید - 4 سال پیش - How to make smoke detector
How to make smoke detector alarm | Fire detector alarm
Scroll down for code.....

We have seen fire alarm system or smoke detector alarm system in building or office. It is one of the best safety feature equipment for homes, offices or industries. It can cost around 8$ to 50$. but you can make your own Smoke Detector Alarm System using Arduino. It is suitable for detecting of NH3 (ammonia), Nox, Sulfide, alcohol, Benzene, smoke, CO2,etc. If you want to do more advance project like measure accurately particular gases etc. you need to calibrate it first. In this project we are detecting smoke and also calculating smoke percentage, which will be seen on LCD display.

LiquidCrystal_I2C library Github link
https://github.com/fdebrabander/Ardui...

I2C scanner arduino website
https://playground.arduino.cc/Main/I2...

If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.

LIST OF COMPONENT (affiliate links)

http://amzn.to/2fvSRJq   (Arduino)
http://amzn.to/2zg8aeX (I2C)
http://amzn.to/2yBk7eT (LCD display)
https://amzn.to/2Uj2AVl (MQ135 Air Quality Sensor)
http://amzn.to/2vSpUON   (LED)
http://amzn.to/2uKfEDf  (Piezo buzzer)
http://amzn.to/2vmSK8l  (Resistor)
http://amzn.to/2wxPmWz  (Breadboard)
http://amzn.to/2vJ3lvo   (Jumper wire)

Song: Elektronomia & JJD - Free [NCS Release]
Music provided by NoCopyrightSounds.
Video: Elektronomia & JJD - Free | House | N...
Link: http://ncs.io/Free

#include (LiquidCrystal_I2C.h) //instead of parenthesis () put angle bracket as YouTube description does not allow angle bracket
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x3F, 16, 2);

int redLED = 2;
int greenLED = 3;
int buzzer = 9;
int sensor = A0;
float smokePercentage;
float remainingGas;
float tolerance = 20;

int base_value = 305; // base value
int state; // state for blinking LED & buzzer without delay function

unsigned long previousMillis = 0;
const long interval = 400; // interval at which to LED blink & Buzzer sound (milliseconds)

void setup() {
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(sensor, INPUT);
Serial.begin(9600);
lcd.begin();
}

void loop() {
unsigned long currentMillis = millis();
float MQ135SensorValues = analogRead(sensor);

Serial.print("Sensor Values: ");
Serial.println(MQ135SensorValues);
lcd.setCursor(0, 0);
lcd.print("Smoke % :");

remainingGas = 1023 - base_value + tolerance;
smokePercentage = (MQ135SensorValues- base_value) /remainingGas ;
if (smokePercentage ) 0){
Serial.print("Smoke percentage: ");
Serial.println(smokePercentage*100);
lcd.setCursor(9, 0);
lcd.print(smokePercentage*100);
lcd.setCursor(14, 0);
lcd.print("%");
}
else {
lcd.setCursor(10, 0);
lcd.print("-SAFE-");
}


if (MQ135SensorValues ( (base_value + tolerance)) // Checks if MQ135 Sensor Value greater than base + tolerance value
{
digitalWrite(greenLED, LOW);
lcd.setCursor(0, 1);
lcd.print("Smoke Detected!!");
Serial.println("Smoke Detected!!");
if (currentMillis - previousMillis )= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED & buzzer is off turn it on and vice-versa:
if (state == LOW) {
state = HIGH;
} else {
state = LOW;
}
// Red LED and buzzer go HIGH or LOW
digitalWrite(redLED, state);
digitalWrite(buzzer, state);
}
}
else
{
digitalWrite(redLED, LOW);
digitalWrite(greenLED, HIGH);
digitalWrite(buzzer, LOW);
lcd.setCursor(0, 1);
lcd.print("Sensor Value:");
lcd.setCursor(13, 1);
lcd.print(MQ135SensorValues);

}
delay(500);
lcd.clear();
}
4 سال پیش در تاریخ 1399/01/06 منتشر شده است.
13,351 بـار بازدید شده
... بیشتر