image1 image2 image3

HELLO I'M LiNuS|WELCOME TO MY PERSONAL BLOG|I LOVE TO DO CREATIVE THINGS|I PRESENT MY WORKS ON VLSI AND EMBEDDED

SECURITY SYSTEM

Accessing a Security locker through Password

     Why security       
Security is the degree of resistance to, or protection from  harm. It applies to any vulnerable and valuable asset, such as a person, dwelling, community, nation  or organization. Security provides "a form of protection where a separation is created between the assets and the threat." These separations are generically called "controls," and sometimes include changes to the asset or the threat. Home security is something applicable to all of us and involves the hardware in place on a property, and personal security practices. The hardware would be the doors, locks, alarm systems, lighting that is installed on your property. Personal security practices would be ensuring doors are locked, alarms activated, windows closed and many other routine tasks which act to prevent a burglary.
There are many reasons to get a  security system:
1. Your home insurance will drop:.
2.  To Stop Crime.
3. It’s Affordable.
4. Make Your Life Easier.
5. Keep Your Family Safe.
6. Know who’s Knocking.
7. Fire Protection.
8. Security Is Peace of Mind.

Intention of this Project 


 To develop a Security System controlled by a Password and also setting new password.

Tasks to taken to develop this project are:

1.  Gathering the tools required.

2.  Interfacing a LCD module,Bluetooth module,4*4 matrix Keypad to Arduino.

3.   Uses of each module.

4.   Developing the Circuit.

5.    Coding the Project.

6.  Explanation of coding part. 


1.  Gathering the tools required:

                    Arduino Mega 2560:



                     LCD Module:


                     Bluetooth Module(HC-05):


              4*4 Matrix Keypad:


               Two Relay's: (used is 8-relay board)


              Security Locker( Compatible DVD-ROM is used - which resembles the locker)







       
2.  Interfacing a LCD module,Bluetooth module,4*4 matrix Keypad to Arduino:   
       

                  Interfacing the LCD Module:



Steps to be taken here are:
  1. Connect the DB4 - DB7 Pins of LCD to digital Pins 4,5,6,7 of Board.
  2. Connect the RS and Enable Pins of LCD to digital Pins 2 and 3 of Board.
  3. Use a 10K POT to control the Contrast of display.
  4. Use a 1K Ohm Resistor to 9th Pin of LCD.
               
                      Interfacing Bluetooth Module:

  1. Connect the TXD Pin to digital pin 10 on board and RXD pin to digital pin 11 on board.
  2. Connect power supply and ground.



                    Interfacing 4*4 Matrix Keypad:



  1. Connect the Row Pins of Keypad to digital Pins 33,32,31,30 on the board.
  2. Connect the Column Pins of Keypad to digital Pins 53,52,51,50 on the board.
  3. Additionally Connect two LED's to digital Pins 22 and 23 on the board. 



3.   Uses of each module:

  1.  LCD Module Will display the Status of Security System at the Locker Position. It displays whether the Door is opened or Closed.
  2. Keypad is used for setting/entering the New Password. To secure the security system the setting of new pass word is done only through the Keypad near the security system. 
  3. Bluetooth Module is used for ensuring the compatibility and flexibility to the operation of Security System. With help of this Module simultaneously the Status of the Security system can also be seen through the serial monitoring device also.(Android device with BlueTerm + app or PC with Tera Term tool). 


4.   Developing the Circuit:

                                            



First, Interface the LCD module and Bluetooth Module to board





Second,Interface the Keypad to the Board




Third, Connecting the Relay Board

  1. In this, we used 8 - relay board, to which R8 and R7 relay's were used.
  2. R8 to be connected to Red terminal of Security door's DC Motor and R7 to its Black.
  3. NC's of R8 & R7 to -ve Terminal of Power Supply required to Run Motor and NO's of their's to +ve Terminal of Power Supply.
  4. Digital Pin 22 to be connected to Logic of Relay R8.
  5. Digital Pin 23 to be connected to Logic of Relay R7.
  6. Give the Power Supply for Switching the Relay's.






