Introduction: Smart Home Security System

About: A Student Who Loves To Tinker With Electronics & Has A Passion For Aviation. Currently Pursuing Bachelor's Degree In Computer Science Engineering At Vellore Institute Of Technology, Bhopal. I Have Been Into El…

SMART HOME SAFETY SYSTEM

This is a prototype consisting of a fire alarm, gas and smoke alarm, building collapse alarm and the anti-theft laser trip alarm combined in one unit along with the systems to communicate with the authorities during emergencies to provide all the available safety systems to a house.

The absence of efficient fire alarm systems to detect fire failed to warn the people and the authorities caused certain incidents like the Priya Cinema Hall fire, the Gariahat fire. These incidents made us to make certain efficient fire alarm system and a gas detecting system.

The absence of an anti-theft system caused problems of theft in the Tollygaunge area. We took these incidents to make the laser trip-wire system.

The Majherhat Bridge collapsed due to the absence of a system, which monitored the capacity of the beams and other parts of a building, or a bridge known as the building collapse monitor. This incident inspired us to make a building collapse monitor.

Although these systems are available abroad, but they have to be bought separately. We have combined them in one unit so that people can buy4 systems while spending money for one interface not for separate interface.

All four systems are connected parallelly. The fire alarm system is based on an Infrared Radiation detection, the gas, smoke alarm based on a smoke and gas sensor, the building collapse monitor is based on two flex sensors, and the tip wire system is based on photo resistor or LDR and a 5mWlaser, which is deviated by a 45-degree glass prism. The fire alarm, gas and smoke sensor, the building collapse monitor all works on same principle, the reading reaches maximum amount after which the alarm triggers. The trip wireworks on another principle, when the laser is falling of the LDR the alarm does not trigger and there is no danger, as soon as the laser is stopped the alarm triggers. All the four systems are connected using the Domino Effect. There isa communicating system used to inform the authorities like the police, when any one of the alarm triggers. There is a connected emergency light and alarm system again with the help of the Domino Effect which warns all the people is a house or a building when any one of the alarm triggers.

A Domino Effect or chain reaction is the cumulative effect produced when one event set off a chain of similar events. The term is best known as a mechanical effect and is used as an analogy to a falling row of dominoes. $ It typically refers to a linked sequence of events where the time between successive events is relatively small. It can be used literally (an observed series of actual collisions) or metaphorically (causal linkages within systems such as global finance or politics). The term Domino Effect is used both to imply that an event is inevitable or highly likely (as it has already started to happen), and conversely to imply that an event is impossible or highly unlikely (the one domino left standing).

BY: Students Of MP Birla Foundation Higher Secondary School, Kolkata, India

Bikramaditiya Munshi

Kazi Abdul Baset 



PS - This Is A Very Old Project Of Mine I Did In My Schooling. Good Days. had Uploaded It On Arduino Hub But Then After They Recently Revamped It Lost Most Of The Data. Whatever Was Left I Thought Lets Not Make It A Waste So Uploading Here Now. Ask Away For Any Questions Or Sorts. I Definitely Have Grown From The Novice Beginner I Was Then So Should Be Fine xD.

Supplies

  • Solderless Breadboard Full Size - 2
  • Flex Sensor - 1
  • Breadboard (generic) - 1
  • LED (generic) - 20
  • Arduino UNO - 8
  • Jumper wires (generic) - 1
  • Solderless Breadboard Half Size - 4
  • Grove - Gas Sensor (MQ2) - 1
  • LDR 5 Mohm - 10
  • Right Angle Prism - 1
  • Depron Sheets
  • Tape
  • IR receiver (generic) - 1
  • Soldering iron (generic)
  • Hot glue gun (generic)
  • Hobby knife

Step 1: Circuits

All The Relevant Circuits, Drawn Out & Labeled.

Step 2: Code

IR Sensor

int Buzzer = 13;  // Use Buzzer for Alert 
int FlamePin = 2; // This   is for input pin
int Flame = HIGH; // HIGH when FLAME Exposed
int led = 11;      // Use LED for Alert
void setup() { 
 pinMode(led, OUTPUT);
 pinMode(Buzzer,   OUTPUT);
 pinMode(FlamePin, INPUT);
 Serial.begin(9600);
}

void   loop() {
 Flame = digitalRead(FlamePin);
 if (Flame== LOW)
 {
 Serial.println("HIGH   FLAME");
 digitalWrite(Buzzer, HIGH);
 digitalWrite(led, HIGH);
 delay(10);
   }
 else
 {
 Serial.println("No flame");
 digitalWrite(Buzzer, LOW);
   digitalWrite(led, LOW);
 }
}

Trip Wire

// Variables
int mode = 1;
int ambiant;
int trip = 1000; // The  light value I get when using my laser
int minLight = 900;
int makeBeep = 1;  //0 for no beep, 1 for beep!
int atAverage;
long millisCount;
// Output  Pins
int laserPin = 2;
int ledPin = 13;
int buzzerPin = 3;
String  modeNames[3]  = {"SETTINGS","ARMED","TRIP"};


