Secured Locking System

Secured Locking System

1024 576 Athul Sanker

Secured Locking System using L2S board is a simple project where a secure password will act as a door unlocking system. Traditional lock systems using mechanical lock and key mechanism are being replaced by new advanced techniques of locking system. These techniques are an integration of mechanical and electronic devices and are highly intelligent. One of the prominent features of these innovative lock systems is their simplicity and high efficiency. Such an automatic lock system consists of electronic control assembly, which controls the output load through a password. This output load can be a motor or a lamp or any other mechanical/electrical load.

This system demonstrates a Secured Door Locking System using L2S board, wherein once the correct code or password is entered, the  servo motor rotates 90° (indicating door is opened) If the password is wrong, then door would remain closed, and raises an alarm. .

Additional Components Used:

  1. Itty Bitty --- 1 no.
  2. USB B Type Cable --- 1 no.
  3. 5v Regulator Breakout  --- 1 no.
  4. Power Adapter --- 1 no.
  5. Red 8” Male-Male Jumper Wire --- 1 no.
  6. Black 8” Male-Male Jumper Wire --- 1 no
  7. 4*4 Smart keypad --- 1 no.
  8. Servo motor) --- 1 no.
  9. 4-4 B interface cable --- 1 no.
  10. Jumper wires --- 3 no.

 

Procedure:

  1. Upload the code to the ATmega328p  IC, as mentioned earlier using the itty bitty
  2. Mount the  ATmega328p  IC on Learn to Solder board
  3. Connect the Jumper wires to one end of the  power regulator breakout, Ensure Red wire is connected to the ‘+’ & Black to  ‘-’.
  4. Similarly connect the other end to the wires to the power port on Learn to Solder board.
  5. Connect the keypad to the serial port of the L2S board using the 4-4 B interface cable .
  6. Connect the servo motor to the I2C port of the L2S board using the jumper wires .
  7. Connect the DC barrel pin of the power adapter to regulator board & Power On the Adapter
  8. The board will start functioning.

 

Code:

