Aidia NaimThomas JoyceBabiker Suliman
Published

College Friendly Security System

Security system customized for apartments to notify you upon the arrival of unwanted visitors in your home through the entrances or window.

BeginnerFull instructions provided3 hours2,393
College Friendly Security System

Things used in this project

Hardware components

Photon
Particle Photon
×3
Buzzer
Buzzer
×1
Proximity Sensor
Proximity Sensor
×2
Breadboard (generic)
Breadboard (generic)
×3

Software apps and online services

Maker service
IFTTT Maker service
Atomiot

Story

Read more

Schematics

Sensor Schematic

Buzzer Schematic

Buzzer Circuit

Window Data Acquisition

The following graph outlines the number of times the window was open during a specified time period of the day. A value of 0 indicates a closed window, while a value of 1 indicates an open window.

Door Data Acquisition

The following data displays the number of times the door was open during a specified time period of the day. A value of 0 indicates a closed door while a value of 1 indicates an open door.

Code

Door Sensor Code

C/C++
 int inswitch = D1;               // choose the input pin (for reed swtich)
 int pirState = 0;             // we start with the door/window closed
 int val = 0;                    // variable for reading the pin status
  
void setup() {
  
  pinMode(inswitch, INPUT);     // declare switch as input
Particle.variable("pirState", &pirState, INT);
    Particle.variable("val", &val, INT);
    
    
 
}
 
void loop(){
  val = digitalRead(inswitch);  // read input value
  if (vals == 1) {            // check if the input is HIGH
    
    
     Particle.publish("Door_state","Open");
     delay(12000);
  }   
     
   else if (val == 0) {
         
         Particle.publish("Door_state","closed");
     
   
      
     delay(12000);

  }
}

Window Sensor Code

C/C++
 int inswitc = D1;               // choose the input pin (for reed swtich)
 int pirStat = 0;             // we start with the door/window closed
 int vals = 0;                    // variable for reading the pin status
  
void setup() {
  
  pinMode(inswitc, INPUT);     // declare switch as input
Particle.variable("pirStat", &pirStat, INT);
    Particle.variable("vals", &vals, INT);
    
    
 
}
 
void loop(){
  vals = digitalRead(inswitc);  // read input value
  if (vals == 1) {            // check if the input is HIGH
    
    
     Particle.publish("Window_stat","Open");
     delay(12000);
  }   
     
   else if (vals == 0) {
         
         Particle.publish("Window_stat","closed");
     
   
      
     delay(12000);

  }
}

Buzzer Code

C/C++
void setup()
{                
    pinMode(D1, OUTPUT);  // buzzer on pin D1
    Particle.subscribe("Window_stat",myHandler);
     Particle.subscribe("Door_stat",myHandler);
}

void myHandler(const char *event, const char *data)
{
    if (strcmp(data,"Open")==0)
    {
        digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(200);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(200);digitalWrite(D1,HIGH);
        delay(200);digitalWrite(D1,LOW);delay(50);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(200);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);
        delay(400);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(100);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(2000);
        //series 2
        digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(200);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(200);digitalWrite(D1,HIGH);
        delay(200);digitalWrite(D1,LOW);delay(50);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(200);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);
        delay(400);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(100);digitalWrite(D1,HIGH);delay(200);digitalWrite(D1,LOW);delay(2000);
       
    }
    
    else
    {
    delay(100);
    }
}

Credits

Aidia Naim

Aidia Naim

1 project • 0 followers
Thomas Joyce

Thomas Joyce

1 project • 0 followers
Babiker Suliman

Babiker Suliman

1 project • 1 follower

Comments