// Input Pins
int modePin = 4; 
int  tripPin = A0;
int ambiantPin = A1;


void setup() {
  pinMode(ledPin,  OUTPUT);
  pinMode(laserPin, OUTPUT);
 pinMode(buzzerPin, OUTPUT);
  pinMode(modePin,  INPUT);
  Serial.begin(9600);
}


void loop() {


  switch (mode)  {
    case 0: //calibration mode
      digitalWrite(laserPin,HIGH);

      ambiant = analogRead(ambiantPin);
      trip = analogRead(tripPin);
      atAverage = ambiant + ((trip - ambiant)/2);
      stats();

      if (trip  >= minLight) {
        digitalWrite(ledPin,HIGH);
      }  else {
        digitalWrite(ledPin,LOW);
      }


    break;


    case 1: // Armed mode
      digitalWrite(laserPin,HIGH);
      digitalWrite(ledPin,LOW);
      ambiant = analogRead(ambiantPin);
      atAverage = ambiant + ((trip -  ambiant)/2);
      if (analogRead(tripPin) < atAverage) {
        mode = 2;
      }
      if ((millis() - millisCount) >= 3000) {
        millisCount  = millis();
        stats();
      }
    break;

    case 2:  //Trip Mode
      if ((millis() - millisCount) >= 1000) {
        millisCount  = millis();
        stats();
        beep(3);
        mode = 1;
      }
    break;
    }



  delay(0.5);                       // wait for  a bit
}


//It Beeps
void beep(int qty) {
  int count;
  if (makeBeep  == 1) {
    for (count = 1;count<=qty;count++) {
      digitalWrite(buzzerPin,  HIGH);
      delay(50);
      digitalWrite(buzzerPin, LOW);
      delay(50);
    }
  }
}


//Writes stats to the Serial Port
void stats() {
  Serial.print("A:");
  Serial.print(ambiant);
  Serial.print(" T:");
  Serial.print(trip);
  Serial.print(" AT:");
  Serial.print(atAverage);
  Serial.print(" MODE:");
  Serial.print(modeNames[mode]);
  Serial.println("");
}

Flex Sensor

//Constants:
const int ledPin = 3;   //pin 3 has PWM funtion
const  int flexPin = A0; //pin A0 to read analog input
int Buzzer = 13; // Use buzzer  for alert 
//Variables:
int value; //save analog value


void setup(){
  pinMode(Buzzer, OUTPUT);
  pinMode(ledPin, OUTPUT);  //Set pin 3 as 'output'
  Serial.begin(9600);       //Begin serial communication
}


void loop(){
  value = analogRead(flexPin);         //Read and save analog value from potentiometer
  value = map(value, 700, 900, 0, 255);//Map value 0-1023 to 0-255 (PWM)
    Serial.println(value);               //Print value
  if(value<=-600 && value>=-790){
  analogWrite(ledPin,  LOW);
  digitalWrite(Buzzer, LOW);  
  }//Send PWM value to led
  else{
     digitalWrite(Buzzer, HIGH);
    analogWrite(ledPin, HIGH);  
  }
  delay(100);                          //Small delay

}

Smoke/Gas Sensor

int redLed = 12;
int buzzer = 10;
int smokeA0 = A5;
// Your
  threshold value
int sensorThres = 290;

void setup() {
  pinMode(redLed,
  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);
    tone(buzzer, 100, 200);
  }
  else
  {
    digitalWrite(redLed,
  LOW);
    noTone(buzzer);
  }
  delay(150);
}

Display

#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>

//   OLED display TWI address
#define OLED_ADDR   0x3C

Adafruit_SSD1306 display(-1);

#if   (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

//const   won't change
const int ledPin = 13;   //the number of the LED pin
const int   ldrPin = A0;  //the number of the LDR pin

void setup() {
  // initialize   and clear display
  display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
  display.clearDisplay();
   display.display();

  // display a pixel in each corner of the screen
   display.drawPixel(0, 0, WHITE);
  display.drawPixel(127, 0, WHITE);
  display.drawPixel(0,   31, WHITE);
  display.drawPixel(127, 31, WHITE);

  // display a line of   text
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,1);

   // update display with all of the above graphics
  display.display();
   Serial.begin(9600);
  pinMode(ledPin, OUTPUT);  //initialize the LED pin as an output
  pinMode(ldrPin,   INPUT);   //initialize the LDR pin as an input
}


void loop() {
  //   put your main code here, to run repeatedly:
int ldrStatus = analogRead(ldrPin);    //read the status of the LDR value

  //check if the LDR status is <=   300
  //if it is, the LED is HIGH
  Serial.println(ldrStatus);
   if (ldrStatus   >=500) {
   display.print("ALARM!");
   display.print("CALLTHE POLICE");
     digitalWrite(ledPin, HIGH);               //turn LED on
    Serial.println("ALARM");

   // update display with all of the above graphics
  display.display();
   }
   else {
    digitalWrite(ledPin, LOW);          //turn LED off
    Serial.println("---------------");

  }
}