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 hours1,918

## Things used in this project

### Hardware components

 Particle Photon
×3
 Buzzer
×1
 Proximity Sensor
×2
×3

### Software apps and online services

 IFTTT Maker service
 Atomiot

## Schematics

### 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 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(){
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 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(){
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

1 project • 0 followers

### Thomas Joyce

1 project • 0 followers

### Babiker Suliman

1 project • 1 follower