DOC B.1 Security 2

download DOC B.1 Security 2

of 52

Transcript of DOC B.1 Security 2

  • 7/29/2019 DOC B.1 Security 2

    1/52

    GOKARAJU RANGARAJU INSTITUTE OF

    ENGINEERING AND TECHNOLOGY

    Hyderabad, Andhra Pradesh.

    DEPARTMENT OF ELECTRICAL & ELECTRONICS

    ENGINEERING

    [1]

  • 7/29/2019 DOC B.1 Security 2

    2/52

    DIGITAL SECURITY CODE LOCK USING

    8051 MICROCONTROLLER

    By :

    ANIL . R (07241A0258)

    ANUDEEP REDDY.R (07241A0259)

    BHANU CHANDER.V (07241A0262)

    SAATWIK.G (07241A0295)

    SAI KISHORE .P (07241A0296)

    [2]

  • 7/29/2019 DOC B.1 Security 2

    3/52

    CONTENTS

    TOPIC PAGE NO.

    Abstract 04

    1. Introduction 05

    2. Block Diagram & Description 10

    3. Hardware Design 13

    4. Software Design 29

    5. Testing and Results 32

    6. Source code 34

    7. Applications ,Advantages 48

    & Disadvantages

    8. References 52

    [3]

  • 7/29/2019 DOC B.1 Security 2

    4/52

    ABSTRACT :

    The microcontroller based digital lock is an access control system that allows only

    authorized persons to access any restricted division. The major components include

    a keypad, LCD,EEPROM and the micro controller AT89C51 which belongs to the

    8051 series of micro controllers . The system is fully controlled by the 8 bit

    microcontroller AT89C51 which has a 2Kbytes of ROM for the program memory.

    The electronic control assembly allows the system to unlock the device with a

    password.A four digit predefined password needs to be specified the user. A 4x3

    matrix KEYPAD and a 16x2 LCD have been used here to set the password which

    is stored in the EPROM so that we can change it at any time. While unlocking, if

    the entered password from keypad matches with the stored password, then the lock

    opens and a message is displayed on LCD. Also an output pin is made high to be

    used for further purpose. As the program starts, string Enter Password is

    displayed on LCD. The keypad is scanned for pressed digits one by one. Every

    time, row and column of the key pressed is detected and the digit is displayed on

    LCD. If all the four digits match with set password, LCD displays password is

    correct and the lock output pin goes high and the led glows. If the security code

    is wrong, Wrong Password is sent to be displayed on LCD and the buzzer rings

    which is connected to the microcontroller. It has wide applications in the present

    world. It is mainly used for door alarms, equipment privacy locks, cell phones,

    computers and in many lock systems.

    [4]

  • 7/29/2019 DOC B.1 Security 2

    5/52

    Chapter 1: INTRODUCTION

    1.1 Objective

    1.2 What is Digital security code lock?

    1.3 Need for Digital security code lock

    [5]

    1.4 Introduction

  • 7/29/2019 DOC B.1 Security 2

    6/52

    1.1 Objective :

    Security is a prime concern in our day-today life. Everyone wants to be as

    much secure as possible. An access control for doors forms a vital link in a security chain

    . The microcontroller based digital lock for Doors is an access control system that allows

    only authorized persons to access a restricted area. The system is fully controlled by the 8

    bit microcontroller AT89C51 which has a 4Kbytes of ROM for the program memory. The

    password is stored in the EPROM so that we can change it at any time. The system has a

    keypad by which the password can be entered through it. When the entered password equals

    with the password stored in the memory then the relay gets on and so that the door is

    opened. If we entered a wrong password for more than three times then the Alarm is

    switched on.

    [6]

  • 7/29/2019 DOC B.1 Security 2

    7/52

    1.2

    What is Digital security code lock?

    'Digital Security' gives individuals the freedom to embrace the

    digital lifestyle confidently engage in everyday interactions across all digital devices.

    According to Olivier Piou, CEO of global digital security company Gemalto, digital

    security hasa key role to play in the digital revolution. Yet fear of fraud, identity theft,

    and other concerns are holding people back from making the most of (what the digital

    revolution has to offer). They need to feel that the wealth of devices and services

    available are both convenient to use and trustworthy."Digital security affects all

    aspects of the digital lifestyle, which, among others, comprises computers and the

    internet, telecommunications, financial transactions, transportation, healthcare and

    secure access.

    New approaches offer the best of both worlds by combining network DVR capabilities

    with intelligent access control and alarm monitoring panel functionality into a

    single IP solution. Systems now combine digital video Monitoring/recording,

    access control and intrusion detection functionality in a single panel solution. With

    these integrated digital video recording and access control platforms, security officers

    can display live and stored video associated with alarm conditions and cardholder

    activity

    When considering the security measures that are typically installed within homes and

    properties, they often are systems that are not effective and not of much use. With the

    number of contemptible acts like robberies, ransacking and vandalism, the absence of

    competent security solutions is an open invitation to trouble. Digital cameras are

    extremely useful devices that ensure the safety of your property when you are away at

    work on or vacation. With technological advancements you can now implement

    strong measures to keep trouble makers away

    [7]

  • 7/29/2019 DOC B.1 Security 2

    8/52

    [8]

    1.3Need for Digital security code lock

    We have seen the security personnel checking the employees identification cards

    at the entrances to avoid illegal entry. The employees sign a register at the entrance before

    getting in. This is still being practiced in most of the companies.

    However, the disadvantages are that, when there is a necessity of providing

    control at many locations inside the company, a person at each point will not be an

    economical way of implementing it.

    Then came were the punch cards. Employees possess cards, which are punched

    when they enter into the building. But it had disadvantages. Workers started to practice

    buddy punching, for their co-workers.

    Concerns about buddy punching-the practice where employees fraudulently clock

    their co-workers in or out to give them credit for time that wasn't actually worked-led

    Continental Airlines to implement a fingerprint ID system to augment their automated

    employee time and attendance recording system. The company expanded the system from

    Control Module after it saved an estimated $100,000 in the first year. This led to the bar

    code readers.

    It is a much common sight to see a bar code reader in the companies. These are

    used to check with the employees identification. The employees swipe the card in the

    provided slot. Then the access is given after checking the authenticity of the card. This

    was a substitute to the security and emerged as a new technique in access control. This

    acted as a starting to the automation of the access control

  • 7/29/2019 DOC B.1 Security 2

    9/52

    1.4 IntroductionThe concept of access control is brought about using a card, a corresponding

    card reader and a control panel interfaced with the server. The card is a proximity card

    with a unique identification number integrated in it. The reader reads the data and sends

    it to the control panel, which is the micro controller. This controller checks the validity

    of the data with the server, which bears the database. The server is loaded with the

    details about the employee for that number.

    The control panel checks whether he/she is allowed to enter the particular dooror not. If the employee is authentic, then he/she is allowed access in the particular

    entrance.

    The employees can be permitted in a given entrance as per his/her designation.

    The access control is employed at this point.

    In our project, the microcontroller is used to gain access through the door. The

    controller used is AT89C51.

    [9]

  • 7/29/2019 DOC B.1 Security 2

    10/52

    Chapter 2: Block Diagram & Description

    2.1 Block Diagram

    2.2 Description of Block Diagram

    [10]

  • 7/29/2019 DOC B.1 Security 2

    11/52

    2.1 Block Diagram

    [11]

    XTAL218

    XTAL119

    ALE30

    EA31

    PSEN29

    RST9

    P0.0/AD039

    P0.1/AD138

    P0.2/AD237

    P0.3/AD336

    P0.4/AD435

    P0.5/AD534

    P0.6/AD633

    P0.7/AD732

    P1.01

    P1.12

    P1.23

    P1.34

    P1.45

    P1.56

    P1.67

    P1.78

    P3.0/RXD10

    P3.1/TXD11

    P3.2/INT012

    P3.3/INT113

    P3.4/T014

    P3.7/RD17P3.6/WR16

    P3.5/T115

    P2.7/A1528

    P2.0/A821

    P2.1/A922

    P2.2/A1023

    P2.3/A1124

    P2.4/A1225

    P2.5/A1326

    P2.6/A1427

    U1

    AT89C51

    D7

    14

    D6

    13

    D5

    12

    D4

    11

    D3

    10

    D2

    9

    D1

    8

    D0

    7

    E

    6

    RW

    5

    RS

    4

    VSS

    1

    VDD

    2

    VEE

    3

    LCD1LM016L default password is " 1234".

    1 2 3

    4 5 6

    7 8 9

    0 #

    1 2 3

    A

    B

    C

    D

    * = Backspace

    # = Enter

    SCK6

    SDA5

    WP7

    A01

    A12

    A23

    U2

    24C32A

    D1LED-BLUE

    LS1

    SOUNDER

    C1

    33p

    D1(A)

    X1CRYSTAL

    C2

    33p

  • 7/29/2019 DOC B.1 Security 2

    12/52

    2.2 Description of Block Diagram

    Consider a case of one research institute where there are three kinds of

    employs. One is clerk and peon. Second one is junior scientists and the last one is

    senior scientists.

    Entry to company main door should be allowed to every person. General

    research work space is only for junior scientists and senior scientists and finally only

    senior scientists can access high profile research work space.

    .

    Controller receives this id then compares availability and priority of this id, if

    they are matched it allow the access to the user.

    [12]

    If all information is matched then Access Granted message is displayed to

    LCD otherwise Invalid Pssword.

  • 7/29/2019 DOC B.1 Security 2

    13/52

    Chapter 3: Hardware Design

    3.1 Microcontroller AT89C51

    3.2 LCD Display

    3.3 Relay Interface

    3.4 Buzzer

    3.5 EEPROM

    3.6 Power Supply

    [13]

  • 7/29/2019 DOC B.1 Security 2

    14/52

    Microcontroller

    Definition :

    An embedded microcontroller is chip which has a computer processor with all its

    support functions (clock & reset), memory (both program and data), and I/O(including bus

    interface) built in to the device. These built in function minimize the need for external circuits

    and devices to be designed in the final application.

    Types of Microcontroller

    Creating application for microcontrollers is completely different than any other

    development job in computing and electronics. In most other application one probably have a

    number of subsystems and interface already available for his/her use. This is not the case with

    a microcontroller where one is responsible for-

    Power distribution

    System clocking

    Interface design and wiring

    System programming

    Application programming

    Device programming

    [14]

    Before selecting a particular device for an application, its important to understand what

    the different option and features are and what they can mean with regard to developing

    application.

  • 7/29/2019 DOC B.1 Security 2

    15/52

    Embedded Microcontroller

    When all the hardware required to run the application is provided on the chip,

    it is refer to as an embedded microcontroller. All that is typically required to operate

    the device is power, reset, and a clock. Digital I/O pins are provided to allow

    interfacing with external devices.

    External Memory Microcontroller

    Sometimes, the program memory is insufficient for an application or , during

    debug; a separate ROM(or even RAM) would make the work easier. Some

    microcontrollers including the 8051 allow the connection of external memory.

    An external memory microcontroller seems to primarily differ from a

    microprocessor in the areas of built in peripheral features. These features could

    include memory device selection (avoiding the need for external address decoders or

    DRAM address multiplexers), timers, interrupt controllers, DMA, and I/O devices

    like serial ports.

    [15]

  • 7/29/2019 DOC B.1 Security 2

    16/52

    Features of AT89C51

    Compatible with MCS-51 Products

    4K Bytes of In-System Reprogrammable Flash Memory

    Endurance: 1,000 Write/Erase Cycles

    Fully Static Operation: 0 Hz to 24 MHz

    Three-level Program Memory Lock

    128 x 8-bit Internal RAM

    32 Programmable I/O Lines

    Two 16-bit Timer/Counters

    Six Interrupt Sources Programmable Serial Channel

    Low-power Idle and Power-down Modes

    Description

    The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with

    4K

    bytes of Flash programmable and erasable read only memory (PEROM). The device

    is manufactured using Atmels high-density non-volatile memory technology and is

    compatible with the industry-standard MCS-51 instruction set and pin out. The on-

    chip flash allows the program memory to be reprogrammed in-system or by a

    conventional non-volatile memory programmer. By combining a versatile 8-bit CPU

    with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer

    which provides a highly-flexible and cost-effective solution to many embeddedcontrol applications

    [16]

  • 7/29/2019 DOC B.1 Security 2

    17/52

    PIN DIAGRAM OF 8051

    BLOCK DIAGRAM

    [17]

  • 7/29/2019 DOC B.1 Security 2

    18/52

    3.2 LCD Display Interface

    The dot-matrix liquid crystal display controller and driver LSI displays

    alphanumeric, characters, and symbols. It can be configured to drive a dot-matrix

    liquid crystal display under the control of a 4 or 8-bit microprocessor. Since all the

    functions such as display RAM, character generator, and liquid crystal driver,

    required for driving a dot-matrix liquid crystal display are internally provided on one

    chip, a minimal system can be interfaced with this controller/driver. A single

    HD44780U can display up to two 8-character lines (16 x 2).

    A 16 x 2 line LCD module to display user information. Micro controller sendthe data signals through pin 11 through 18(RC0-RC3) and control signal through 4,6

    and 7 of the micro controller. Pin no 3 of the LCD is used to control the contrast by

    using preset PR1.

    [18]

  • 7/29/2019 DOC B.1 Security 2

    19/52

    3.3 Relay Interface

    A single pole dabble throw (SPDT) relay is connected to port RB1 of the

    microcontroller through a driver transistor. The relay requires 12 volts at a current of

    around 100ma, which cannot provide by the microcontroller. So the driver transistor

    is added. The relay is used to operate the external solenoid forming part of a locking

    device or for operating any other electrical devices. Normally the relay remains off.

    As soon as pin of the microcontroller goes high, the relay operates. When the relay

    operates and releases. Diode D2 is the standard diode on a mechanical relay to

    prevent back EMF from damaging Q3 when the relay releases. LED L2 indicates

    relay on.

    [19]

  • 7/29/2019 DOC B.1 Security 2

    20/52

    3.4 Buzzer

    A buzzer connected to port RB0 of the micro controller through a driver

    transistor. The buzzer requires 12 volts at a current of around 50ma, which cannot

    provided by the micro controller. So the driver transistor is added. The buzzer is

    used to audible indication for valid user and error situation and alarm mode. As soon

    as pin of the micro controller goes high, the buzzer operates.

    [20]

  • 7/29/2019 DOC B.1 Security 2

    21/52

    3.5 EEPROM :

    EEPROM (also written E2PROM and pronounced "e-e-prom," "double-e prom" or simply

    "e-squared") stands forElectrically Erasable ProgrammableRead-Only Memory and is a type

    ofnon-volatile memory used in computers and other electronic devices to store small

    amounts of data that must be saved when power is removed, e.g., calibration tables or device

    configuration.

    When larger amounts of static data are to be stored (such as in USB flash drives) a specific

    type of EEPROM such as flash memory is more economical than traditional EEPROM

    devices. EEPROMs are realized as arrays offloating-gate transistors.

    EEPROM is user-modifiable read-only memory (ROM) that can be erased and

    reprogrammed (written to) repeatedly through the application of higher than normal electrical

    voltage generated externally or internally in the case of modern EEPROMs. EPROM usually

    must be removed from the device for erasing and programming, whereas EEPROMs can be

    programmed and erased in circuit. Originally, EEPROMs were limited to single byte

    operations which made them slower, but modern EEPROMs allow multi-byte page

    operations. It also has a limited life - that is, the number of times it could be reprogrammed

    was limited to tens or hundreds of thousands of times. That limitation has been extended to a

    million write operations in modern EEPROMs. In an EEPROM that is frequently

    reprogrammed while the computer is in use, the life of the EEPROM can be an important

    design consideration. It is for this reason that EEPROMs were used for configuration

    information, rather than random access memory.

    Here, we are using AT 24C32A EEPROM because of that design configuration.

    [21]

    http://en.wikipedia.org/wiki/Non-volatile_memoryhttp://en.wikipedia.org/wiki/USB_flash_drivehttp://en.wikipedia.org/wiki/Flash_memoryhttp://en.wikipedia.org/wiki/Floating-gate_transistorhttp://en.wikipedia.org/wiki/Floating-gate_transistorhttp://en.wikipedia.org/wiki/Flash_memoryhttp://en.wikipedia.org/wiki/USB_flash_drivehttp://en.wikipedia.org/wiki/Non-volatile_memory
  • 7/29/2019 DOC B.1 Security 2

    22/52

    FEATURES :

    Voltage operating range: 4.5V to 5.5V

    - Maximum write current 3 mA at 5.5V

    - Standby current 1 A typical at 5.0V

    2-wire serial interface bus, I2C- compatible

    100 kHz and 400 kHz compatibility

    Self-timed ERASE and WRITE cycles

    Power on/off data protection circuitry

    Hardware write protect

    1,000,000 Erase/Write cycles guaranteed

    32-byte page or byte write modes available

    Schmitt trigger filtered inputs for noise suppression

    Output slope control to eliminate ground bounce

    2 ms typical write cycle time, byte or page

    Up to eight devices may be connected to the

    same bus for up to 256K bits total memory

    Electrostatic discharge protection > 4000V

    Data retention > 200 years

    8-pin PDIP and SOIC packages

    Temperature ranges

    DESCRIPTION :

    [22]

    The Microchip Technology Inc. 24C32A is a 4K x 8(32K bit) Serial Electrically Erasable

    PROM. It has been developed for advanced, low power applications such as personal

    communications or data acquisition. The 24C32A also has a page-write capability of up to 32

    bytes of data. The 24C32A is capable of both random and sequential reads up to the 32K

    boundary. Functional address lines allow up to eight 24C32A devices on the same bus, for up

    to 256K bits address space. Advanced CMOS technology and broad voltagerange make thisdevice ideal for low-power/low-voltage, nonvolatile code and data applications. The2 4C32A

    is available in the standard 8-pin plastic DIPand both 150 mil and 200 mil SOIC packaging.

  • 7/29/2019 DOC B.1 Security 2

    23/52

    - Commercial (C): 0C to 70C

    - Industrial (I): -40C to +85C

    - Automotive (E): -40C to +125C

    PACKAGE TYPES :

    PDIP :

    SOIC :

    [23]

  • 7/29/2019 DOC B.1 Security 2

    24/52

    BLOCK DIAGRAM :

    PIN DESCRIPTIONS :

    A0, A1, A2 Chip Address Inputs : The A0..A2 inputs are used by the 24C32A for multiple

    device operation and conform to the 2-wire bus standard. The levels applied to these pins

    define theaddress block occupied by the device in the addressmap. A particular device is

    selected by transmitting thecorresponding bits (A2, A1, A0) in the control byte

    [24]

    SDA Serial Address/Data Input/Output : This is a Bi-directional pin used to transfer

    addressesand data into and data out of the device. It is an opendrain terminal, therefore the

    SDA bus requires a pullupresistor to VCC (typical 10K for 100 kHz, 2 K for400 kHz)

    For normal data transfer SDA is allowed to change onlyduring SCL low. Changes duringSCL HIGH arereserved for indicating the START and STOP conditions.

  • 7/29/2019 DOC B.1 Security 2

    25/52

    SCL Serial Clock : This input is used to synchronize the data transfer fromand to the

    device.

    WP : This pin must be connected to either VSS or VCC. If tied to VSS, normal memory

    operation is enabled (read/write the entire memory 000-FFF). If tied to VCC, WRITE

    operations are inhibited. The entire memory will be write-protected. Read operations are not

    affected.

    READ OPERATION :Read operations are initiated in the same way as writeoperations

    with the exception that the R/W bit of theslave address is set to one. There are three basic

    typesof read operations: current address read, random read,and sequential read.

    Current Address Read : The 24C32A contains an address counter that maintains the

    address of the last word accessed, internallyincremented by one. Therefore, if the previous

    access (either a read or write operation) was to address n (n isany legal address), the next

    current address read operation would access data from address n + 1. Uponreceipt of the slave

    address with R/W bit set to one, the24C32A issues an acknowledge and transmits theeight

    bit data word. The master will not acknowledgethe transfer but does generate a stop

    condition and the24C32A discontinues transmission.

    Random Read : Random read operations allow the master to accessany memory location in

    a random manner. To performthis type of read operation, first the word address must be set.

    This is done by sending the word address to the24C32A as part of a write operation (R/W bitset tozero). After the word address is sent, the master generates a start condition following the

    acknowledge. This terminates the write operation, but not before the internal address pointer

    is set. Then the master issues thecontrol byte again but with the R/W bit set to a one. The

    24C32A will then issue an acknowledge and transmitthe 8-bit data word. The master will not

    acknowledgethe transfer but does generate a stop condition whichcauses the 24C32A to

    discontinue transmission.

    Contiguous Addressing Across Multiple Devices

    The device select bits A2, A1, A0 can be used to expand the contiguous address space for up

    to 256K bits by adding up to eight 24C32A's on the same bus. In this case, software can use

    A0 of the control byte as address bit A12, A1 as address bit A13, and A2 as address bit A14.

    Sequential Read :

    [25]

    Sequential reads are initiated in the same way as a random read except that after the 24C32A

    transmits the first data byte, the master issues an acknowledge as opposed to the stop

    condition used in a random read. This acknowledge directs the 24C32A to transmit the nextsequentially addressed 8-bit word . Following the final byte transmitted to the master, the

    master will NOT generate an acknowledge but will generate a stop condition. To provide

  • 7/29/2019 DOC B.1 Security 2

    26/52

    sequential reads the 24C32A contains an internal address pointer which is incremented by

    one atthe completion of each operation. This address pointer allows the entire memory

    contents to be serially read during one operation. The internal address pointer will

    automatically roll over from address 0FFF to address 000 if the master acknowledges the byte

    received from the array address 0FFF.

    WRITE OPERATION :

    [26]

    Byte Write : Following the start condition from the master, the control code (four bits), the

    device select (three bits), andthe R/W bit which is a logic low are clocked onto the bus by the

    master transmitter. This indicates to theaddressed slave receiver that a byte with a word

    address will follow after it has generated an acknowledge bit during the ninth clock cycle.

    Therefore, thenext byte transmitted by the master is the high-orderbyte of the word address

    and will be written into theaddress pointer of the 24C32A. The next byte is theleast

    significant address byte. After receiving another acknowledge signal from the 24C32A the

    masterdevice will transmit the data word to be written into theaddressed memory location.

    The 24C32A acknowledges again and the master generates a stop condition. This initiates the

    internal writecycle, and during this time the 24C32A will not generate acknowledge signals.

  • 7/29/2019 DOC B.1 Security 2

    27/52

    Page Write : The write control byte, word address and the first databyte are transmitted to

    the 24C32A in the same way asin a byte write. But instead of generating a stop condition,

    the master transmits up to 32 bytes which are temporarily stored in the on-chip page buffer

    and will bewritten into memory after the master has transmitted astop condition. After

    receipt of each word, the five loweraddress pointer bits are internally incremented by one.Ifthe master should transmit more than 32 bytes priorto generating the stop condition, the

    address counterwill roll over and the previously received data will beoverwritten. As with

    the byte write operation, once thestop condition is received, an internal write cycle will

    begin.

    3.6 Power supply

    Two supply voltages are required for the telephone remote system circuit. A transformer is

    used for taking a 12V supply. This 12V is connected to bridge rectifier for converting it into

    DC supply. The input coming from rectifier unit contains AC voltage component. This is

    filtered out with the help of high capacity capacitors connected in parallel. Here U3 and U4

    are supplied with a regulated 5V from a 7805(U2) fixed voltage regulator.The unregulated

    voltage of approximately 12V is required for relay and buzzer driving circuit. LEDs L1

    indicate power supply status. LED has a current limiting resister in series.

    [27]

  • 7/29/2019 DOC B.1 Security 2

    28/52

    [28]

  • 7/29/2019 DOC B.1 Security 2

    29/52

    Chapter 4: Software Design

    4.1 LCD Module

    [29]

    4.2 Process chart

  • 7/29/2019 DOC B.1 Security 2

    30/52

    4.1 LCD MODULE

    [30]

    InitializationofLCD:

    4bit&2linedisplay

    DisplayON&

    Cursorblinking

    Cleardisplayscreen

    Incrementcursor

    Cursorbeginningof

    1stline

    Givinginputin

    theform

    of

    textb RS=1

    DisplaysWaitingforuser

    code

    STARTSTART

    1

  • 7/29/2019 DOC B.1 Security 2

    31/52

    4.2 Process Chart

    [31]

    Start

    EEPROM

    8051

    Microcontroller

    Check Code

    Availability

    LCD Display

    Access Granted

    LCD Display

    Invalid User

    RelayOn

    DoorOpen

    Relay On

    Door O en

    YesNo

    Cursorbeginningof

    2nd

    linebyRS=0

    Displaysusernumber,RFIDcodeBy

    RS=1

    1

  • 7/29/2019 DOC B.1 Security 2

    32/52

    Chapter 5: Testing and Results

    5.1 Hardware and Setup

    5.2 LCD Test

    5.3 Result

    [32]

  • 7/29/2019 DOC B.1 Security 2

    33/52

    5.1 HARDWARE SET-UP The power supply is provided first to the hardware and through voltage

    regulator, the circuit components receive their proper supply voltage.

    After that, the LCD displays the required BCD code and asks to the person to

    show the tag.

    The code is received by the module and checks the code availability.

    For correct code, LCD displays the CORRECT PASSWORD

    For wrong code, LCD displays INVALID PASSWORD.

    5.2 LCD TESTINGLCD is used in 4 bit mode, so the 8 bit data is moved in the form of nibbles to

    the LCD one by one. When LCD was tested by supplying it with proper location, it

    gave correct display according to the LCD programming with cursor on and blinking

    and cursor incrementing to write. LCD displays persons data base and the final

    result.

    5.3 RESULT

    The project works for the door access by checking the password in EEPROM

    and displays the results accordingly.

    [33]

  • 7/29/2019 DOC B.1 Security 2

    34/52

    Chapter 6: Source code in c-language

    #include

    #define EE_SCL P1_0

    #define EE_SDA P1_1

    #define LCD_E P1_7

    #define LCD_RW P1_6

    #define LCD_RS P1_5

    #define LCD_DATA P3

    #define buzz P0_3

    #define led P1_2

    void cmnwrt(int);

    void datawrt(char);

    char keypad_refresh();

    void init();

    void delay(unsigned i);

    void get_sntnc(char *);

    void print_msg(char*,char);

    void EE_write(unsigned int, char);

    char EE_read(unsigned int);

    void EE_strt();

    void EE_stop();

    char EE_shin();

    void EE_shout(char);

    [34]

    //----------------------------------------

  • 7/29/2019 DOC B.1 Security 2

    35/52

    //----------------------------------------

    int main(){

    char tmp[17],i,j;

    init();

    cmnwrt(0x80);

    led=1;

    while(1){

    if(EE_read(0) != 'p' || EE_read(1) != '='){

    np:

    cmnwrt(1);

    print_msg("Enter new pass:\0",0x80);

    get_sntnc(tmp);

    EE_write(0,'p');

    EE_write(1,'=');

    for(i=0; tmp[i]; i++)

    EE_write(i+2,tmp[i]);

    EE_write(i+2,0);

    }

    rpa:

    cmnwrt(1);

    print_msg("Enter the pass:\0",0x80);

    get_sntnc(tmp);

    for(i=0,j=0;;i++){

    if(tmp[i] != EE_read(i+2)){

    j=-1;

    [35]

    break;

  • 7/29/2019 DOC B.1 Security 2

    36/52

    }

    if(!tmp[i])

    break;

    }

    cmnwrt(1);

    if(j==-1)

    {

    print_msg("Pass is wrong!\0",0x80);

    led=1;

    buzz=1;

    delay(5000);

    buzz=0;

    goto rpa;

    }

    else

    {

    print_msg("Pass is right!\0",0x80);

    led=0;

    buzz=0;

    delay(5000);

    led=1;

    }

    cmnwrt(1);

    print_msg("*=change pass\0",0x80);

    [36]

    print_msg("#=back\0",0xc0);

  • 7/29/2019 DOC B.1 Security 2

    37/52

    ka:

    do

    i=keypad_refresh();

    while(i==-1);

    if(i==0x3a)

    goto np;

    else if(i==0x3c)

    goto rpa;

    else

    goto ka;

    }

    }

    //------------------------------------

    //------------------------------------

    void print_msg(char *msg, char line){

    char i;

    cmnwrt(line);

    for(i=0; *(msg+i); i++)

    datawrt(*(msg+i));

    }

    //------------------------------------

    //------------------------------------

    char keypad_refresh(){

    [37]

    char tmp,row,cl;

  • 7/29/2019 DOC B.1 Security 2

    38/52

    P2 = 0xf0;

    if(!P2_4)

    row = 0;

    else if(!P2_5)

    row = 1;

    else if(!P2_6)

    row = 2;

    else if(!P2_7)

    row = 3;

    else

    return -1;

    P2 = 0xff;

    P2 = 0x0f;

    if(!P2_2)

    cl = 0;

    else if(!P2_1)

    cl = 1;

    else if(!P2_0)

    cl = 2;

    else

    return -1;

    [38]

  • 7/29/2019 DOC B.1 Security 2

    39/52

    tmp = row*3+cl+1;

    if(tmp == 11)

    tmp = 0;

    return tmp|0x30;

    }

    //--------------------------------------------------

    //--------------------------------------------------

    void get_sntnc(char *str) {

    char i,j,z;

    for(i=0; i

  • 7/29/2019 DOC B.1 Security 2

    40/52

    do

    j = keypad_refresh();

    while(j==-1);

    if(j==0x3c){

    *(str+i) = 0;

    break;

    }else if(j==0x3a){

    if(i>0){

    i--;

    *(str+i) = 0;

    }

    }else{

    if(i

  • 7/29/2019 DOC B.1 Security 2

    41/52

  • 7/29/2019 DOC B.1 Security 2

    42/52

    }

    }

    //--------------------------------------------------

    //--------------------------------------------------

    void delay(unsigned i) {

    TMOD = 1;

    for (;i>0;i--) {

    TH0 = 0xFc; //0xFFFF - 0xFc17 = 1000 (decimal) -> 1ms for 12MH

    crystal

    TL0 = 0x17;

    TR0 = 1;

    while(!TF0);

    TR0 = 0;

    TF0 = 0;

    }

    }

    //--------------------------------------------------

    //--------------------------------------------------

    void cmnwrt(int cmn) {

    LCD_DATA = cmn;

    LCD_RS = 0;

    [42]

    LCD_RW = 0;

  • 7/29/2019 DOC B.1 Security 2

    43/52

    LCD_E = 1;

    LCD_E = 0;

    delay(2);

    }

    void datawrt(char ch) {

    LCD_DATA = ch;

    LCD_RS = 1;

    LCD_RW = 0;

    LCD_E = 1;

    LCD_E = 0;

    delay(2);

    }

    //---------------------------------------------------

    //---------------------------------------------------

    //Write into EEPROM

    void EE_write(unsigned int addr, char dta){

    char chtmp;

    CY = 0;

    EE_strt();

    EE_shout(0xA0);

    chtmp = addr>>8;

    EE_shout(chtmp);

    [43]

    chtmp = addr;

  • 7/29/2019 DOC B.1 Security 2

    44/52

  • 7/29/2019 DOC B.1 Security 2

    45/52

    void EE_strt() {

    EE_SDA = 1;

    EE_SCL = 1;

    EE_SDA = 0;

    EE_SCL = 0;

    }

    //Stop

    void EE_stop() {

    EE_SCL = 0;

    EE_SDA = 0;

    EE_SCL = 1;

    EE_SDA = 1;

    }

    //Shift out

    void EE_shout(char sho) {

    unsigned char i,j;

    for (j=0, i=0; i

  • 7/29/2019 DOC B.1 Security 2

    46/52

    CY = 0;

    EE_SDA = CY;

    EE_SCL = 1;

    j = j; //delay

    EE_SCL = 0;

    }

    EE_SDA = 1;

    EE_SCL = 1;

    j=j; //delay

    CY = EE_SDA;

    EE_SCL = 0;

    }

    //Shift in

    char EE_shin() {

    char i,shi = 0;

    EE_SDA = 1;

    for (i=0; i

  • 7/29/2019 DOC B.1 Security 2

    47/52

    }

    EE_SDA = 1;

    EE_SCL = 1;

    i=i; //delay

    EE_SCL = 0;

    return shi;

    }

    [47]

  • 7/29/2019 DOC B.1 Security 2

    48/52

    Chapter 7: Applications ,Advantages & Disadvantages

    7.1 Application

    7.2 Advantage

    7.3 Disadvantage

    [48]

  • 7/29/2019 DOC B.1 Security 2

    49/52

    7.1 Application

    The term access control refers to the practice of restricting entrance to a

    property, a building or a room to authorized persons. Integrated and controller based

    access control numeric and alphabetic keyless entry keypads with programmable

    features for the access control of single openings. The various applications are as

    follows.

    Industrial facilities

    Commercial buildings

    Airports, civil transportation Convention halls

    Psychiatric care centres

    Museums and fine art galleries

    Ware houses

    Technology centres

    Government and military

    Long term care facilities

    Drug rehabilitation centres

    [49]

  • 7/29/2019 DOC B.1 Security 2

    50/52

    7.2 Advantage

    Use of RFID technology can increase business productivity and reduce

    associated costs. To ensure that companies benefit from the advantages RFID

    provides it is important to understand how to adopt this technology. By analyzing

    current practices and procedures eight main areas of benefit can be identified. These

    are:

    Improved Productivity and Cost Avoidance.

    Decreased Cycle Time and Taking Costs Out.

    Reduced Rework.

    Reduced Business Risk & Control of Assets.

    Improved Security and Service.

    Improved Utilization of Resources.

    Increased Revenues.

    Exception Management.

    [50]

  • 7/29/2019 DOC B.1 Security 2

    51/52

    7.3 Disadvantage

    The disadvantages are that, when there is a necessity of providing control at many

    locations inside the company, a person at each point will not be an economical way of

    implementing it.

    Then came were the punch cards. Employees possess cards, which are punched when

    they enter into the building. But it had disadvantages. Workers started to practice buddy

    punching, for their co-workers.

    [51]

  • 7/29/2019 DOC B.1 Security 2

    52/52