Escolar Documentos
Profissional Documentos
Cultura Documentos
PROJECT REPORT
ON
A Project report submitted in partial fulfillment of the requirement for the award of
Bachelor of Engineering
In
ELECTRONICS AND COMMUNICATION
Submitted by:
TARUN(Regd No.0501229084)
Signature
:
The completion of any project brings with it a sense of satisfaction, but it is never
complete without thanking those people who made it possible and whose constant support
has crowned our efforts with success.
One cannot even imagine the power of the force that guides us all and neither can we
succeed without acknowledging it. Our deepest gratitude to Almighty God for holding our
hands and guiding us throughout our lives.
I would also like to express our gratitude to Prof. Subhendu Behera Head of the
Department, Applied Electronics and Instrumentation DRIEMS, Cuttack for encouraging
and inspiring us to carry out the project in the department lab.
I would also like to thank our guide, Er. J. N Mishra Dept. of A p p l i e d Electronics
and Communication for his expert guidance, encouragement and valuable suggestions at
every step.
We also would like to thank all the staff members of AE&I dept. for providing us with
the required facilities and support towards the completion of the project.
We are extremely happy to acknowledge and express our sincere gratitude to our
parents for their constant support and encouragement and last but not the least, friends and
well wishers for their help and cooperation and solutions to problems during the course of
the project.
Also our friends at 8051projects.net who provided solutions at times when we were
against the wall in need of help.
iii
EMBEDDED ACCESS CONTROL AND SECURITY SYSTEM USING RFID
SYNOPSIS
The ongoing growth of technology has necessitated the use of more simpler and effective
Our project is based on automating the access control and security operations involved in
an organization. Earlier, there was the conventional swiping system using bar code readers.
Now, it can be carried using non-contact devices, with the help of Radio Frequency
Identification (RFID). RFID cards are provided to employees, these cards carry their own
identification number in a coded format, which can be retrieved by the reader only. By means of
this the authentication of the employees can be verified. Then is the access control at various
points inside the organization. In order to avoid tress passing and in cases of theft of cards, we
have added a keypad for entering a password. Thereby it achieves a two level security.
Acting as a substitute for security personnel, this gives a better reliability and ease of use, both
It finds quite an important application in Pay roll calculation, libraries; defense weapons
storage places (where only certain persons are authorized to enter), industrial monitoring and so
on. Our primary application that we have focused on is access control of employees of different
1. ABSTRACT
2. LIST OF TABLES
3. LIST OF FIGURES
2.4 DESCRIPTION
7. MICROCONTROLLER-AT89S52
3.1 DISCRIPTION
APPENDICES
REHERENCES -
CHAPTER 1
INTRODUCTION
The 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, such as the name, designation, his access locations in the organization and
other necessary details.
The control panel checks whether he/she is allowed to enter the particular door or not.
Then he/she is requested for a password. The employee enters it using a keypad interfaced with
the controller. The controller again checks it with the server for authenticity. 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. When a person of a particular designation is not
supposed to be allowed in a given entrance, he/she is not even requested for a password.
In our project, the card reader is a proximity card reader. The controller used is PIC
AT8952. The server database was created using MS Access and the programming parts were
carried out with VB, whereas the controller was programmed with Hi-tech C.
1.1 EXISTING TECHNOLOGIES & NEED FOR RFID
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 employee’s 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. But, the bar code readers are contact readers where, the
cards are required to touch the readers.
With growth of technology and giant leap in the field of Radio frequency transmission, a
requirement for the same application using RF is desired.
A further improvement is the RF ID card technology, which uses contact less card
readers. Bringing the card nearer to the reader suffices for the reader to read the contents of
the card. This simplifies the usage for the employees. This technology is crawling into the
companies and has the potential to substitute the preceding technologies.
Radio frequency (RF) refers to electromagnetic waves that have a wavelength suited
for use in radio communication. Radio waves are classified by their frequencies, which are
expressed in kilohertz, megahertz, or gigahertz. Radio frequencies range from very low
frequency (VLF), which has a range of 10 to 30 kHz, to extremely high frequency (EHF),
which has a range of 30 to 300 GHz.
RFID is a flexible technology that is convenient, easy to use, and well suited for
automatic operation. It combines advantages not available with other identification
technologies. RFID can be supplied as read-only or read / write, does not require contact or
line-of-sight to operate, can function under a variety of environmental conditions, and
provides a high level of data integrity. In addition, because the technology is difficult to
counterfeit, RFID provides a high level of security.
RFID is similar in concept to bar coding. Bar code systems use a reader and coded
labels that are attached to an item, whereas RFID uses a reader and special RFID devices that
are attached to an item. Bar code uses optical signals to transfer information from the label to
the reader; RFID uses RF signals to transfer information from the RFID device to the reader.
Radio waves transfer data between an item to which an RFID device is attached and
an RFID reader. The device can contain data about the item, such as what the item is, what
time the device traveled through a certain zone, perhaps even a parameter such as
temperature. RFID devices, such as a tag or label, can be attached to virtually anything –
from a vehicle to a pallet of merchandise.
RFID technology uses frequencies within the range of 50 kHz to 2.5 GHz. An RFID
system typically includes the following components:
• An antenna used to transmit the RF signals between the reader and the RFID device
• A reader that receives RF transmissions from an RFID device and passes the data to a host
system for processing
The RFID tags based on the mode of operation are classified as Active and Passive
tags. The classification is done on basis of the tags ability to transmit the code embedded in
it. Hence an active tag is capable of transmitting to a reader independently, whereas the
passive tag needs an external excitation for to transmit the code. The reader usually provides
the excitation. Further each of the tags either active or passive has their own frequency of
operation. We have used the passive type of tag operating at a frequency of 125 kHz in our
project.
PACKAGING
Tags are manufactured in a wide variety of packaging formats designed for different
applications and environments. The basic assembly process consists of first a substrate
material (Paper, PVC, PET...); upon which an antenna made from one of many different
Conductive materials including Silver ink, Aluminum and copper is deposited. Next the Tag
chip itself is connected to the antenna; using techniques such as wire bonding or flip chip.
Finally a protective overlay made from materials such as PVC lamination, Epoxy Resin or
Adhesive Paper, is optionally added to allow the tag to support some of the physical
conditions found in many applications like abrasion, impact and corrosion.
RFID tag IC’s are designed and manufactured using some of the most advanced and
smallest geometry silicon processes available. The result is impressive, when you consider
that the size of a UHF tag chip is around 0.3 mm2
In terms of computational power, RFID tags are quite dumb, containing only basic
logic and state machines capable of decoding simple instructions. This does not mean that
they are simple to design! In fact very real challenges exist such as, achieving very low
power consumption, managing noisy RF signals and keeping within strict emission
regulations. Other important circuits allow the chip to transfer power from the reader signal
field, and convert it via a rectifier into a supply voltage. The chip clock is also normally
extracted from the reader signal. Most RFID tags contain a certain amount of NVM (Non
volatile Memory) like EEPROM in order to store data.
The amount of data stored depends on the chip specification, and can range from just
simple Identifier numbers of around 96 bits to more information about the product with up to
32 Kbits. However, greater data capacity and storage (memory size) leads to larger chip
sizes, and hence more expensive tags. In 1999 The AUTO-ID center (now EPC Global)
based at the MIT (Massachusetts Institute of Technology) in the US, together with a number
of leading companies, developed the idea of a unique electronic identifier code called the
EPC (Electronic Product Code). The EPC is similar in concept to the UPC (Universal
Product
Code) used in barcodes today. Having just a simple code of up to 256 bits would lead to
smaller chip size, and hence lower tag costs, which is recognized as the key factor for wide
spread adoption of RFID in the supply chain.
TAG CLASSES
One of the main ways of categorizing RFID tags is by their capability to read and
write data.
This leads to the following 4 classes. EPC global has also defined five classes
These are the simplest type of tags, where the data, which is usually a simple ID number,
(EPC) is written only once into the tag during manufacture. The memory is then disabled
from any further updates. Class 0 is also used to define a category of tags called EAS
(electronic article surveillance) or anti-theft devices, which have no ID, and only announce
their presence when passing through an antenna field.
In this case the tag is manufactured with no data written into the memory. Data can
then either be written by the tag manufacturer or by the user – one time. Following this no
further writes are allowed and the tag can only be read. Tags of this type usually act as
simple Identifiers
This is the most flexible type of tag, where users have access to read and write data
into the tags memory. They are typically used as data loggers, and therefore contain more
memory space than what is needed for just a simple ID number.
These tags contain on-board sensors for recording parameters like temperature, pressure, and
motion, which can be recorded by writing into the tags memory. As sensor readings must be
taken in the absence of a reader, the tags are either semi-passive or active.
These are like miniature radio devices that can communicate with other tags and devices
without the presence of a reader. This means that they are completely active with their own
battery power source.
Passive tags use the reader field as a source of energy for the chip and for
Communication from and to the reader. The available power from the reader field, not only
reduces very rapidly with distance, but is also controlled by strict regulations, resulting in a
limited communication distance of 4 - 5m when using the UHF frequency Band (860 MHz –
930 MHz).
Semi-Passive (battery assisted backscatter) tags have built in batteries and therefore
do not require energy from the reader field to power the chip. This allows them to function
with much lower signal power levels, resulting in greater distances of up to 100 meters.
Distance is limited mainly due to the fact that tag does not have an integrated transmitter, and
is still obliged to use the reader field to communicate back to the reader.
Active tags are battery-powered devices that have an active transmitter onboard.
Unlike passive tags, active tags generate RF energy and apply it to the antenna. This
autonomy from the reader means that they can communicate at distances of over several
kilometers.
In order to receive energy and communicate with a reader, passive tags use one of the
two following methods. These are near field, which employs inductive coupling of the tag to
the magnetic field circulating around the reader antenna (like a transformer), and far field,
which use similar techniques to radar (backscatter reflection) by coupling with the electric
field. The near field is generally used by RFID systems operating in the LF and HF
frequency bands, and the far fields for longer read range UHF and microwave RFID systems.
LF, HF Tags
Tags at these frequencies use inductive coupling between two coils (reader antenna
and tag antenna) in order to supply energy to the tag and send information. The coils
themselves are actually tuned LC circuits, which when set to the right frequency (ex; 13.56
MHz), will maximize the energy transfer from reader to tag. The higher the frequency the
less turns required (13.56 MHz typically uses 3 to 5 turns). Communication from reader to
tag occurs by the reader modulating (changing) its field amplitude in accordance with the
digital information to be transmitted (base band signal). The result is the well-known
technique called Amplitude modulation (AM). The tags receiver circuit is able to detect the
modulated field, and decode the original information from it. However, whilst the reader has
the power to transmit and modulate its field, a passive tag does not. How communication is
therefore achieved back from tag to reader?
The answer lies in the inductive coupling. Just as in a transformer when the secondary
coil (tag antenna) changes the load and the result is seen in the Primary (reader antenna). The
tag chip accomplishes this same effect by changing its antenna impedance via an internal
circuit, which is modulated at the same frequency as the reader signal. In fact it’s a little
more complicated than this because, if the information is contained in the same frequency as
the reader, then it will be swamped by it, and not easily detected due to the weak coupling
between the reader and tag. To solve this problem, the real information is often instead
modulated in the side bands of a higher sub- carrier frequency, which is more easily detected
by the reader
Anti-collision
If many tags are present then they will all reply at the same time, which at the reader
end is seen as a signal collision and an indication of multiple tags. The reader manages this
problem by using an anti-collision algorithm designed to allow tags to be sorted and
individually selected. There are many different types of algorithms (Binary Tree, Aloha....),
which are defined as part of the protocol standards. The number of tags that can be identified
depends on the frequency and protocol used, and can typically range from 50 tags/s for HF
and up to 200 tags/s for UHF.
Once a tag is selected, the reader is able to perform a number of operations such as
read the tags identifier number, or in the case of a read/write tag write information to it. After
finishing dialoging with the tag, the reader can then either remove it from the list, or put it on
standby until a later time. This process continues under control of the anti collision algorithm
until all tags have been selected.
The card used in our project is a passive Radio Frequency Identification (RFID)
device for low-frequency applications (100 kHz-400 kHz). The device is powered by
rectifying an incoming RF signal from the reader. The device requires an external LC
resonant circuit to receive the incoming RF signal and to send data. The device develops a
sufficient DC voltage for operation when its external coil voltage reaches approximately 10
Vpp.
This device has a total of 128 bits of user programmable memory and an additional
12 bits in its configuration register. The user can manually program the 128 bits of user
memory by using a contact less programmer. The device is a One-Time Programmable
(OTP) integrated circuit and operates as a read-only device after programming.
Figure 1.6: TYPICAL PIN DETAILS OF THE CHIP INSIDE THE RFID CARD
FEATURES
• Factory programming and memory serialization.
• Modulation options:
The configuration register includes options for communication protocol (ASK, FSK,
PSK), data encoding method, data rate, and data length. These options are specified by
customer and factory programmed during assembly. Because of its many choices of
configuration options, the device can be easily used as an alternative or second source for
most of the existing low frequency passive RFID devices available today.
The device has a modulation transistor between the two antenna connections (VA and
VB). The modulation transistor damps or undamps the coil voltage when it sends data. The
variation of coil voltage controlled by the modulation transistor results in a perturbation of
voltage in reader antenna coil. By monitoring the changes in reader coil voltage, the data
transmitted from the device can be reconstructed.
igure
The reader is the one of the key element in the system it is responsible for initiating
the operation of the system.
The reader is a complete transponder, which implements all the important functions
for the system. It consists of a plastic tube that accommodates the read only integral circuit
(IC) and the antenna realized by the LC circuit.
The identifying data are stored in the 128-bit PROM realized as an array of laser
programmable fuses. The data are sent bit serially as a code.
Table 1: FEATURES
The block diagram shown below describes a typical application circuit. The circuit is
similar to circuits employed it RFID systems, the card and the reader interaction shown. The
frequency of operation is selected by tuning the reader by means of the LC circuit.
CHAPTER 2
Administering access to resources means controlling both physical access and logical
access, either as independent efforts or through an integrated approach. The Physical access
control protects both tangible and intellectual assets from theft or compromise. Logical
access control enables enterprises and organizations to limit access to data, networks and
workstations to those authorized to have such access.
2.1 OVERVIEW OF THE RFID BASED ACCESS CONTROL SYSTEM
• ID credential
• Door reader
• Door lock
• Control panel
• Access control server
• Software
• Database
The access control process begins when the user presents the card to the reader,
which is usually mounted next to a door or entrance portal. The reader extracts data from the
card, processes it and sends it to the control panel.
The control panel first validates the reader and then accepts the data transmitted by
the reader. What happens next depends on whether the system is centralized or distributed.
In a centralized system, the control panel transmits the data to the access control
server. The access control server compares the data received from the card with the
information about the user that is stored in a database. Access control software determines
the user’s access privileges and authorization, the time, date and door entered, and any other
information that a company may require to ensure security. When access is authorized, the
access control sever sends a signal to the control panel to unlock the door. The control panel
then sends out a signal to the appropriate door lock, which unlocks the door.
In a distributed system, the control panel allows or denies entry. The access control
server periodical provides control panels with data that enable the control panel software to
determine whether the user is authorized for access. The control panel then performs the
access control server functions described above and makes the decision to allow or deny
entry. Enabling control panels to perform the decision function has the advantage of
requiring less communication between the control panels and a central access control server.
ID credential
A number of different id technologies are currently in use for access control:
magnetic stripe, wiegand strips, barium ferrite, 125 kHz proximity card technology, contact
smart cards and contact less smart cards.
Some credential technologies are read only. Information is permanently recorded on
the credential and when the credential is presented to a reader the information is send to the
system. This type of credential only validates that the information is authentic. It does not
confirm that the person presenting the credential is the person authorized to possess it.
DOOR READER
The door reader can have one or more interfaces, accommodating some combination
of both the contact less card and the pin pad. How the reader responds depends on the type of
credential presented and the organization security policy.
When the reader is used with a contact less card, it acts as a small, allow power radio
transmitter and receiver, constantly transmitting an RF field called an excite field. When the
card is within the range of the excite field, the internal antenna on the card converts the field
energy into electricity that powers the chip on the card. The chip then uses the antenna to
transmit data to the reader.
When the reader has received all required data, it typically processes the information
in one of the two ways. Either the information is immediately sent to the control panel, or the
reader analyzes the data before sending it to the control panel. Both methods are widely
deployed.
The simplest readers send data directly to the control panel. These readers do nothing
to evaluate the data or determine the legitimacy of the credential. These readers are typically
one-factor readers and are generic, so that they can be stocked in inventory and easily added
to or swapped out of an access control system.
Readers that analyze data must be integrated into the access control system. That is,
they must interpret and manipulate the data sent by the card and then transmit the data in a
form that is usable by the control panel. Such a system can offer an increased level of
security. The reader can determine the legitimacy of the card, compare it with the PIN entry
and manipulate the credential data so that what the reader sends to the control; panel is not
the same as what was read from the card. The process of authenticating the card to the reader
and the reader to the card is called mutual authentication.
CONTROL PANEL
The control panel (often referred to as the controller or simply the panel) is the central
communication point for the access control system. It typically supplies power to the
interfaces with multiple readers at different access points. The controller connects to the
electro-mechanical door lock, a relay switch in our project. It can be connected to different
alarms (example – Buzzer, sirens, lights). And finally the control panel is usually controlled
to an access control server.
Depending on the system design, the control panel may process data from the card
reader and the access control server and make the final authorization decision, or it may pass
the data to the access control server to make this decision. Typically, the control panel makes
the decision to turn ON the relay and pass the transaction data to the host computer and
unlocking signal to the reader. It is important for the control panel to generate the unlocking
signal, since the control panel is located inside the facility or in a secure room, while the card
reader is located in an insecure or open area.
Finally, the control panel stores data format information. This information identifies
what portion of the data stream received from a card is used to make access control
decisions. Cards and readers implemented with different technologies can exchange data in
different formats. However, the control panel needs to know how to interpret and process this
data. For example, if a reader sends 35 bits of data and the control panel is designed to read
only 26 bits, the panel must either reject the data or truncate 9 bits. The data format control
how the panel interprets received data.
The head – end system (also referred to as back-end system or host system) includes
the access control server, software and a database. The database contains updated
information on users’ access rights.
In a centralized system, the access control sever receives the card data from the
control panel. The software correlates the card data with the data in the database, determines
the person’s access privileges, and indicates whether the person can be admitted.
Most systems are decentralized. In a decentralized system, the access control server
periodically sends updated access control information to the control panels and allows them
to operate independently, making the authorization decision for the credential presented
based on data stored in the panel.
The access control systems data format is a critical design element. Data format refers
to the bit pattern that the reader transmits to the control panel. The format specifies how
many bits make up the data stream and what these bits represent. For example, the first few
bits represent the facility code, the next few a unique credential ID number, the next few
parity and so on.
Each access control system has its own format, making every vendor’s code unique.
Like the pattern of teeth on a door key, the formats are kept secret to prevent an unauthorized
person or company from duplicating a card.
OPERATIONAL RANGE
One important characteristic of access control system operation is the distance from
the reader at which the credential is effective (called the operational range).
The operational range is determined by many factors, including both the system’s
design specifications and the environment in which the reader is placed. Factors that affect
the operational range are:
• Antenna shape
• Number of antenna turns
• Antenna material
• Surrounding materials
• Credential orientation to the reader
• Electrical parameters of the chip
• Anti-collision features
• Field strength of the reader
BLOCK DIAGRAM
COMPONENTS SETUP
The system is constructed by means of the following major components.
USER SECTION
The users, say employees in an organization are provided with the 125 kHz RFID
cards. The user has to flash his card to the reader; the reader in turns detects the card and
checks for the authenticity. If the card is genuine, it prompts the user to enter his password.
The user can enter the password by means of the keypad provided near the reader. If the
password is accepted the door is unlocked and the user is provided access.
This section is about the AT89S52 Micro controller. The coding as per the desired
operation is programmed onto the flash memory of the chip. Hence once the reader detects
the card, and when the user enters the password it reaches the controller. The controller in
turn forwards it to the PC by means of the RS 232 cable interface provided. If the details are
genuine, the PC sends Ok signal to the controller to unlock the door for the user to enter.
A server stores all the details pertaining to the users. The details are initially fed onto
the server database before the cards are issued. Hence each user is allocated a with a definite
access rights as per the requirements. Further when an user gains access after all the
authentication process, the details that pertain to the involved access operation such as date &
time of entry, door entered, etc; are all stored. Thus details of all those who gain entry are
stored. These details can be retrieved at a future point of time for any processing.
The database for the users is created using MS access and for the processing
operations Visual basic 6 is used in our Project.
Power supply:
The power supply is of two ranges, +5V for the micro controller and +12 V for the
relay switch. This was constructed using 7805 and 7812 IC s respectively. They are provided
with a 9-0-9 V and a 15-0-15 V step-down transformer. After filter circuits, they are given to
the respective components.
LCD:
A 16 X 2 LCD module is used for the display. The LCD is connected to the micro
controller for displaying any text to the user. A potentiometer is used to vary the brightness
of the LCD display.
Keypad:
A 3 X 4 matrix keypad is provided for the user to enter the password, when requested
by the controller. It is interfaced to the Port D of the controller.
Oscillator:
Relay:
The relay is used to open or close the door. In our project, it is used to switch on a
230 V powered AC electric lamp. The relays are driven using driver circuits. These relays
energize on a signal from the controller. The two electric lamps signify the opening and
closing of an electronic door.
MICROCONTROLLER (AT89S52)
The basic criteria for choosing a microcontroller suitable for the application are:
1) The first and foremost criterion is that it must meet the task at hand efficiently and cost
effectively. In analyzing the needs of a microcontroller-based project, it is seen whether an
8- bit, 16-bit or 32-bit microcontroller can best handle the computing needs of the task
most effectively. Among the other considerations in this category are:
(a) Speed: The highest speed that the microcontroller supports.
(b) Packaging: It may be a 40-pin DIP (dual inline package) or a QFP (quad
flat package), or some other packaging format. This is important in terms of space,
assembling, and prototyping the end product.
(c) Power consumption: This is especially critical for battery-powered
products. (d) The number of I/O pins and the timer on the chip.
(f) How easy it is to upgrade to higher –performance or lower consumption
versions. (g) Cost per unit: This is important in terms of the final cost of the
product in which a microcontroller is used.
2) The second criterion in choosing a microcontroller is how easy it is to develop products
around it. Key considerations include the availability of an assembler, debugger, compiler,
technical support.
3) The third criterion in choosing a microcontroller is its ready availability in
needed quantities both now and in the future. Currently of the leading 8-bit
microcontrollers, the
8051 family has the largest number of diversified suppliers. By supplier is meant a
producer besides the originator of the microcontroller. In the case of the 8051, this has
originated by Intel several companies also currently producing the 8051.
Thus the microcontroller AT89S52, satisfying the criterion necessary for the proposed
application is chosen for the task.
4.4.2
DESCRIPTION:
4.4.3
FEATURES:
The basic architecture of AT89C51 consists of the following features:
• Compatible with MCS-51 Products
• 8K Bytes of In-System Programmable (ISP) Flash Memory
• 4.0V to 5.5V Operating Range
• Fully Static Operation: 0 Hz to 33 MHz
• 256 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Three 16-bit Timer/Counters
• Eight Interrupt Sources
• Full Duplex UART Serial Channel
• Low-power Idle and Power-down Modes
• Interrupt Recovery from Power-down Mode
• Watchdog Timer
• Fast Programming Time
• Flexible ISP Programming (Byte and Page Mode)
• Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each
pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be
used as high-impedance inputs. Port 0 can also be configured to be the multiplexed
low-order address/data bus during accesses to external program and data memory.
In this mode, P0 has internal pull-ups.
• Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The
Port 1 output buffers can sink/source four TTL inputs. When 1s are written to
Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs.
As inputs, Port
1 pins that are externally being pulled low will source current (IIL) because of the
internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the
timer/counter
2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX),
respectively, as shown in the following table.
• Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The
Port 2 output buffers can sink/source four TTL inputs. When 1s are written to
Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs.
As inputs, Port
2 pins that are externally being pulled low will source current (IIL) because of the
internal pull-ups. Port 2 emits the high-order address byte during fetches
from external program memory and during accesses to external data memory that
use 16- bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong
internal pull- ups when emitting 1s. During accesses to external data memory that
uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2
Special Function register.
• Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The
Port 3 output buffers can sink/source four TTL inputs. When 1s are written to
Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs.
As inputs, Port
3 pins that are externally being pulled low will source current (IIL) because of the pull-
ups. Port 3 receives some control signals for Flash programming an verification.
M
Port 3 also serves the functions of various special features of the AT89S52, as
shown in the following table.
• RST: Reset input. A high on this pin for two machine cycles while the
oscillator is running resets the device. This pin drives high for 98 oscillator
periods after the watchdog times out.
In order for the RESET input to be effective, it must have a minimum duration of
two machine cycles.
• ALE/PROG: Address Latch Enable (ALE) is an output pulse for latching
the low byte of the address during accesses to external memory. This pin is also
the program pulse input (PROG) during Flash programming. In normal
operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and
may be used for external timing or clocking purposes. Note, however, that one
ALE pulse is skipped during each access to external data memory. If
desired, ALE operation can be disabled by setting bit 0 of SFR location
8EH. With the bit set, ALE is active only during a MOVX or MOVC
instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable
bit has no effect if the microcontroller is in external execution mode.
• XTAL1: Input to the inverting oscillator amplifier and input to the internal
clock operating circuit.
C2
XTAL2
30pF
C1
XTAL1
30pF
GN D
The Special Function Registers (SFRs) contain memory locations that are used
for special tasks. Each SFR occupies internal RAM from 0x80 to 0xFF.They are 8-bits
wide.
• Register B is used for multiplication & division and can also be used for
general purpose storage.
• Stack Pointer (SP) register is eight bits wide. It is incremented before data
is stored during PUSH and CALL executions. While the stack may reside
anywhere in on-chip RAM, the Stack Pointer is initialized to 07H after a
reset. This causes the stack to begin at location 08H.
• Control Registers: Special Function Registers IP, IE, TMOD, TCON, SCON,
and PCON contain control and status bits for the
interrupt system, the Timer/Counters, and the serial port.
• Timer Registers: Register pairs (TH0, TL0) and (TH1, TL1) are the 16-
bit
Counter registers for Timer/Counters 0 and 1, respectively.
MCS-51 devices have a separate address space for Program and Data Memory. Up
to
64K bytes each of external Program and Data Memory can be
addressed.
• Data Memory: The AT89S52 implements 256 bytes of on-chip RAM. The
upper
128 bytes occupy a parallel address space to the Special Function Registers.
This means that the upper 128 bytes have the same addresses as the SFR space
but are physically separate from SFR space. When an instruction accesses an
internal location above address 7FH, the address mode used in the instruction
specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR
space. Instructions which use direct addressing access the SFR space. The
lower 128
bytes of RAM can be divided into three
egments:
1. Register Banks 0-3: locations 00H through 1FH (32 bytes). The device after
reset defaults to register bank 0. To use the other register banks, the user must
select them in software. Each register bank contains eight 1-byte registers R0-R7.
Reset initializes the stack point to location 07H, and is incremented once to start
from 08H, which is the first register of the second register bank.
2. Bit Addressable Area: 16 bytes have been assigned for this segment 20H-
2FH. Each one of the 128 bits of this segment can be directly addressed (0-7FH).
Each of the 16 bytes in this segment can also be addressed as a byte.
3. Scratch Pad Area: 30H-7FH are available to the user as data RAM.
However, if the data pointer has been initialized to this area, enough bytes should
be left aside to prevent SP data destruction.
M
Reset (WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable
the
WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR
location
0A6H). When the WDT is enabled, it will increment every machine cycle while the
oscillator is running. The WDT timeout period is dependent on the external clock
frequency. There is no way to disable the WDT except through reset (either hardware
reset or WDT overflow reset). When WDT over-flows, it will drive an output RESET
HIGH pulse at the RST pin.
TIMER MODE-3: In mode-3, timer-1 simply hold its count, where as timer 0 registers
TL0 and TH0 are used as two separate 8-bit counters. TL0 uses the Timer-0 control
bits. TH0 counts machine cycles and takes over the use of TR1 and TF1 from Timer-1.
4.4.11
INTERRUPTS
A computer has only two ways to determine the conditions that exist in internal
and external circuits. One method uses software instructions that jump to subroutines
on the states of flags and port pins. The second method responds to hardware
signals, called interrupts that force the program to call a subroutine.
The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and
INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. Each of
these interrupt sources can be individually enabled or disabled by setting or clearing
a bit in Special Function Register IE. IE also contains a global disable bit, EA, which
disables all interrupts at once.
Each interrupt forces the processor to jump at the interrupt location in the
memory. The interrupted program must resume operation at the instruction where the
interrupt took place. Program resumption is done by storing the interrupted PC address on
to stack.
RETI instruction at the end of ISR will restore the PC
address.
The microcontroller is interfaced with the ADC in polling mode. INT0 is used for
the
LCD mode selection switch in order to switch between two modes of display:
1) Sensor output display
2) Actuator status display
Port details:
• Port 0: Interfaced with the LCD data lines.
• Port 1: Interfaced with the ADC data lines
• Port 2: Interfaced with the LCD Control lines and AC Interface control
• Port 3: Interfaced with the ADC control lines
LIQUID CRYSTAL DISPLAY
A liquid crystal display (LCD) is a thin, flat display device made up of any number
of color or monochrome pixels arrayed in front of a light source or reflector. Each pixel
consists of a column of liquid crystal molecules suspended between two transparent
electrodes, and two polarizing filters, the axes of polarity of which are perpendicular to
each other. Without the liquid crystals between them, light passing through one would
be blocked by the other. The liquid crystal twists the polarization of light entering one
filter to allow it to pass through the other.
Many microcontroller devices use 'smart LCD' displays to output visual
information. LCD displays designed around Hitachi's LCD HD44780 module, are
inexpensive, easy to use, and it is even possible to produce a readout using the 8x80
pixels of the display. They have a standard ASCII set of characters and mathematical
symbols.
For an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-
bit data bus it only requires the supply lines plus seven extra lines. When the LCD display
is not enabled, data lines are tri-state and they do not interfere with the operation of the
microcontroller.
Data can be placed at any location on the LCD. For 16×2 LCD, the address
locations
are:
A relay is an electrical switch that opens and closes under the control of another
electrical circuit. In the original form, the switch is operated by an electromagnet to open
or close one or many sets of contacts. It was invented by Joseph Henry in 1835. Because
a relay is able to control an output circuit of higher power than the input circuit, it can be
considered
to be, in a broad sense, a form of an electrical amplifier.
Fig. 4.26 Sugar cube
relay
Since relays are switches, the terminology applied to switches is also applied
to relays. A relay will switch one or more poles, each of whose contacts can be thrown by
energizing the coil in one of three ways:
1.Normally - open (NO) contacts connect the circuit when the relay is activate d; the
circuit is disconnected when the relay is inactive. It is also called a FORM A contact or
“make” contact.
2.Normally - closed (NC) contacts disconnect the circuit when the relay is activated ; the
circuit is connected when relay is inactive. It is also called FORM B contact or”
break” contact
• SPST - Single Pole Single Throw: These have two terminals which can be
connected or disconnected. Including two for the coil, such a relay has four
terminals in total. It is ambiguous whether the pole is normally open or normally
closed. The terminology "SPNO" and "SPNC" is sometimes used to resolve the
ambiguity.
• SPDT - Single Pole Double Throw: A common terminal connects to either of
two others. Including two for the coil, such a relay has five terminals in total.
• DPST - Double Pole Single Throw: These have two pairs of terminals. Equivalent
to two SPST switches or relays actuated by a single coil. Including two for the coil,
such a relay has six terminals in total. It is ambiguous whether the poles are
normally open, normally closed, or one of each.
• DPDT - Double Pole Double Throw: These have two rows of change-over
terminals.
Equivalent to two SPDT switches or relays actuated by a single coil. Such a relay
has eight terminals, including the coil.
• QPDT - Quadruple Pole Double Throw: Often referred to as Quad Pole Double
Throw, or 4PDT. These have four rows of change-over terminals. Equivalent to
four SPDT switches or relays actuated by a single coil, or two DPDT relays. In
total, fourteen terminals including the coil.
MONITOR AND CONTROL OF GREENHOUSE ENVIRONMENT
When it is low, data is written to the LCD. When it is high, data is read from
the
LCD.
3) Register select (RS)
With the help of this line, the LCD interprets the type of data on data lines. When it
is low, an instruction is being written to the LCD. When it is high, a character is being
written to the LCD.
4.5.1.1 Logic status on control lines:
• E - 0 Access to LCD
disabled
- 1 Access to LCD enabled
• R/W - 0 Writing data to LCD
- 1 Reading data from
LCD
• RS - 0 Instruction
- 1 Character
4.5.1.2 Writing and reading the data from the LCD:
Writing data to the LCD is done in several steps:
1) Set R/W bit to low
2) Set RS bit to logic 0 or 1 (instruction or character)
3) Set data to data lines (if it is writing)
4) Set E line to high
5) Set E line to low
Read data from data lines (if it is reading):
1) Set R/W bit to high
2) Set RS bit to logic 0 or 1 (instruction or character)
3) Set data to data lines (if it is writing)
4) Set E line to high
5) Set E line to low
BUZZER:
4.7 RELAYS
A relay is an electrical switch that opens and closes under the control of another
electrical circuit. In the original form, the switch is operated by an electromagnet to open
or close one or many sets of contacts. It was invented by Joseph Henry in 1835. Because
a relay is able to control an output circuit of higher power than the input circuit, it can be
considered
to be, in a broad sense, a form of an electrical amplifier.
Since relays are switches, the terminology applied to switches is also applied
to relays. A relay will switch one or more poles, each of whose contacts can be thrown by
energizing the coil in one of three ways:
1.Normally - open (NO) contacts connect the circuit when the relay is activate d; the
circuit is disconnected when the relay is inactive. It is also called a FORM A contact or
“make” contact.
2.Normally - closed (NC) contacts disconnect the circuit when the relay is activated ; the
circuit is connected when relay is inactive. It is also called FORM B contact or”
break” contact
• SPST - Single Pole Single Throw: These have two terminals which can be
connected or disconnected. Including two for the coil, such a relay has four
terminals in total. It is ambiguous whether the pole is normally open or normally
closed. The terminology "SPNO" and "SPNC" is sometimes used to resolve the
ambiguity.
• SPDT - Single Pole Double Throw: A common terminal connects to either of
two others. Including two for the coil, such a relay has five terminals in total.
• DPST - Double Pole Single Throw: These have two pairs of terminals. Equivalent
to two SPST switches or relays actuated by a single coil. Including two for the coil,
such a relay has six terminals in total. It is ambiguous whether the poles are
normally open, normally closed, or one of each.
• DPDT - Double Pole Double Throw: These have two rows of change-over
terminals.
Equivalent to two SPDT switches or relays actuated by a single coil. Such a relay
has eight terminals, including the coil.
• QPDT - Quadruple Pole Double Throw: Often referred to as Quad Pole Double
Throw, or 4PDT. These have four rows of change-over terminals. Equivalent to
four SPDT switches or relays actuated by a single coil, or two DPDT relays. In
total, fourteen terminals including the coil.
The power supply section consists of step down transformers of 230V primary to
9V and 12V secondary voltages for the +5V and +12V power supplies respectively. The
stepped down voltage is then rectified by 4 1N4007 diodes. The high value of capacitor
1000 µF charges at a slow rate as the time constant is low, and once the capacitor charges
there is no resistor for capacitor to discharge. This gives a constant value of DC. IC 7805
is used for regulated supply of +5 volts and IC 7812 is used to provide a regulated supply
of +12 volts in order to prevent the circuit ahead from any fluctuations. The filter
capacitors connected after this IC filters the high frequency spikes. These capacitors
are connected in parallel with supply and common so that spikes filter to the common.
These give stability to the power supply circuit.
As can be seen from the above circuit diagrams, the rectified voltage from
the 4 diodes is given to pin 1 of the respective regulators. Pin 2 of the regulators is
connected to ground and pin 3 to Vcc. With adequate heat sinking the regulator can
deliver 1A output current. If internal power dissipation becomes too high for the heat
sinking provided, the
thermal shutdown circuit takes over preventing the IC from overheating.
1
Vin 7805 Vout
GND
2
1000
230V, uf 10 1uf
50Hz uf
Fig. 4.29 +5V Power supply circuit
APPLICATIONS
The RF Identification is finding its application in many fields and some of them are
described briefly below:
Pay-roll calculation:
The employees’ in time and out time can be noted and their attendance can be
maintained. This in turn helps in calculating the salary that they have to get for the last month.
Human checking:
When somebody has to be traced inside a building, it can be done with the information
about the location he/she had recently checked-in inside the building. Also, in case of closing the
gate for the day, accidental or deliberate presence of a person can be found by noting the
employees’ checkout information.
This is the application that our project is mainly focused on. In this, the employees are
given access only into certain places inside the building and are restricted from entering into
certain other places demanding security. In any company, there are some restricted locations,
where permission is given only to employees of certain cadre or skill level. The others are
incompetent either on the ground of their cadre or their knowledge about the components and
equipments or objects, present in the location. RF ID provides a good solution to this
application.
"Proximity cards are one of the highest forms of ID, and are considered very secure. But
they can still be used for buddy punching," says Jimmy Bianco, Vice President of sales and
marketing for Control Module Inc.
So, apart from the card, a keypad is provided for entering the password, which is checked
for authenticity. So, this second level of security provides a complementary solution to the
access control inside the building.
The application provides an excellent example of how the technology can provide a
secure foundation upon which additional applications can be built.
OTHER APPLICATIONS
Vehicle Identification
Commercial trucks are fitted with RFID systems to monitor access and egress from
terminal facilities by fixing the RF ID tags in the vehicles.
This can also be used for ships entering the harbor. This helps in maintaining record of
the vehicles that have entered and left.
Industrial Monitoring
In the plant environment, RF systems are ideally suited for the identification of high-
unit-value products moving through a tough assembly process (e.g., automobile or agricultural
equipment production where the product is cleaned, bathed, painted and baked). RF systems also
offer the durability essential for permanent identification of captive product carriers such as:
Tote boxes, containers, barrels, tubs, pallets, tool carriers, and free conveyor trolleys, lift
trucks, towline carts, and automatic guided vehicles.
This avoids the necessity of human beings having a watch over the products entering
various places, especially those having risk.
Animal Identification
Valuable breeding stock, laboratory animals involved in lengthy and expensive research
projects, meat and dairy animals, wildlife, and even prized companion animals present unique
identification problems that can be solved by innovative applications of RFID technology. They
can be monitored for their position in the breeding place, zoo, and other places.
CONCLUSION
The implementation of RFID based system in access control and security operations are
bound to increase in the future. The advantages, efficiency and reliability of the system have
made it manifest itself over the existing systems. The system achieves a two level security
making the incorporating firm more secure.
Further this system is compatible for the future upgradations like a Finger print scanner,
retina scanner, monitoring camera, etc. making it more versatile. With the introduction of more
smart RFID devices in the near future the system is going to rule the field of access control and
security.
CHAPTER 4
APPENDICES
APPENDIX 1
26.5mm
6.9mm
16.5mm
K4
123456789
ASCII( RS232) :
※Pin3 Strap to +5
Pin8 Ground 0V
Checksum 为二进制格式数据
PIN6
Start Bit Bit0 Bit1 Bit7 StopBit
Pin8 Ground 0V
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
P(1) E E E E E E E E E E E E O O O O O O O O O O O O P(2)
EVEN Parity(E) ODD Parity(O)
P(1)=Parity Start Bit,第 1 位为 2—13 位的偶校验位。
Bit23=0: D0=0,D1=1
(c) 输出波形
50us 1ms
DATA1
DATA0
1 0 0
1 1
MSB LSB
K4 Annte: