Upload
kelsie-lycett
View
215
Download
1
Tags:
Embed Size (px)
Citation preview
Building Security and Access Building Security and Access Control SystemControl System
Group Members:Group Members:Abdulrahman Daher SaeedAbdulrahman Daher Saeed 199901447199901447Khalid Younus Ali KalbatKhalid Younus Ali Kalbat 199900132199900132Mohammed Ramadan SarhanMohammed Ramadan Sarhan 199905274199905274Mohammed Numan ShehadehMohammed Numan Shehadeh 199901473199901473
Executive SummaryExecutive Summary
Designing and implementing a secure access and Designing and implementing a secure access and control system for an office buildingcontrol system for an office building
The system consists of two sites. The system consists of two sites. – system site system site
– local sitelocal site
The two sites are connected using serial The two sites are connected using serial communication RS-232 communication RS-232
Executive SummaryExecutive Summary
Local Site: Local Site: where the personal computer is located where the personal computer is located and a user interface program is installedand a user interface program is installed
System site: a keypad and a Liquid Crystal Display System site: a keypad and a Liquid Crystal Display (LCD) are located at the entrance of the system(LCD) are located at the entrance of the system
The LCD is used to show all the needed messages to The LCD is used to show all the needed messages to the user to inform him/her about what to do at the the user to inform him/her about what to do at the entrance entrance
IntroductionIntroduction
The importance of this project lies in the fact that it The importance of this project lies in the fact that it serves the security for offices, hospitals, businesses serves the security for offices, hospitals, businesses or institutional buildingsor institutional buildings
The system is environmentally friendly, it doesn’t The system is environmentally friendly, it doesn’t pollutes the environment.pollutes the environment.
The system gives access to any person who has an The system gives access to any person who has an authorized User ID and passwordauthorized User ID and password
IntroductionIntroduction
System Operation:System Operation:
– The LCD will show a message to the user asking him to The LCD will show a message to the user asking him to enter his/her User ID and passwordenter his/her User ID and password
– Then it will show a wait message while the data will be Then it will show a wait message while the data will be transmitted to the PC via RS-232 interfacetransmitted to the PC via RS-232 interface
– The PC compares the data with the database to check if The PC compares the data with the database to check if the person should be allowed to enter or not the person should be allowed to enter or not
IntroductionIntroduction
System Operation:System Operation:
– If a valid User ID and password were entered, the LCD If a valid User ID and password were entered, the LCD will show an acceptance messagewill show an acceptance message
– The stepper motor will start rotating and open the door The stepper motor will start rotating and open the door to give the person the permission to enter the building to give the person the permission to enter the building
– Otherwise, if the User ID and the password were not Otherwise, if the User ID and the password were not valid, another message will be displayed showing valid, another message will be displayed showing “INVALID” on the LCD“INVALID” on the LCD
Project DescriptionProject Description
The project is basically a Microcontroller based The project is basically a Microcontroller based systemsystem
Microchip PIC16F877 microcontroller was Microchip PIC16F877 microcontroller was selected selected
The different components of the system are The different components of the system are controlled by microcontroller controlled by microcontroller
Project DescriptionProject DescriptionThe system consists of the following major The system consists of the following major
componentscomponents:: Liquid Crystal Display (LCD) SystemLiquid Crystal Display (LCD) System
Microcontrollers and other chipsMicrocontrollers and other chips
Sensors (Opto-Switches)Sensors (Opto-Switches)
Stepper motorStepper motor
KeypadKeypad
System Block DiagramSystem Block Diagram
MicrocontrollersMicrocontrollers
There are many companies which There are many companies which provide series of microcontrollersprovide series of microcontrollers – AtmelAtmel– Motorola Motorola – Microchip Technology.Microchip Technology.
The PIC16F877 microcontroller was The PIC16F877 microcontroller was selectedselected
The PIC microcontroller series are The PIC microcontroller series are produced by Microchip Technology produced by Microchip Technology
MicrocontrollersMicrocontrollers
The PIC microcontroller has The PIC microcontroller has many powerful features.many powerful features.
It has low cost compared to It has low cost compared to other productsother products
It is available in the Electrical It is available in the Electrical Engineering Department with its Engineering Department with its programming tools programming tools
MicrocontrollersMicrocontrollers
Main Features:Main Features:
– 256 Bytes EEPROM data memory256 Bytes EEPROM data memory
– Interrupt capability (up to 14 sources)Interrupt capability (up to 14 sources)
– Three different built-in timersThree different built-in timers
– 8 channels 10-bit analog-to-digital converter8 channels 10-bit analog-to-digital converter
– Universal Synchronous Asynchronous Receiver Universal Synchronous Asynchronous Receiver Transmitter (USART)Transmitter (USART)
Development ToolsDevelopment Tools
MPLAB IDE is a Windows MPLAB IDE is a Windows based Integrated Development based Integrated Development Environment (IDE) Environment (IDE)
MPLAB IDE is used to write, MPLAB IDE is used to write, debug, and optimize programs debug, and optimize programs in Assembly languagein Assembly language
Development ToolsDevelopment Tools
MPLAB IDE tools is used to:MPLAB IDE tools is used to:
– Assemble, compile, and link source codeAssemble, compile, and link source code
– Debug the executable logic by watching program flow Debug the executable logic by watching program flow with the simulatorwith the simulator
– Make timing measurementsMake timing measurements
– View variables in watch windowsView variables in watch windows
– Program firmware with PICSTART PlusProgram firmware with PICSTART Plus
Development ToolsDevelopment Tools
PICSTART PLUS is used to PICSTART PLUS is used to
Program micrcontrollersProgram micrcontrollers
PICSTART PLUS makes PICSTART PLUS makes designing simple.designing simple.
PIC16F877 Pin ConfigurationPIC16F877 Pin Configuration
Keypad InterfaceKeypad Interface
Keypad is used for command Keypad is used for command and data input in computer and data input in computer systemssystems
The user can enter the User ID The user can enter the User ID number and the password by number and the password by the keypadthe keypad
Keypad InterfaceKeypad Interface
keypads are usually arranged keypads are usually arranged as a simple matrix of as a simple matrix of conductorsconductors
switches connect each row to switches connect each row to each column each column
1 2 3
4 5 6
7 8 9
0 # *
1...................8
1 2 3
4 5 6
7 8 9
* 0 #
1 2 3
4
5
6
7
Keypad InterfaceKeypad Interface
Keypad scanning mechanism:Keypad scanning mechanism:
– Forcing the rows to zero by making the appropriate Forcing the rows to zero by making the appropriate Port B pins outputs and writing 0s to these pinsPort B pins outputs and writing 0s to these pins
– Making the pins associated with the columns inputs and Making the pins associated with the columns inputs and checking these pins to determine if any are 0checking these pins to determine if any are 0
– Forcing the columns to zero by making the appropriate Forcing the columns to zero by making the appropriate Port pins outputs and writing 0s to these pins Port pins outputs and writing 0s to these pins
Keypad InterfaceKeypad Interface
Keypad scanning mechanism:Keypad scanning mechanism:
– Making the pins associated with the rows inputs and Making the pins associated with the rows inputs and checking these pins to determine which row is zerochecking these pins to determine which row is zero
– Using the row and column numbers to look-up the key Using the row and column numbers to look-up the key value in a table and returning this value in the W value in a table and returning this value in the W accumulatoraccumulator
– Returning from the subroutine. Returning from the subroutine.
Stepper MotorStepper Motor
The stepper motor is used to The stepper motor is used to open and close the dooropen and close the door
The stepper motor moves one The stepper motor moves one step at a timestep at a time
In order to rotate the stepper In order to rotate the stepper motor specific sequence of motor specific sequence of voltages should be applied to voltages should be applied to the stator coilsthe stator coils
Stepper MotorStepper Motor
Unipolar stepper motor is Unipolar stepper motor is used since it’s easy to controlused since it’s easy to control
Permanent magnet is used Permanent magnet is used for the rotor and coils are put for the rotor and coils are put on the statoron the stator
4 poles stepper motor has 4 poles stepper motor has step angle of 90 degreesstep angle of 90 degrees
Stepper MotorStepper Motor
The turn of the motor is controlled by the electric The turn of the motor is controlled by the electric current which passes into the motor terminalscurrent which passes into the motor terminals
The motor can rotate in clockwise direction or The motor can rotate in clockwise direction or counterclockwise directioncounterclockwise direction
Stepper MotorStepper Motor
Turning off coil A and turning on coil B will Turning off coil A and turning on coil B will rotate the rotor in clockwise directionrotate the rotor in clockwise direction
Turning off coil B and turning on coil C will Turning off coil B and turning on coil C will move the rotor one step furthermove the rotor one step further
Stepper Motor ControlStepper Motor Control
The microcontroller was used to control the The microcontroller was used to control the stepper motorstepper motor
A program was written in assembly language to A program was written in assembly language to control the speed and the direction of rotation of control the speed and the direction of rotation of the stepper motorthe stepper motor
Stepper MotorStepper Motor
Opto-SwitchOpto-Switch
The Opto-Switch is a special The Opto-Switch is a special type of sensors used as a type of sensors used as a switch switch
Consists of two sections:Consists of two sections:– Infrared LEDInfrared LED– PhototransistorPhototransistor
There is a small gap between There is a small gap between the two sectionsthe two sections
Opto-SwitchOpto-Switch
The Opto-switches were used to provide a feedback The Opto-switches were used to provide a feedback to the microcontroller while the door is movingto the microcontroller while the door is moving
There are three Opto-switches located on the track There are three Opto-switches located on the track on which the door is slidingon which the door is sliding
The microcontroller senses the changes on these The microcontroller senses the changes on these sensors and performs the proper actionsensors and performs the proper action
Liquid Crystal Display Liquid Crystal Display (LCD)(LCD)
LCD can operate in one of the two LCD can operate in one of the two modes:modes:
– 8 bits data interface mode8 bits data interface mode
– 4 bits data interface mode4 bits data interface mode
8 bits mode is easier to implement 8 bits mode is easier to implement because it requires less memory size but because it requires less memory size but it also requires more additional I/O linesit also requires more additional I/O lines
Liquid Crystal Display Liquid Crystal Display (LCD)(LCD)
The LCD has 11 data and control pinsThe LCD has 11 data and control pins
D0-D7 is the bi-directional data busD0-D7 is the bi-directional data bus
R/W determines if we read from or write to the R/W determines if we read from or write to the LCD LCD
According to RS pin, the data on the data bus is According to RS pin, the data on the data bus is treated either as a command or character datatreated either as a command or character data
Liquid Crystal Display Liquid Crystal Display (LCD)(LCD)
Power SupplyPower Supply
The power supply is needed to operate the The power supply is needed to operate the microcontroller and the other components:microcontroller and the other components:
– 5 Vdc is needed to operate the microcontroller, 5 Vdc is needed to operate the microcontroller, LCD, and sensorsLCD, and sensors
– 12 Vdc is needed to operate the stepper motor12 Vdc is needed to operate the stepper motor
Power SupplyPower Supply
VCC 5 DCGND
GND
U2LM7805C/TO
13INOUT
VAC-
+1000u
VAC+T1
220/24 VAC
15
48
+10u
Bridge Rectifier
VAC+
VAC-
VDC+
VDC-
System IntegrationSystem Integration
The microcontroller supports five ports with a The microcontroller supports five ports with a width of 8 bits each except for the ports A and Ewidth of 8 bits each except for the ports A and E
The first four pins of PORTA(RA0:RA3) are The first four pins of PORTA(RA0:RA3) are
configured as output ports to control the stepper configured as output ports to control the stepper motor by setting the corresponding register motor by setting the corresponding register TRISA to onesTRISA to ones
The keypad is connected to seven pins of The keypad is connected to seven pins of PORTB(RB1:RB7)PORTB(RB1:RB7)
System IntegragtionSystem Integragtion
RB0 is reserved to be used as an interrupt pin to RB0 is reserved to be used as an interrupt pin to open the door directly from the computeropen the door directly from the computer
The three sensors used in the system are connected The three sensors used in the system are connected to PORTC(RC0:RC2)to PORTC(RC0:RC2)
RC6 (TX) and RC7 (RX) are configured to RC6 (TX) and RC7 (RX) are configured to send/receive data to/from the microcontroller at a send/receive data to/from the microcontroller at a baud rate of 9600 baud rate of 9600
System IntegrationSystem Integration
PORTD and PORTE are reserved for the LCD PORTD and PORTE are reserved for the LCD display moduledisplay module
PORTD is connected to the bi-directional data bus PORTD is connected to the bi-directional data bus (D0-D7) of the LCD(D0-D7) of the LCD
The three pins of PORTE(RE0:RE2) are The three pins of PORTE(RE0:RE2) are connected to RS, RW and EN, respectivelyconnected to RS, RW and EN, respectively
System IntegrationSystem Integration
The assembly code to configure the ports:The assembly code to configure the ports:BANKSEL ADCON1BANKSEL ADCON1MOVLW 0X06MOVLW 0X06MOVWF ADCON1MOVWF ADCON1BANKSEL TRISEBANKSEL TRISEMOVLW 0X00MOVLW 0X00MOVWF TRISEMOVWF TRISEMOVLW 0X00MOVLW 0X00MOVWF TRISDMOVWF TRISDMOVLW 0X00MOVLW 0X00MOVWF TRISAMOVWF TRISA
System IntegrationSystem Integration
The assembly code to configure the serial port:The assembly code to configure the serial port:
MOVLW 0xC7MOVLW 0xC7MOVWF TRISCMOVWF TRISCMOVLW SPBRG_VALMOVLW SPBRG_VALMOVWF SPBRGMOVWF SPBRGMOVLW 0x24MOVLW 0x24MOVWF TXSTAMOVWF TXSTABANKSEL PORTEBANKSEL PORTEMOVLW 0x90MOVLW 0x90MOVWF RCSTAMOVWF RCSTA
System IntegrationSystem Integration
A user defined byte is used for the purpose of building A user defined byte is used for the purpose of building multifunctional subroutines (AUX)multifunctional subroutines (AUX)
Only six bits of the AUX byte are used by the programOnly six bits of the AUX byte are used by the program
UP EQU 0UP EQU 0 ;USERNAME/PINCODE;USERNAME/PINCODEVINV EQU 1VINV EQU 1 ;INVALID/VALID;INVALID/VALIDMOT EQU 2MOT EQU 2 ;NOT MOTOR/MOTOR;NOT MOTOR/MOTOROPCL EQU 3OPCL EQU 3 ;OPENNING/CLOSING;OPENNING/CLOSINGWNW EQU 4WNW EQU 4 ;WAITING/NOT WAITING;WAITING/NOT WAITINGDOFFON EQU 5DOFFON EQU 5 ;DOOR OFF/ON;DOOR OFF/ON
System IntegrationSystem Integration
LCD initialization:LCD initialization:LCD_INITLCD_INIT
MOVF COUNT,WMOVF COUNT,W
CALL INITCALL INIT
MOVWF DATMOVWF DAT
CALL COMMANDINCALL COMMANDIN
INCF COUNT, FINCF COUNT, F
MOVLW 0X08MOVLW 0X08
SUBWF COUNT,WSUBWF COUNT,W
BTFSS STATUS, ZBTFSS STATUS, Z
GOTO LCD_INITGOTO LCD_INIT
System IntegrationSystem Integration
After initializing the LCD module, the main part After initializing the LCD module, the main part of the program startsof the program starts
The microcontroller sends commands to the LCD The microcontroller sends commands to the LCD to write a message “ENTER USERNAME”to write a message “ENTER USERNAME”
The data are stored in a subroutine called The data are stored in a subroutine called USRNM_DATAUSRNM_DATA
System IntegrationSystem Integration
A memory location (DIGITS) is initialized so that A memory location (DIGITS) is initialized so that the user can enter only four digitsthe user can enter only four digits
The data entered by the user is processed in a loop The data entered by the user is processed in a loop call DATALcall DATAL
The data entered by the user is also sent to the The data entered by the user is also sent to the LCD and computerLCD and computer
System IntegrationSystem Integration
Controlling the stepper motorControlling the stepper motor– After entering 4 digits by the user, PLS_WAIT After entering 4 digits by the user, PLS_WAIT
subroutine will be called to poll if the PIN code is valid subroutine will be called to poll if the PIN code is valid or invalidor invalid
– If the pin cod is invalid, the user will have another If the pin cod is invalid, the user will have another chance to enter his/her PIN code and only for three chance to enter his/her PIN code and only for three timestimes
– If the PIN code is valid, the program will activate the If the PIN code is valid, the program will activate the motor by setting DOFFON and WNW bits in the AUX motor by setting DOFFON and WNW bits in the AUX memory locationmemory location
System IntegrationSystem Integration
Database ProgramDatabase Program
Database is used to store the users’ information such as:Database is used to store the users’ information such as:
– User NameUser Name
– User ID NumbersUser ID Numbers
– User PasswordUser Password
Database ProgramDatabase Program
Database usually consists of Database usually consists of tables.tables.
Tables consists of fieldsTables consists of fields In our case there are three fields In our case there are three fields
which are:which are:– User NameUser Name
– User IDUser ID
– PasswordPassword
Database ProgramDatabase Program
There are several methods which are used to There are several methods which are used to locate specific records in database tableslocate specific records in database tables
FindFirstFindFirst method is one of these methods method is one of these methods
In the visual basic program the method will try to In the visual basic program the method will try to match the input to the system with the data in the match the input to the system with the data in the tabletable
The value of the The value of the NoMatchNoMatch property indicates the property indicates the success or the failure of the search operationsuccess or the failure of the search operation
Database ProgramDatabase Program
Another method is looping through all the records Another method is looping through all the records and testing the EOF property in each iterationand testing the EOF property in each iteration
The EOF property indicates the end of the records The EOF property indicates the end of the records in a tablein a table
The above method is slower than the previous one The above method is slower than the previous one in large databasesin large databases
Database ProgramDatabase Program
The second method was used in the project to The second method was used in the project to locate the records of the userslocate the records of the users
The implemented code in visual basic can be The implemented code in visual basic can be divided into three parts:divided into three parts:– DeclarationsDeclarations
– InitializationsInitializations
– LoopLoop
Database ProgramDatabase Program
Declarations:Declarations:– Dim Db As DAO.DatabaseDim Db As DAO.Database
– Dim Rst As DAO.RecordsetDim Rst As DAO.Recordset
– Dim Found As BooleanDim Found As Boolean
Initializations:Initializations:– Found = FalseFound = False
– Set Db = CurrentDb()Set Db = CurrentDb()
– Set Rst = Db.OpenRecordset("User”) Set Rst = Db.OpenRecordset("User”)
Database ProgramDatabase Program
Loop:Loop:Do While Not Rst.EOF And Not FoundDo While Not Rst.EOF And Not Found
If Rst("User ID") = Val(Text1.Text) ThenIf Rst("User ID") = Val(Text1.Text) Then
MsgBox "Match Found”MsgBox "Match Found”
Found = TrueFound = True
End IfEnd If
Rst.MoveNextRst.MoveNext
LoopLoop
If Not Found ThenIf Not Found Then
MsgBox "No Match Found"MsgBox "No Match Found"
Local Site InterfaceLocal Site Interface
The visual basic program is installed in a PC The visual basic program is installed in a PC located in the local sitelocated in the local site
The interface shows the User Name text box and The interface shows the User Name text box and the User ID text boxthe User ID text box
There is a command button used to open the door There is a command button used to open the door directly from the PCdirectly from the PC
Local Site InterfaceLocal Site Interface
System OperationSystem Operation
The LCD continuously shows a message to enter The LCD continuously shows a message to enter the User ID numberthe User ID number
System OperationSystem Operation
If the user enters the number, the microcontroller If the user enters the number, the microcontroller reads the number and transmits it through a serial reads the number and transmits it through a serial port to the computer while the LCD shows “Please port to the computer while the LCD shows “Please Wait” messageWait” message
System OperationSystem Operation
The visual basic program checks the existence of the The visual basic program checks the existence of the user in the users’ databaseuser in the users’ database
If the user is a registered user in the system, a valid If the user is a registered user in the system, a valid signal is sent to the microcontroller through the signal is sent to the microcontroller through the serial portserial port
The microcontroller writes “VALID” message on The microcontroller writes “VALID” message on the LCDthe LCD
System OperationSystem Operation
Then the user is allowed to enter the pin codeThen the user is allowed to enter the pin code The LCD shows “ENTER PINCODE” messageThe LCD shows “ENTER PINCODE” message
System OperationSystem Operation
If the pin code is correct the visual basic program If the pin code is correct the visual basic program sends another valid signal to the microcontrollersends another valid signal to the microcontroller
The microcontroller operates and controls the The microcontroller operates and controls the stepper motor to open the door for the userstepper motor to open the door for the user
There are three sensors which provide the There are three sensors which provide the feedback to the microcontroller to control the feedback to the microcontroller to control the opening and closing operation opening and closing operation
System OperationSystem Operation
If the user is not registered in the system, the local If the user is not registered in the system, the local site program sends an invalid signal to the site program sends an invalid signal to the microcontroller.microcontroller.
The LCD shows “INVALID” message The LCD shows “INVALID” message
Conclusion & RecommendationsConclusion & Recommendations
Conclusion:Conclusion:– The system controls the access to a building using PIC The system controls the access to a building using PIC
microcontroller and personal computermicrocontroller and personal computer
– The implemented system is effective in terms of the The implemented system is effective in terms of the costcost
– Low level and high level programming languages were Low level and high level programming languages were used effectively in the project used effectively in the project
– System integration was successfulSystem integration was successful
Conclusion & RecommendationsConclusion & Recommendations
Recommendations:Recommendations:
– Microcontroller based systems should be given more Microcontroller based systems should be given more interest from the department. interest from the department.
– The students from the electrical department should The students from the electrical department should learn how to implement a circuit in a printed circuit learn how to implement a circuit in a printed circuit board.board.
– The labs should be available for students at the evening The labs should be available for students at the evening time.time.