#include <Servo.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
Adafruit_PCD8544 display= Adafruit_PCD8544(8,9,10,12,11);
#define number_of_74hc595s 3
#define numOfRegisterPins number_of_74hc595s*8
boolean registers[numOfRegisterPins];
int SER_Pin=A1;
int RCLK_Pin=6;
int SRCLK_Pin = 5;
char password[6]={'\0','\0','\0','\0','\0','\0'};
int i=0;
int count=0;
int check=0;
int times=0;
char rpassword[6]={'1','2','3','4','5','6'};
Servo servo_Motor; 
const byte thief[] PROGMEM = {88,48,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00001111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00001111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00111100,B00111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B01111111,B11111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000011,B11111110,B11111111,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000011,B11111100,B11111110,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111111,B11111111,B10111111,B11111111,B11000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111111,B11111111,B10111111,B11111111,B11100000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111111,B11111111,B10111111,B11111111,B11111000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B01111111,B11111111,B10111111,B11111111,B11111100,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00111101,B11111111,B10111111,B11111111,B11111110,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000001,B11111111,B10111111,B11111111,B11111111,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000001,B11111111,B10111111,B11111111,B11111111,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000001,B11111111,B10111111,B11111111,B11111111,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000001,B11111111,B10111111,B11111111,B11111111,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000001,B11111111,B11011111,B11111111,B11111110,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000001,B11111111,B11011111,B11111111,B11111110,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000011,B11111111,B11001111,B11111111,B11111000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000111,B11111111,B10000011,B11111111,B11000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00001111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00011111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B01111111,B11011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111111,B10011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111111,B00001111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111110,B00000111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111111,B00000011,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111111,B00000001,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111111,B00000000,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B01111111,B00000000,B00111111,B11111100,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B01111111,B00000000,B00001111,B11111110,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B01111111,B00000000,B00000011,B11111100,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B01111111,B00000000,B00000000,B11111000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B01111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B01111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
};
const byte face[] PROGMEM = {88,48,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00001111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000001,B11100000,B00000000,B00111110,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00011110,B00000000,B00000000,B00000001,B11000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B01100000,B00000000,B00000000,B00000000,B00111000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000001,B10000000,B00000000,B00000000,B00000000,B00000110,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000001,B10000000,B00000000,B00000000,B00000000,
B00000000,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
B00000000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00000000,B00000000,B00000000,
B00000000,B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,B00000000,
B00000001,B10000000,B00000000,B00100000,B00000000,B00100000,B00000000,B00000100,B00000000,B00000000,B00000000,
B00000011,B00000000,B00000000,B11110000,B00000000,B11111000,B00000000,B00000010,B00000000,B00000000,B00000000,
B00000110,B00000000,B00000000,B11111000,B00000000,B11111000,B00000000,B00000001,B00000000,B00000000,B00000000,
B00000100,B00000000,B00000001,B11111000,B00000001,B11111100,B00000000,B00000000,B10000000,B00000000,B00000000,
B00001000,B00000000,B00000001,B11111000,B00000001,B11111100,B00000000,B00000000,B11000000,B00000000,B00000000,
B00010000,B00000000,B00000001,B11111000,B00000001,B11111100,B00000000,B00000000,B01000000,B00000000,B00000000,
B00010000,B00000000,B00000000,B11111000,B00000000,B11111000,B00000000,B00000000,B00100000,B00000000,B00000000,
B00100000,B00000000,B00000000,B11110000,B00000000,B11111000,B00000000,B00000000,B00100000,B00000000,B00000000,
B00100000,B00000000,B00000000,B00100000,B00000000,B00100000,B00000000,B00000000,B00010000,B00000000,B00000000,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B00000000,B00000000,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B00000000,B00000000,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B00000000,B00000000,
B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B00000000,B00000000,
B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00000000,B00000000,
B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,
B00010000,B00000000,B10000000,B00000000,B00000000,B00000000,B00001100,B00000000,B01100000,B00000000,B00000000,
B00011000,B00000001,B11000000,B00000000,B00000000,B00000000,B00001110,B00000000,B01000000,B00000000,B00000000,
B00001000,B00000001,B11000000,B00000000,B00000000,B00000000,B00001100,B00000000,B10000000,B00000000,B00000000,
B00000100,B00000000,B01100000,B00000000,B00000000,B00000000,B00011000,B00000001,B10000000,B00000000,B00000000,
B00000010,B00000000,B00110000,B00000000,B00000000,B00000000,B00110000,B00000011,B00000000,B00000000,B00000000,
B00000001,B00000000,B00011100,B00000000,B00000000,B00000000,B11000000,B00000110,B00000000,B00000000,B00000000,
B00000000,B10000000,B00000111,B00000000,B00000000,B00000011,B10000000,B00001100,B00000000,B00000000,B00000000,
B00000000,B01100000,B00000001,B11000000,B00000000,B00011110,B00000000,B00010000,B00000000,B00000000,B00000000,
B00000000,B00110000,B00000000,B00111111,B00000011,B11110000,B00000000,B00100000,B00000000,B00000000,B00000000,
B00000000,B00001100,B00000000,B00000011,B11111110,B00000000,B00000000,B11000000,B00000000,B00000000,B00000000,
B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000001,B11000000,B00000000,B00000000,B00000000,B00001100,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00110000,B00000000,B00000000,B00000000,B01110000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000111,B00000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B11111100,B00000001,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
};
const byte logo_el[] PROGMEM = {16,10,
B00000000,B00000000,
B11111010,B00000000,
B11111010,B00000000,
B00000010,B00000000,
B11111010,B00000000,
B11111010,B00000000,
B00000010,B00000000,
B11111011,B11000000,
B11111011,B11000000,
B00000000,B00000000,
};
//*****void setup*****//
void setup() {
  servo_Motor.attach(A4); 
  Serial.begin(9600);
  pinMode(SER_Pin,OUTPUT);
  pinMode(RCLK_Pin,OUTPUT);
  pinMode(SRCLK_Pin,OUTPUT);
  pinMode(2,OUTPUT);
  servo_Motor.write(90);
  clearRegisters();
  writeRegisters();
  display.begin();
  display.setContrast(50);
  display.clearDisplay();
  display_El_logo();
  display_L2S();
  display_title();
  display.drawBitmap(70,35,logo_el,10,10,BLACK);
}
//*****void loop*****//
void loop() 
   display.drawRect(0, 0, 84 , 48,BLACK);
   display.setCursor(4,8);
   display.println(" ENTER THE ");
   display.setCursor(4,18);
   display.println(" PASSWORD ");
   display.setTextSize(1);
   display.setTextColor(BLACK);
   display.display(); 
 while(Serial.available())
 {   
    password[i]=Serial.read();
    if(i==0)
    {
        display.setCursor(10,30);
        display.print("*");
        display.display(); 
    }
    if(i==1)
    {
        display.setCursor(20,30);
        display.print("*");
        display.display(); 
    }
    if(i==2)
    {
        display.setCursor(30,30);
        display.print("*");
        display.display(); 
    }
    if(i==3)
    {
        display.setCursor(40,30);
        display.print("*");
        display.display(); 
    }
    if(i==4)
    {
        display.setCursor(50,30);
        display.print("*");
        display.display(); 
    }
    if(i==5)
    {
        display.setCursor(60,30);
        display.print("*");
        display.display(); 
    }
     i++;
     if(i==6)
     {
      check=1;
     }
  
 }
 for(int j=0;j<7;j++)
 {
  if(rpassword[j]==password[j])
  {
    count++;    
  }
 }
 if(check==1)
 {
 if(count>=6)
 {  display.clearDisplay();
    display.drawRect(0, 0, 84 , 48,BLACK);
    digitalWrite(2,LOW);
    display.drawBitmap(-7,0,face,84,48,BLACK);
    display.setCursor(12,22);
    display.println(" WELCOME");
    display.display();
    display.clearDisplay();
    servo_Motor.write(180);
    delay(10000);
    servo_Motor.write(90);
    count=0;
    i=0;
    check=0;
 }
 else
 {
    display.clearDisplay();
    display.drawRect(0, 0, 84 , 48,BLACK);
    display.drawBitmap(4,0,thief,84,48,BLACK);
    display.setCursor(1,20);
    display.println("INTRUDER");
    display.display();
    while(times<10)
 {
    digitalWrite(2,HIGH);
    delay(300);
    digitalWrite(2,LOW);
    delay(300);
    times++;
 }
    display.clearDisplay();
    count=0;
    i=0;
    check=0;
    times=0;
 }
 }
 count=0;
}

