Project showcase
Simple Security System

Simple Security System

This is very basic door security system which is using an eletromagnetic lock

  • 4,109 views
  • 1 comment
  • 6 respects

Components and supplies

Apps and online services

About this project

This project has been done to secure a residential building. This building has an external door which is operated from each appartment and an internal door which will be opened only once the external door is closed. If external door remains open for a certain time, there will be an alarm to close the door.

Code

Access ControllerC/C++
This code activates a timer to make sure the external door is closed. Alarm is activated after timer expiry
#include <EEPROM.h>

int door1, door2, timer_cnt, chk;
boolean lock=true, alarm=false;

void setup() {
  pinMode(2,OUTPUT); //lock
  pinMode(4,OUTPUT); //alarm
  pinMode(12,INPUT); //proximity-1
  pinMode(13,INPUT); //proximity-2
  
  digitalWrite(2,HIGH);
  digitalWrite(4,LOW);
}

void loop() {
  door1=digitalRead(12);
  door2=digitalRead(13);
  if (door1 && door2){ //both doors closed
    digitalWrite(2,HIGH); //lock is activated
    timer_cnt=0;
  }
  else{ //one of doors is open
    digitalWrite(2,LOW); //lock is deactivated
    lock=false;
  }
  if (!lock){ //door is open
    timer_cnt=EEPROM.read(0);
    timer_cnt=timer_cnt+1;
    EEPROM.write(0, timer_cnt);
    chk=EEPROM.read(0);
    if (chk>=254 || alarm){ //timer is up
      digitalWrite(4,HIGH); //turn on alarm
      alarm=true;
    }
    else{
      digitalWrite(4,LOW); //turn off alarm
      alarm=false;
    }
  }
  else {
    timer_cnt=0;
    EEPROM.write(0, timer_cnt);
    lock=true;
  }
}

Schematics

Main Circuit
j1 and J2 are proximity sensors installed at external door
Schematic v2 schem en8cjdh19m

Comments

Similar projects you might like

Security System And Access Control With Arduino And RFID

Project tutorial by Sarath P

  • 11,101 views
  • 1 comment
  • 24 respects

Arduino Based Security System

Project tutorial by Abishek Bhalaaji

  • 8,889 views
  • 9 comments
  • 22 respects

Ultrasonic Security System

Project tutorial by Ivan

  • 42,420 views
  • 33 comments
  • 98 respects

Alarm System Security Put to the Test

Project tutorial by danionescu

  • 15,628 views
  • 5 comments
  • 26 respects

Security System | SW-420 | Arduino | GSM

by AbuTaj

  • 6,890 views
  • 3 comments
  • 9 respects

Arduino RFID Simulating Simple Access Control System

Project tutorial by KABAKA

  • 3,422 views
  • 0 comments
  • 7 respects
Add projectSign up / Login