Lastly,
  1. Download Blue Term+ App and install on to your device if you Prefer for Android Device.
  2. Download Tera Term Tool and install on to your device if you Prefer for PC.
  3. USE ARDUINO software for Programming the board.


5. CODING THE PROJECT:

Code 1 :

       /* To Write Password on to EEPROM of Micro-controller (INITIAL STEP) */

#include <EEPROM.h>
int addr;
void setup(){

addr = 0;

     EEPROM.write(addr, '1');
     addr = addr + 1;
     EEPROM.write(addr,'2');
         addr = addr + 1;
     EEPROM.write(addr,'3');
         addr = addr + 1;
     EEPROM.write(addr,'4');
}
void loop()
{
}

CODE 2:

  // Main code     

 #include <Password.h>

#include <EEPROM.h>
#include <LiquidCrystal.h>
#include <Keypad.h>
#include <SoftwareSerial.h>

void servodco();
void servodcc();
void servostp();
void keypass1();
void keypass2();
void keypass3();
void keypass4();

String s="";
int addr;
char g[5];
byte h[5];
char data[5]="";

char key1, key2, key3, key4;
int pin1 = 22;
int pin2 = 23;

const byte ROWS = 4; //4 rows
const byte COLS = 4; //4 columns

LiquidCrystal linu(2, 3, 4, 5, 6, 7);
SoftwareSerial linus(10, 11);

Password password = Password("");
byte currentLength = 0;