//*****Elintlabz logo*****//
void display_El_logo()
{
   display.fillRect(15,2,21,6,BLACK);
   display.fillRect(15,12,21,6,BLACK);
   display.fillRect(15,22,21,6,BLACK);
   display.fillRect(45,2,6,26,BLACK);
   display.fillRect(50,22,18,6,BLACK);
   display.setCursor(15,35);
   display.print("ElintLabz");
   display.display();
   delay(5000);
   display.clearDisplay();
}

//*****learn2solder*****//
void display_L2S()
{
  display.drawRect(0, 0, 84 , 48,BLACK);
  display.setCursor(26, 10);
  display.println("LEARN");
  display.setCursor(38,20);
  display.println("2");
  display.setCursor(22,30);
  display.println("SOLDER");
  display.display(); 
  delay(5000);
  display.clearDisplay();
}
//*****clearing registers*****//
 void clearRegisters(){
  for(int i = numOfRegisterPins - 1; i >=  0; i--){
     registers[i] = LOW;
  }
  writeRegisters();
} 
//*****writting registers*****// 
void writeRegisters(){

  digitalWrite(RCLK_Pin, LOW);
  for(int i = numOfRegisterPins - 1; i >=  0; i--){
    digitalWrite(SRCLK_Pin, LOW);
    int val = registers[i];
    digitalWrite(SER_Pin, val);
    digitalWrite(SRCLK_Pin, HIGH);
  }
  digitalWrite(RCLK_Pin, HIGH);
}
//*****To Display Tittle*****//
void display_title()
{
  display.drawRect(0, 0, 84 , 48,BLACK);
  display.setCursor(16,12);
  display.println("SECURED");
  display.setCursor(13,22);
  display.println("LOCKING");
  display.setCursor(20,32);
  display.println("SYSTEM");
  display.drawBitmap(70,35,logo_el,10,10,BLACK);
  display.display(); 
  delay(5000);
  display.clearDisplay();
}

Usage Instructions:

  • If the entered password is correct  the screen displays with welcome message and the servo motor rotates  90°indicating that door is opened..
  • If the entered password is wrong the screen displays as intruder and the servo motor does not rotate indicating that door remains closed.

Leave a Reply