Project showcase
Simple Security System

Simple Security System

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

  • 2,740 views
  • 1 comment
  • 4 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

  • 7,682 views
  • 1 comment
  • 19 respects

Arduino Based Security System

Project tutorial by Abishek Bhalaaji

  • 4,528 views
  • 5 comments
  • 18 respects

Ultrasonic Security System

Project tutorial by Ivan

  • 17,301 views
  • 18 comments
  • 50 respects

Alarm System Security Put to the Test

Project tutorial by danionescu

  • 12,764 views
  • 4 comments
  • 23 respects

Security System | SW-420 | Arduino | GSM

by AbuTaj

  • 5,237 views
  • 2 comments
  • 8 respects

Simple and Smart Air Purifier System

Project tutorial by Aaron Kow

  • 10,940 views
  • 4 comments
  • 36 respects
Add projectSign up / Login