char keys[ROWS][COLS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {33, 32, 31, 30}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {53, 52, 51, 50}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup()  {
  linus.begin(9600);
  linu.begin(16, 2);
  linus.println("Enter your password");
  linus.println("press ! to reset");
  pinMode(pin1, OUTPUT);
  pinMode(pin2, OUTPUT);  
  //keypad.addEventListener(keypadEvent);  // event listener
  //keypad.setHoldTime(250);               // Default  1000mSec
  // keypad.setDebounceTime(100);           // Default  50mSec
   
}
void loop() {
      /*  addr = 0;
     EEPROM.write(addr, '1');
     addr = addr + 1;
     EEPROM.write(addr,'2');
         addr = addr + 1;
     EEPROM.write(addr,'3');
         addr = addr + 1;
     EEPROM.write(addr,'4');*/

 // You can enable the above Block comment and Run once then Your Password will be stored //to "1234" on EEPROM.....LATER you can set New PassWord by using "1234".

   addr = 0;
  byte datasize = 4;
  /
  for(int i = 0;i<datasize;i++)
  {
   h[i] = EEPROM.read(addr); 
   addr++; 
}

data[3] = h[0];
data[2] = h[1];
data[1] = h[2];
data[0] = h[3];
//data[4] = '/0';
    password.set(data);
    //linus.print(data);
    // enable the above line and run once when you forget password
  if (linus.available()) {

    char input = linus.read();
    switch (input) {
      case '!':                                        //to reset password ' ! '
        password.reset();
        currentLength = 0;
        linus.println("\tPassword is reset!");
        break;
      case '?':                                    //evaluates password if correct/not correct ' ? '
        
        if (password.evaluate()) {
          linus.println("\tYou guessed the correct password!");
          linu.clear();
          linu.print("NOW THE DOOR OPENS");
          servodco();
        } else {
          linus.println("\tYou did not guess the correct password!");
          servostp();
        }
        break;
      case '#':
      password.reset();         // to close door ' # '
      
        linu.clear();
        linu.print("NOW THE DOOR CLOSES");
        servodcc();
        break;
      case '$':      // first,enter previous password and ' $ ' to set New Password through KEYPAD.
        linus.print("enter previous password");
        linu.print("enter previous password");
        if (password.evaluate())
        {
          linus.print("enter new password");
          linu.print("enter new password");
          keypass1();
          
        linu.print(key1);
          keypass2();
          linu.print(key2);
          keypass3();
          linu.print(key3);
          keypass4();
          linu.print(key4);
        
          
          password.set(g);
        
       addr = 0;
     EEPROM.write(addr, g[0]);
     addr = addr + 1;
     EEPROM.write(addr,g[1]);
         addr = addr + 1;
     EEPROM.write(addr,g[2]);
         addr = addr + 1;
     EEPROM.write(addr,g[3]);
     
        linus.print("password is set");
        
        }
        else
        {
          linus.print("password mismatches");
          linu.print("password mismatches");
        }
        
        break;
      default:

        //appends  key press to currently guessed password.
        password << input;
        currentLength++;

        //Print some feedback.
        linus.print("Enter password: ");
        for (byte i = 0; i < currentLength; i++) {
          linus.print('*');
        }
        linus.println();
    }
  }
  else
  {
    delay(100);
    linu.scrollDisplayLeft();
    servostp();
  }
}
void servodco()
{
  digitalWrite(pin1, HIGH);
  digitalWrite(pin2, LOW);
  delay(1000);
  return;
}
void servodcc()
{
  digitalWrite(pin1, LOW);
  digitalWrite(pin2, HIGH);
  delay(1000);
  return;
}

void servostp()
{
  digitalWrite(pin1, LOW);
  digitalWrite(pin2, LOW);
  delay(1000);
  return;
}
void keypass1()
{

  key1 = keypad.getKey();
  if (key1 == NO_KEY)
  {
    keypass1();
  }
  else
  {
    g[3] = key1;
  }
}
void keypass2()
{

  key2 = keypad.getKey();
  if (key2 == NO_KEY)
  {
    keypass2();
  }
  else
  {
    g[2] =  key2;
  }
}
void keypass3()
{

  key3 = keypad.getKey();
  if (key3 == NO_KEY)
  {
    keypass3();
  }
  else
  {
    g[1] =  key3;
  }
}
void keypass4()
{

  key4 = keypad.getKey();
  if (key4 == NO_KEY)
  {
    keypass4();
  }
  else
  {
    g[0] =  key4;
  }
}

/* Observations:
 ' ! ' - press to Reset the Password and to Re-type.
 ' ? '- press to Confirm the Password and to OK it.
 ' # '- press to close the device.
 ' $ '- first enter previous Password and press to Set New PassWord */


6. Explanation of CODING Part:

  1. Password.h library is included to get flexibility for using Password's.
  2. EEPROM.h library is included to STORE password on to Board when POWER IS TURNED OFF.
  3. Keypad.h is include to CONFIGURE AND MAP the 4*4 MATRIX KEYPAD to board.
  4. LiquidCrystal.h to configure the LCD display Unit.
  5. SoftwareSerial.h is included to ESTABLISH SERIAL Communication.





WORKING/IMPLEMENTATION  

1. Switch on Bluetooth in the device.
2.Go to Blue Term+ app, connect to HC-05 module.
3.You can Now access the System with help of this:



 ' ! ' - press to Reset the Password and to Re-type.

 ' ? '- press to Confirm the Password and to OK it.
 ' # '- press to close the device.
 ' $ '- first enter previous Password and press to Set New PassWord


4. Look this VIDEO, you can have good idea on this Project.
                             






-------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------




Share this:

CONVERSATION

2 comments:

  1. This article is informative and quiet helpful. Security system is important thing for every home and business. You can monitor your employees and customer 24/7 every minutes from anywhere on your smartphone. I recommend you to choose secure and reliable wireless burglar alarm system to protect your home and family from burglaries. It suitable on your budget.

    ReplyDelete
  2. Find Security Control Alarm Equipment Dealers Traders In Dubai that offer a wide range of products, including monitored home alarm systems, wired alarms, and electric current alarm systems, among so many other things.

    ReplyDelete