CONTENTS CATEGORY OF FIGURE IV CATEGORY OF TABLE V LIST OF ACRONYMS VI CHAPTER 1. OVERVIEW OF TOPIC 1 1.1 INTRODUCTION TO THE TOPIC 1 1.2 RESEARCH SUBJECTS 1 1.3 RESEARCH SCOPE 1 1.4 EXPECTED RESULTS 1 CHAPTER 2. THEORETICAL BASIC 3 2.1 MICROCONTROLLERS 3 2.2 RFID APPLICATION 13 2.3 KEYPAD (3X4) 15 2.4 LIQUIDCRYSTAL DISPLAY (LCD) 16 2.5 ELECTROMAGNETIC DOOR LOCK 18 CHAPTER 3. BLOCK DIAGRAM AND CONTROL ALGORITHMS 20 3.1 BLOCK DIAGRAM 20 3.2 CONTROL ALGORITHMS 21 CHAPTER 4. CIRCUIT DESIGN AND MODEL CONSTRUCTION 22 4.1 CIRCUIT DESIGN 22 4.1.1 Principle diagram 22 4.1.2 PCB layout 23 4.1.3 Actual circuit 24 4.2.2 Complete project 25 CHAPTER 5. EXPERIMENT 26 5.1 EXPERIMENTAL PROGRESS 26 5.2 EXPERIMENTAL RESULTS 26 CHAPTER 6. OUTCOME 34 6.1 ADVANTAGES 34 6.2 DISADVANTAGES 34 6.3 DEVELOPMENT 35 PROGRAM 36 CATEGORY OF FIGURE 1 Pic 16F877a 4 2 PIC16F877A General Structure 5 3 RDM 6300 14 4 Matrix keypad 15 5 LCD 1602A 16 6 ASCII CODE TABLE FOR LCD 17 7 Electromagnetic door lock 18 8 Principle diagram on Proteus 22 9 PCB layout 23 10 Actual circuit 23 11 Actual circuit 24 12 Complete mod 24 13Main screen 25 14 Enter the pass 26 15 Correct pass 26 16 Correct card 27 17 Incorrect pass 27 18 Incorrect card 28 19 Incorrectly more than 3 times 29 20 Menu monitor 29 21 Change password 29 OVERVIEW OF TOPIC 1.1 Introduction to the topic This system provides users with two options to unlock the door: entering a password or scanning a card. If the correct password is entered, the system will give users the option to change the password. However, users are only allowed a maximum of three attempts to enter the password or scan the card. If this limit is exceeded, the system will activate an alarm to alert the possibility of a thief attempting to break in.Research purposes Utilizing the knowledge gained from the study of microcontrollers, I aim to develop an automatic door opening system that incorporates both a password and magnetic card function. The purpose of this system is to enhance safety and security measures for door access. 1.2 Research subjects Microcontroller PIC 16F877A, LCD 1602A, ELECTROMAGNETIC DOOR LOCK, RDM 6300, MATRIX KEYPAD. 1.3 Research scope Smart magnetic door with accurate processing and good security, ensuring safety for households, offices or factories. 1.4 Expected results The door access system mandates that users either input a password or scan a magnetic card. Upon completing these actions, the LCD display will present one of two statuses. If the user enters the correct password and successfully scans the card, the LCD will exhibit a correct status message. However, if incorrect information is entered or scanned, the LCD will show an error message and trigger the buzzer. If the number of allowed access attempts exceeds the maximum limit, an alarm siren will blare. This automatic door opening system also facilitates the password change function, providing users with an option to update their password as desired.
Trang 1CATEGORY OF FIGURE IV CATEGORY OF TABLE V LIST OF ACRONYMS VI
CHAPTER 1 OVERVIEW OF TOPIC 1
1.1 INTRODUCTION TO THE TOPIC 1
1.2 RESEARCH SUBJECTS 1
1.3 RESEARCH SCOPE 1
1.4 EXPECTED RESULTS 1
CHAPTER 2 THEORETICAL BASIC 3
2.1 MICROCONTROLLERS 3
2.2 RFID APPLICATION 13
2.3 KEYPAD (3X4) 15
2.4 LIQUID-CRYSTAL DISPLAY (LCD) 16
2.5 ELECTROMAGNETIC DOOR LOCK 18
CHAPTER 3 BLOCK DIAGRAM AND CONTROL ALGORITHMS 20
3.1 BLOCK DIAGRAM 20
3.2 CONTROL ALGORITHMS 21
CHAPTER 4 CIRCUIT DESIGN AND MODEL CONSTRUCTION 22
4.1 CIRCUIT DESIGN 22
4.1.1 Principle diagram 22
4.1.2 PCB layout 23
4.1.3 Actual circuit 24
4.2.2 Complete project 25
CHAPTER 5 EXPERIMENT 26
Trang 26.1 ADVANTAGES 34 6.2 DISADVANTAGES 34 6.3 DEVELOPMENT 35
PROGRAM 36
Trang 32- PIC16F877A General Structure -5
3- RDM 6300 -14
4- Matrix keypad -15
5- LCD 1602A -16
6- ASCII CODE TABLE FOR LCD -17
7- Electromagnetic door lock -18
8- Principle diagram on Proteus -22
9- PCB layout -23
10- Actual circuit -23
11- Actual circuit -24
12- Complete mod -24
13-Main screen -25
14- Enter the pass -26
15- Correct pass -26
16- Correct card -27
17- Incorrect pass -27
18- Incorrect card -28
19- Incorrectly more than 3 times -29
20- Menu monitor -29
21- Change password -29
Y
CATEGORY OF TABLE
Trang 5RFID: Radio Frequency Identification
PIC: Programmable Intelligent Computer
LCD: Liquid crystal display
PCB: Printed Circuit Board
Trang 6CHAPTER 1 OVERVIEW OF TOPIC
1.1 Introduction to the topic
This system provides users with two options to unlock the door: entering apassword or scanning a card If the correct password is entered, the system will giveusers the option to change the password However, users are only allowed amaximum of three attempts to enter the password or scan the card If this limit isexceeded, the system will activate an alarm to alert the possibility of a thiefattempting to break in.Research purposes
Utilizing the knowledge gained from the study of microcontrollers, I aim to develop
an automatic door opening system that incorporates both a password and magneticcard function The purpose of this system is to enhance safety and security measuresfor door access
Trang 7will blare This automatic door opening system also facilitates the password changefunction, providing users with an option to update their password as desired.
2.1 Microcontrollers
Microcontroller is a computer integrated on a chip, it is often used to controlelectronic devices A microcontroller, in essence, is a system consisting of amicroprocessor with sufficient performance and low cost (different from general-
Trang 8purpose microprocessors used in computers) combined with peripheral blocks such
as a microprocessor memory, input/output modules, digital-to-analog and to-digital conversion modules, etc In computers, modules are usually built by chipsand external circuits
analog-Microcontrollers are commonly used to build embedded systems It is also used inelectrical and electronic equipment such as washing machines, microwave ovens,telephones, DVD players, multimedia equipment or automated production lines, etc.The processor in this system is 16F877A
PIC16F877A is a 40-pin PIC Microcontroller and is used mostly in embeddedprojects and applications It has five ports starting from port A to port E It has threetimers of which two are 8-bit timers and one is 16-bit timers It supports manycommunication protocols such as serial protocol, parallel protocol, I2C protocol.The PIC16F877A supports both hardware pin interrupts and timer interrupts
Trang 9Figure 2.1- Pic 16F877a
Trang 10Figure 2.2- PIC16F877A General Structure
Table 1- Table pin of pic 16F877a
- / MCLR: Active low reset
- VPP: programmable voltage input
– RA0: input/output number
– AN0 : analog input
– RA1: output/import numbers
– AN1 : analog input
Trang 11numbers– AN 2: analog input– ON-: standard (low) voltage input of the A/D unit
– RA3: output/import numbers
– AN3 : analog input– VREF+ : standard (high) voltage input of A/
D unit
– RA4: output/import numbers
– TOCKI : external clockinput for timer0
– C1 OUT : 1 comparator output
– RA5: output/import numbers
– AN4 : 4 analog input– SS : auxiliary SPI selection input– C2 OUT : 2 comparator output
Trang 12numbers– RD : control reading at parallel branch port– AN5 : analog input
– RE1 : output/import numbers
– WR : control writing at parallel branch port– AN6 : analog input
– RE2: export/import numbers
– CS : Control selection chip at parallel branch port
– AN7: analog input
Trang 13– CLKI: external pulse source input Always associated with OSC1 functionality.
Clock or quartz oscillator input
– OSC2 : Quartz oscillator output Connect
to quartz or resonator.– CLKO: in RC mode, the output of OSC2, equals the frequency of OSC1 and indicates the speed of the instruction cycle
– RC0 : input/output number
– T1OCO : 1 Timer oscillator input
– T1CKI : Timer 1 external clock input
– RC1 : output/import numbers
– T1OSI: Timer 1 oscillator input– CCP2 : Capture 2 input,
Trang 14compare 2 output, PWM2 output
– RC2: output/import numbers
– CCP1 : Capture 1 input,compare 1 output, PWM1 output
– RC3: output/import numbers
– SCK : synchronous serial clock input/output
of SPI mode– SCL: synchronous serial clock input/output
of I2C mode
– RD0: output/import numbers
– PSP0 : parallel branch port data
– RD1: output/import numbers
– PSP1 : parallel branch port data
numbers
Trang 15– PSP2 : parallel branch port data
– RD3: output/import numbers
– PSP3: parallel branch port data
– RC4: output/import numbers
– SDI: data to SPI– SDA: export/import data to I2C
– RC5: output/import numbers
– SDO: SPI output data
– RC6: output/import numbers
– TX: asynchronous transmission USART– CK : USART synchronous pulse
numbers– RX : get disagreement USART
Trang 16– DT : USART synchronous data
– RD4: output/import numbers
– PSP4: parallel branch port data
– RD5: output/import numbers
– PSP5: parallel branch port data
– RD6: output/import numbers
– PSP6: parallel branch port data
– RD7: output/import numbers
– PSP7: parallel branch port data
– RB0: output/import numbers
– INT : external interrupt
Trang 17numbers– ICPS low voltage programming enable pin
– Export/import numbers– PortB interrupt
– Export/import numbers– PortB interrupt
– RB6: output/import numbers
– PGC : ICSP programming clock and differential circuit– PortB interrupt
– RB7: output/import numbers
– PGD: differential circuit and ICSP programming data– PortB interrupt
2.2 RFID APPLICATION
RFID, short for Radio Frequency Identification, uses electromagnetic fields toautomatically identify and track objects equipped with special tags Suchtechnology consists of an RFID tag, reader, and radio transmitter Triggered by anelectromagnetic pulse, the queried RFID tag responds with a unique numeric value,
Trang 18allowing objects, such as goods or equipment, to be tracked Simply put, RFID is anautomated identification method that uses data storage devices and remotecommunication.
An RFID tag comprises three integral components, including a chip that stores andprocesses informational data, modulation and demodulation of radio frequencysignals, an antenna for signal reception and transmission, and a substrate The RFIDtag's data is stored in EEPROM memory
RFID tags come in three variations- passive, active, and battery-powered passivetags Active tags have a power source and can send data Passive tags are usuallycheaper since they derive energy to power the IC from radio waves RFID tags can
be read-only with a serial number, or read/write enabled, permitting the user towrite special data to the tag Programmable tags can be written once and readmultiple times, while blank tags can be written with an electronic product code bythe user
When queried, RFID tags respond with their identifier (ID) information as well asadditional product or manufacturing data Due to each RFID tag possessing aunique serial number, an RFID system is designed to read multiple tags at once,providing they are within the RFID reader's range
Compact in its design, the RDM6300 RF 125kHz UART RFID transceiver module
is equipped with an RFID antenna, as well as transmission and reception circuitsutilizing the UART communication standard, set at a fixed Baudrate parameter of
9600, N, 8, 1 The accompanying RFID code will appear in the form of 10-digitASCII code, requiring users to select this specific encoding method in order toaccurately perceive the card code
Trang 20Figure 2.4- Matrix keypad
2.4 Liquid-Crystal Display (LCD)
Trang 21Figure 2.5- LCD 1602A
The LCD 1602A Blue is a 1602 character LCD module with a blue backlight Ituses a Hitachi HD44780 driver chip to display alphanumeric characters andsymbols The module has 16 pins, with pin 1 being the Ground and pin 2 being thePower supply voltage Pin 3 indicates the Contrast adjustment, while pins 4-6 and11-14 relate to data input and output (D4-D7) and control signals (RS, RW, E),respectively Pins 15 and 16 are designated for the backlight
The module is commonly used in microcontroller projects for displayinginformation such as text, numbers, and symbols It operates on a supply voltage of4.5V - 5.5V DC and can display 4 lines with a maximum of 20 characters per line
It has an operating temperature range of -20°C to 70°C
Trang 22The LCD 1602A module is widely used in various applications such as vendingmachines, ATMs, medical devices, and appliances for displaying system status anddata.
Figure 2.6- ASCII CODE TABLE FOR LCD
2.5 Electromagnetic door lock
Trang 23Figure 2.7- Electromagnetic door lock
An electromagnetic door lock is a type of lock mechanism that uses an electriccurrent to generate a magnetic field, which attracts a locking bolt and secures thedoor or gate Also known as magnetic locks, these devices are widely used incommercial and industrial settings, as they provide a high level of security and ease-of-use
Trang 24The lock mechanism consists of two main components: the locking assembly andthe electromagnet The locking assembly is installed on the door frame, and theelectromagnet is installed on the door itself When an electric current is passedthrough the electromagnet, it creates a powerful magnetic field that attracts thelocking bolt to the lock assembly, effectively securing the door.
One of the benefits of electromagnetic locks is that they are fail-safe, meaning theywill unlock automatically in the event of a power failure or emergency They alsooffer a high level of security, as they cannot be picked or tampered with easily Inaddition, they are easy to install and maintain, making them a popular choice formany businesses and industries
Electromagnetic door lock nees 12 Volt and 0.4 Ampere to work
Trang 25CHAPTER 3 BLOCK DIAGRAM AND CONTROL ALGORITHMS3.1 Block diagram
Trang 263.2 Control Algorithms
START
INITIALIZATION
OF SYSTEM
CHECK PASS
ELECTROMAGNETICDOOR LOCK
INCORRECT
INCORRECT
BUZZER
END
Trang 27CHAPTER 4 CIRCUIT DESIGN AND MODEL CONSTRUCTION
4.1 CIRCUIT DESIGN
4.1.1 Principle diagram
Figure 4.1 - Principle diagram on Proteus
4.1.2 PCB layout
Trang 28Figure 4.2- PCB layout
4.1.3 Actual circuit
Figure 4.3 - Actual circuit
Trang 29Figure 4.4 - Actual circuit
4.2.2 Complete project
Figure 4.5 - Complete mode
Trang 30CHAPTER 5 EXPERIMENT
5.1 Experimental progress
Step 1: Supply power to the circuit
Step 2: Enter password or scan card
Step 3: If correct, then the electromagnetic door lock is open
Step 4: If password or RFID card incorrect, then the buzzer is active
Step 6: After entering the correct password, then press "*" to relock
5.2 Experimental results
Figure 5.1 8-Main screen
The monitor when system start, press “#” to enter menu or press any button except
“#” and “*” to enter password
Trang 31Figure 5.2 - Enter the pass
The default password will be 6 numbers, it is: “111111” When we in enter thepassword program, we can't access by RFID
Figure 5.3 - Correct pass
Trang 32When the password is correct, the LCD will be displayed At this time the door will
be opened right then and don’t relock If we want to relock, press “*”
Figure 5.4 - Correct card
If we don't use a password to open the door, we can use a RFID card to do itinstead
Trang 33Figure 5.5 - Incorrect pass
Figure 5.6 - Incorrect card
When we input wrong password and wrong card, the system will report an error andreduce access to the system When we try to access by wrong password or card 3
Trang 34times, buzzer will be Sound out.
Figure 5.6 - Incorrectly more than 3 times
When wrong 3 times, the system will automatically lock and alert the user
Trang 35Figure 5.8 - Menu monitor
When we want to enter menu, press “#” after start system
Trang 36Figure 5.9 9- Change password
Press 1 to change password, first, enter current password, then input new passwordPress 2 to add new card, first, enter current password, then touch new card
Trang 37CHAPTER 6 OUTCOME
6.1 Advantages
Fasted security: The door locking system using PIC 16F877A provides enhancedsecurity compared to traditional lock systems, as it requires a specific code tounlock the door This code can only be accessed by authorized personnel
Easy to use: The door locking system using PIC 16F877A is easy to use and can beoperated by anyone without requiring any special skills or training
Saves time: The door locking system using PIC 16F877A saves time by eliminatingthe need for traditional keys, which can be lost or misplaced This searching thetime-consuming process of searching for or replacing lost keys
Cost-effective: The door locking system using PIC 16F877A is cost-effectivecompared to other high-security systems It requires minimal maintenance and can
be easily installed
Integration with other systems: The PIC 16F877A microcontroller used in the doorlocking system can be easily integrated with other systems such as CCTV cameras,alarms, and other security systems to create a comprehensive security system
6.2 Disadvantages
Vulnerable to hacking: Electronic door locking systems, including those using PIC16F877A, are vulnerable to hacking by individuals with the appropriate skills andknowledge If the system is not secured correctly, hackers can gain access to thedoor code and override the system
Power failure: A door locking system using PIC 16F877A relies on a continuouspower supply In the event of a power failure, the system will not function, andmanual override or backup systems may be required to unlock the door
Maintenance: Electronic door locking systems require regular maintenance toensure they function correctly This often involves replacing batteries orcomponents, which can be time-consuming and expensive
Trang 38Technical knowledge: The installation and maintenance of a door locking systemusing PIC 16F877A require technical knowledge and expertise Training andsupport may be required for individuals to operate and maintain the systemeffectively.
Initial setup: The initial setup of the system can be complex and may requirespecialist knowledge or consulting services This can add to the cost of the system.Compatibility issues: The door locking system using PIC 16F877A may not becompatible with all doors or locking mechanisms Additional modifications orcomponents may be required to ensure the system functions correctly
6.3 Development
In order to mitigate power failures following an unexpected issue, the system will
be reinforced with additional backup power This modification enhances thesystem's flexibility, ensuring a hassle-free user experience during outages
Program
Control program in C language
#include <16F877A.h>