Sei sulla pagina 1di 89

RFID BASED ATTENDANCE SYSTEM

A
Mini Project Report
Submitted in the Partial Fulfillment of the
Academic Requirements
For the Award of the Degree of

Bachelor of Technology
in
Electronics and Communication Engineering
By
JAINA SAI SHANKER 16AG1A0414
JOSHNA SINDHU 16AG1A0473
JOEL FEDRICK 16AG1A04A5
Under the esteemed guidance of

Mrs.Usha Rani
Assistant Professor

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING


ACE ENGINEERING COLLEGE
Ankushapur(V),Ghatkesar(M),Medchal-Malkajgiri Dist-501301

2019-2020

i
ACE Engineering College
(Sponsored by Yadala Satya Narayana Memorial Educational Society,Hyderabad)

Approved by AICTE & Affiliated to JNTUH, Accredited by NAAC

NBA Accredited B. Tech courses: EEE, ECE &CSE

Ankushapur(V),Ghatkesar(M),Medchal Dist-501301

Certificate
This is to certify that the thesis titled RFID BASED ATTENDANCE
SYSTEM submitted to the ACE ENGINEERING COLLEGE,affiliated
to JNTU-Hyderabad by J. Sai Shanker , Joshna Sindhu and Joel
Fedrick is a bonafide record of the work done by the students towards
partial fulfillment of requirements for the award of the degree of Bachelor
of Technology in Electronics & Communication Engineering.

Head of the
Supervisor Department

Mrs. Usha Rani Dr. V.S.S.N.Srinivasa Baba


Assistant Prof. Head of Department
Dept. of ECE Dept. of ECE

Place:
Date:

ii
Acknowledgement

The satisfaction that accompanies the successful completion of any task would
be incomplete without the mention of the people who made it possible and whose
encouragement and guidance has been a source of inspiration throughout the course
of the project.

It is great pleasure to convey our profound sense of gratitude to our principal


Dr.B.L.Raju Sir, Dr.V.S.S.N.Srinivasa Baba Sir,Head of the ECE Department,
ACE Engineering Collegen for having been kind enough for arranging the necessary
facilities for executing the project in the college.

We would like to express our sincere gratitude to our guide, Mrs. Usha Rani
Assistant Professor ECE Dept, Ace Engineering College, whose guidance and
valuable suggestions have been indispensable to bring about the successful completion
of our project.

We wish to acknowledge special thanks to the Project Coordinators for


assessing seminars, inspiration, moral support and giving us valuable suggestions in our
project.

We would also like to express our gratitude to all the staff members and lab
faculty, department of Electronics and Communication Engineering, Ace Engineering
College for the constant help and support.

We wish a deep sense of gratitude and heartfelt thanks to management for


providing excellent lab facilities and tools. Finally, we thank all those whose
guidance helped us in this regard.

iii
Abstract
The main objective of this project is to record the attendance of students using RFID tags.
Each student is provided with his/her authorized tag to swipe over the reader to record their
attendance.

In classrooms, time is wasted in roll calls as it is done manually. In this proposed system,
authorized student is given an RFID tag. Thus, the data stored in this card is referred as the
identification/attendance of the person. Once the student places the card in front of the RFID card
reader, it reads the data and verifies it with the data stored in the microcontroller from 8051 family.
If the data matches, then it displays a message on the LCD confirming the entry of that student else
displays a message denying the attendance.

The status of a student’s attendance can be retrieved from this system by pressing the status
button interfaced to the microcontroller. Hence, a lot of time is saved as all the students attendance
is directly stored in the data base. The project can be further enhanced by adding features like send
by using a finger print module in place of RFID module that has certain drawbacks of tags be
misused.
KEYWORDS:
 RFID tags
 Scanning Technology
 8051 Microcontroller
 LCD
 Time Management

Roll Number and Name of the student : Signature of the Guide :

J.Sai Shanker(16AG1A0414)

Joshna Sindhu(16AG1A0473)

Joel Fedrick(16AG1A04A5)

iv
TABLE OF CONTENTS
ACKNOWLEDGEMENT iii

ABSTRACT iv

CONTENTS v

TOPIC Page no.

CHAPTER 1

1 INTRODUCTION 1
1.1 INTRODUCTION 1
1.2 OBJECTIVE 1
1.3 THESIS ORGANISATION 2
1.4 CONCLUSION 2

CHAPTER 2

HARDWARE DESCRIPTION

2.1 INTRODUCTION 3

2.2 POWER SUPPLY 4

2.1.1 Introduction 4
2.1.2 Circuit Explanation 5
2.1.3 Conclusion 13

2.3 LIGHT EMITTING DIODE 14

2.3.1 Introduction 14
2.3.2 Basic Principle 14
2.3.3 Types 15
2.3.4 Applications 18
2.3.5 Conclusion 19

v
vi
2.4 RFID 19
2.4.1 Introduction 19
2.4.2 RFID Transponder/Tag 20
2.4.3 RFID Reader 21
2.4.4 Applications 23
2.4.5 Conclusion 23

2.5MICROCONTROLLER 23
2.5.1 Introduction 23
2.5.2 Features 24
2.5.3 Description 25
2.5.4 Conclusion 38

2.6 CRYSTAL OSCILLATOR 38


2.6.1 Introduction 38
2.6.2 Conclusion 40

2.7 MAX232 40
2.7.1 Introduction 40
2.7.2 Features 41
2.7.3 Conclusion 42

2.8 LIQUID CRYSTAL DISPLAY 42


2.8.1 Introduction 42
2.8.2 Features 43
2.8.43Conclusion 51

CHAPTER 3 52

SOFTWARE DESCRIPTION 53

CHAPTER 4 78

ADVANTAGES AND APPLICATIONS 78

4.1 Advantages 78

4.2 Applications 78

CHAPTER 5 79

vii
RESULT 79

CHAPTER 6 79

REFERENCES 79

LIST OF FIGURES

1.Circuit diagram of RFID based attendance system 4

2.Circuit explanation 5

3.Simplified transformer design 6

4.Transformer circuit 7

5.Input and output waveforms of rectifiers 10

6.Bridge rectifier with smoothing 11

7.Internal block diagram of voltage regulator 13

8.Push button 13

9.LED working 15

10.LED types 16

11.Working of RFID 20

12.RFID tag 20

13.RFID reader 22

14.Description of microcontroller 89S52 26

15.Pin description of 89S52 27

16.Oscillator characteristics 31

17.Crystal oscillator 39

18.MAX232 41

viii
19.Address location for 1*16 LCD 44

20.LCDs 44

21.Electrical block diagram of LCD 45

22.Power supply for LCD driving 45

23.Pin diagram of 2*16 lines LCD 46

24.LCD initialisation 50

25.LCD flowchart 51

26.Step 1(Software) 53

27.Step 2(Software) 53

28.IC selection 54

29.Ensuring oscillator frequency 55

30.Options for target 55

31.Building the target 56

32.Debugging 57

33.Viewing peripherals 57

34.Viewing port1 58

35.Periodic window update flag 58

36.Debug-Go 59

37.Performance analyser step 1 60

38.Performance analyser step 2 60

39.Performance analyser step 3 61

40.Performance analyser step 4 61

ix
LIST OF TABLES

1.Port 1 functions 25

2.Port 3 functions 29

3.Bits in IE register 33

4.TCON register 37

5.TMOD register 38

6.LCD functions 46

ix

0
CHAPTER 1

INTRODUCTION

1.1 INTRODUCTION:

Our project consists of an RFID based attendance system that allows for
automatic attendance marking by using RFID tags. Every student is provided with a
unique authorization tag/card that is used to record his/her attendance.

A lot of time is wasted in schools and colleges for manual attendance procedures,
in such cases our system provides an instant and automated attendance marking system.
Every authorized student is provided with a unique RFID tag/card with his/her details fed
in it. The tag consists of a built in integrated circuit that stores this data through modulating
and demodulating transmitted radio frequency signals.

The data thus stored in this card is the unique identification of that person. As soon
as the card is placed in front of the RFID reader, the data in it is read and attendance for
that student is registered. This is done with the help of a microcontroller interfaced with
the reader.If it is a registered student, then a confirmation is displayed on an LCD screen,
else a rejection message is shown that denies the attendance.

1.2 OBJECTIVE:

The main objective of the system is to uniquely identify and to make


attendance for a person. This requires a unique product, which has the capability of
distinguishing different person. This is possible by the new emerging technology
RFID (Radio Frequency Identification).

All student attendance status can be later obtained from the system when the
status button interfaced with the microcontroller is pressed. This saves a lot of time
and effort in student attendance registration.

1
1.3 THESIS ORGANISATION
The thesis explains the implementation of “RFID Based Attendance System”.
The organization of the thesis is explained here with:
Chapter 1 Presents introduction to the overall thesis and the overview of the
project. In the project overview a brief introduction “RFID Based Attendance
System” is discussed.
Chapter 2 Presents the hardware description. It deals with the block diagram of the
project and explains the purpose of each block. In the same chapter the explanation of
Power Supply, Liquid Crystal Display(LCD), RFID Reader, RFID tags,
Microcontroller(89S52), MAX 232 are considered. Chapter 3 Presents the software
description.
Chapter 4 Presents the advantages and applications of the project.
Chapter 5 Presents the results, conclusion and future scope of the project.
Chapter 6 Presents the references.

1.4 CONCLUSION
Here, the objective and main aspects of the project are discussed.

2
CHAPTER 2

HARDWARE DESCRIPTION

2.1 INTRODUCTION WITH BLOCK DIAGRAM

The main components required in this project are:


Power supply

Liquid Crystal Display(LCD)

RFID Reader

RFID tags

Microcontroller(89S52)

MAX 232

Working
When a person put their RFID tag to RFID reader then RFID reads tag’s data and send it
to 8952 microcontroller and then microcontroller compares this data with defined data or
information. If data is matched with defined data then microcontroller increment the attendance
by one of the tag’s person and if matched is not occurred then microcontroller shows invalid card
on LCD and buzzer is beeping continuously for some time.

3
Figure 1: Circuit diagram for RFID based attendance system
Circuit diagram for RFID based attendance system project is shown above. In the
circuit, LCD is connected in four bit mode with 8051 microcontroller. LCD’s RS, RW and EN
pins are directly connected at PORT 1 pin number P1.0, P1.1 and P1.2. D4, D5, D6 and D7 pins
of LCD are directly connected at pin P1.4, P1.5, P1.6 and P1.7 of port 1. Motor driver is
connected at PORT pin number P2.4 and P2.5. and buzzer is connected at P2.6 at PORT2.

2.2 POWER SUPPLY

2.2.1 Introduction

Power supply is a reference to a source of electrical power. A device or system that


supplies electrical or other types of energy to an output load or group of loads is called
a power supply unit or PSU. The term is most commonly applied to electrical energy
supplies, less often to mechanical ones, and rarely to others

This power supply section is required to convert AC signal to DC signal and also to
reduce the amplitude of the signal. The available voltage signal from the mains is
230V/50Hz which is an AC voltage, but the required is DC voltage(no frequency) with
the amplitude of +5V and +12V for various applications.

In this section we have Transformer, Bridge rectifier, are connected serially and voltage
regulators for +5V and +12V (7805 and 7812) via a capacitor (1000µF) in parallel are
connected parallel as shown in the circuit diagram below. Each voltage regulator output is
again is connected to the capacitors of values (100µF, 10µF, 1 µF, 0.1 µF) are

4
connected parallel through which the corresponding output(+5V or +12V) are taken
into consideration.

Figure 2: Circuit explanation

2.2.2 Circuit Explanation

1) Transformer

A transformer is a device that transfers electrical energy from one circuit to another through
inductively coupled electrical conductors. A changing current in the first circuit (the primary)
creates a changing magnetic field; in turn, this magnetic field induces a changing voltage in the
second circuit (the secondary). By adding a load to the secondary circuit, one can make current
flow in the transformer, thus transferring energy from one circuit to the other.

The secondary induced voltage VS, of an ideal transformer, is scaled from the primary VP
by a factor equal to the ratio of the number of turns of wire in their respective windings:

Basic principle

The transformer is based on two principles: firstly, that an electric current can produce a
magnetic field (electromagnetism) and secondly that a changing magnetic field within a coil of
wire induces a voltage across the ends of the coil (electromagnetic induction). By changing the

5
current in the primary coil, it changes the strength of its magnetic field; since the changing
magnetic field extends into the secondary coil, a voltage is induced across the secondary.

A simplified transformer design is shown below. A current passing through the primary
coil creates a magnetic field. The primary and secondary coils are wrapped around a core of very
high magnetic permeability, such as iron; this ensures that most of the magnetic field lines produced
by the primary current are within the iron and pass through the secondary coil as well as the primary
coil.

Figure 3: Simplified transformer design

An ideal step-down transformer showing magnetic flux in the core

Induction law

The voltage induced across the secondary coil may be calculated from Faraday's law of
induction, which states that:

Where VS is the instantaneous voltage, NS is the number of turns in the secondary coil and
Φ equals the magnetic flux through one turn of the coil. If the turns of the coil are oriented
perpendicular to the magnetic field lines, the flux is the product of the magnetic field strength B
and the area A through which it cuts. The area is constant, being equal to the cross-sectional area
of the transformer core, whereas the magnetic field varies with time according to the excitation of

6
the primary. Since the same magnetic flux passes through both the primary and secondary coils in
an ideal transformer, the instantaneous voltage across the primary winding equals

Taking the ratio of the two equations for VS and VP gives the basic equation for stepping up
or stepping down the voltage

Ideal power equation

If the secondary coil is attached to a load that allows current to flow, electrical power is
transmitted from the primary circuit to the secondary circuit. Ideally, the transformer is perfectly
efficient; all the incoming energy is transformed from the primary circuit to the magnetic field and
into the secondary circuit. If this condition is met, the incoming electric power must equal the
outgoing power.

Pincoming = IPVP = Poutgoing = ISVS

giving the ideal transformer equation

Figure 4: Transformer circuit

Pin-coming = IPVP = Pout-going = ISVS

7
giving the ideal transformer equation

If the voltage is increased (stepped up) (VS > VP), then the current is decreased (stepped
down) (IS < IP) by the same factor. Transformers are efficient so this formula is a reasonable
approximation.

If the voltage is increased (stepped up) (VS > VP), then the current is decreased (stepped
down) (IS < IP) by the same factor. Transformers are efficient so this formula is a reasonable
approximation.

The impedance in one circuit is transformed by the square of the turns ratio. For example,
if an impedance ZS is attached across the terminals of the secondary coil, it appears to the primary
circuit to have an impedance of

This relationship is reciprocal, so that the impedance ZP of the primary circuit appears to
the secondary to be

Detailed operation

The simplified description above neglects several practical factors, in particular the primary
current required to establish a magnetic field in the core, and the contribution to the field due to
current in the secondary circuit.

Models of an ideal transformer typically assume a core of negligible reluctance with two
windings of zero resistance. When a voltage is applied to the primary winding, a small current
flows, driving flux around the magnetic circuit of the core. The current required to create the flux
is termed the magnetizing current; since the ideal core has been assumed to have near-zero
reluctance, the magnetizing current is negligible, although still required to create the magnetic
field.

The changing magnetic field induces an electromotive force (EMF) across each winding.
Since the ideal windings have no impedance, they have no associated voltage drop, and so the
voltages VP and VS measured at the terminals of the transformer, are equal to the corresponding
EMFs. The primary EMF, acting as it does in opposition to the primary voltage, is sometimes
termed the "back EMF". This is due to Lenz's law which states that the induction of EMF would
always be such that it will oppose development of any such change in magnetic field.

8
2) Bridge Rectifier

A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge configuration


that provides the same polarity of output voltage for any polarity of input voltage. When used in
its most common application, for conversion of alternating current (AC) input into direct current
(DC) output, it is known as a bridge rectifier. A bridge rectifier provides full-wave rectification
from a two-wire AC input, resulting in lower cost and weight as compared to a center-tapped
transformer design, but has two diode drops rather than one, thus exhibiting reduced efficiency
over a center-tapped design for the same output voltage.

Basic Operation

When the input connected at the left corner of the diamond is positive with respect to the
one connected at the right hand corner, current flows to the right along the upper colored path to
the output, and returns to the input supply via the lower one.

When the right hand corner is positive relative to the left hand corner, current flows along
the upper colored path and returns to the supply via the lower colored path.

9
In each case, the upper right output remains positive with respect to the lower right one.
Since this is true whether the input is AC or DC, this circuit not only produces DC power when
supplied with AC power: it also can provide what is sometimes called "reverse polarity protection".
That is, it permits normal functioning when batteries are installed backwards or DC input-power
supply wiring "has its wires crossed" (and protects the circuitry it powers against damage that
might occur without this circuit in place).

Prior to availability of integrated electronics, such a bridge rectifier was always constructed
from discrete components. Since about 1950, a single four-terminal component containing the four
diodes connected in the bridge configuration became a standard commercial component and is now
available with various voltage and current ratings.

Figure 5: Input and output waveforms of rectifier

Output smoothing (Using Capacitor)

For many applications, especially with single phase AC where the full-wave bridge serves
to convert an AC input into a DC output, the addition of a capacitor may be important because the
bridge alone supplies an output voltage of fixed polarity but pulsating magnitude (see diagram
above).

10
Figure 6: Bridge Rectifier with smoothing

The function of this capacitor, known as a reservoir capacitor (aka smoothing capacitor) is
to lessen the variation in (or 'smooth') the rectified AC output voltage waveform from the bridge.
One explanation of 'smoothing' is that the capacitor provides a low impedance path to the AC
component of the output, reducing the AC voltage across, and AC current through, the resistive
load. In less technical terms, any drop in the output voltage and current of the bridge tends to be
cancelled by loss of charge in the capacitor.

This charge flows out as additional current through the load. Thus the change of load
current and voltage is reduced relative to what would occur without the capacitor. Increases of
voltage correspondingly store excess charge in the capacitor, thus moderating the change in output
voltage / current. Also see rectifier output smoothing.

The simplified circuit shown has a well deserved reputation for being dangerous, because,
in some applications, the capacitor can retain a lethal charge after the AC power source is removed.
If supplying a dangerous voltage, a practical circuit should include a reliable way to safely
discharge the capacitor. If the normal load can not be guaranteed to perform this function, perhaps
because it can be disconnected, the circuit should include a bleeder resistor connected as close as
practical across the capacitor. This resistor should consume a current large enough to discharge the
capacitor in a reasonable time, but small enough to avoid unnecessary power waste.

Because a bleeder sets a minimum current drain, the regulation of the circuit, defined as
percentage voltage change from minimum to maximum load, is improved. However in many cases
the improvement is of insignificant magnitude.

The capacitor and the load resistance have a typical time constant τ = RC where C and R
are the capacitance and load resistance respectively. As long as the load resistor is large enough so
that this time constant is much longer than the time of one ripple cycle, the above configuration
will produce a smoothed DC voltage across the load.

11
In some designs, a series resistor at the load side of the capacitor is added. The smoothing
can then be improved by adding additional stages of capacitor–resistor pairs, often done only for
sub-supplies to critical high-gain circuits that tend to be sensitive to supply voltage noise.

The idealized waveforms shown above are seen for both voltage and current when the load on
the bridge is resistive. When the load includes a smoothing capacitor, both the voltage and the current
waveforms will be greatly changed. While the voltage is smoothed, as described above, current will
flow through the bridge only during the time when the input voltage is greater than the capacitor
voltage. For example, if the load draws an average current of n Amps, and the diodes conduct for 10%
of the time, the average diode current during conduction must be 10n Amps. This non-sinusoidal current
leads to harmonic distortion and a poor power factor in the AC supply.

In a practical circuit, when a capacitor is directly connected to the output of a bridge, the
bridge diodes must be sized to withstand the current surge that occurs when the power is turned on
at the peak of the AC voltage and the capacitor is fully discharged. Sometimes a small series
resistor is included before the capacitor to limit this current, though in most applications the power
supply transformer's resistance is already sufficient.

Output can also be smoothed using a choke and second capacitor. The choke tends to keep
the current (rather than the voltage) more constant. Due to the relatively high cost of an effective
choke compared to a resistor and capacitor this is not employed in modern equipment.

Some early console radios created the speaker's constant field with the current from the
high voltage ("B +") power supply, which was then routed to the consuming circuits, (permanent
magnets were considered too weak for good performance) to create the speaker's constant magnetic
field. The speaker field coil thus performed 2 jobs in one: it acted as a choke, filtering the power
supply, and it produced the magnetic field to operate the speaker.

3) Voltage Regulator

A voltage regulator is an electrical regulator designed to automatically maintain


a constant voltage level.

The 78xx (also sometimes known as LM78xx) series of devices is a family of self-
contained fixed linear voltage regulator integrated circuits. The 78xx family is a very popular
choice for many electronic circuits which require a regulated power supply, due to their ease of
use and relative cheapness. When specifying individual ICs within this family, the xx is replaced
with a two-digit number, which indicates the output voltage the particular device is designed to
provide (for example, the 7805 has a 5 volt output, while the 7812 produces 12 volts). The 78xx
line is positive voltage regulators, meaning that they are designed to produce a voltage that is
positive relative to a common ground. There is a related line of 79xx devices which are
complementary negative voltage regulators. 78xx and 79xx ICs can be used in combination to
provide both positive and negative supply voltages in the same circuit, if necessary.

78xx ICs have three terminals and are most commonly found in the TO220 form factor,
although smaller surface-mount and larger TrO3 packages are also available from some
manufacturers. These devices typically support an input voltage which can be anywhere from a

12
Figure 7: Internal block diagram of voltage rectifier

couple of volts over the intended output voltage, up to a maximum of 35 or 40 volts, and
can typically provide up to around 1 or 1.5 amps of current (though smaller or larger packages
may have a lower or higher current rating).

PUSH BUTTON:

A push-button (also spelled pushbutton) (press-button in the UK) or simply button is a


simple switch mechanism for controlling some aspect of a machine or a process. Buttons
are typically made out of hard material, usually plastic or metal. The surface is usually
flat or shaped to accommodate the human finger or hand, so as to be easily depressed or
pushed. Buttons are most often biased switches, though even many un-biased buttons
(due to their physical nature) require a spring to return to their un-pushed state. Different
people use different terms for the "pushing" of the button, such as press, depress, mash,
and punch.

Figure 8: Push button

13
RESET BUTTON:

In electronics and technology, a reset button is a button that can reset a device. On video
game consoles, the reset button restarts the game, losing the player's unsaved progress.
On personal computers, the reset button clears the memory and reboots the machine
forcibly. Reset buttons are found on circuit breakers to reset the circuit. This button can
cause data corruption so this button often doesn't exist on many machines. Usually, in
computers, it is present as a small button, possibly recessed into the case, to prevent
accidentally pressing it.

2.2.3 Conclusion:

The system that supplies power and its circuit are thus studied.

2.3 LED(LIGHT EMITTING DIODE)

2.3.1 Introduction:

A light-emitting diode (LED) is a semiconductor diode that emits light when an electrical
current is applied in the forward direction of the device, as in the simple LED circuit. The effect is
a form of electroluminescence. where incoherent and narrow-spectrum light is emitted from the p-
n junction..

LEDs are widely used as indicator lights on electronic devices and increasingly in higher
power applications such as flashlights and area lighting. An LED is usually a small area (less than
1 mm2) light source, often with optics added to the chip to shape its radiation pattern and assist in

reflection . The color of the emitted light depends on the composition and condition of the semi
conducting material used, and can be infrared, visible, or ultraviolet. Besides lighting, interesting
applications include using UV-LEDs for sterilization of water and disinfection of devices , and as
a grow light to enhance photosynthesis in plants.

14
2.3.2 Basic principle:

Like a normal diode, the LED consists of a chip of semi conducting material impregnated, or
doped, with impurities to create a p-n junction. As in other diodes, current flows easily from the p-side,
or anode, to the n-side, or cathode, but not in the reverse direction. Charge-carriers electrons and holes
flow into the junction from electrodes with different voltages. When an electron meets a hole, it falls
into a lower energy level, and releases energy in the form of a photon.

The wavelength of the light emitted, and therefore its color, depends on the band gap energy
of the materials forming the p-n junction. In silicon or germanium diodes, the electrons and holes
recombine by a non-radiative transition which produces no optical emission, because these are
indirect band gap materials. The materials used for the LED have a direct band gap with energies
corresponding to near-infrared, visible or near-ultraviolet light. LED development began with
infrared and red devices made with gallium arsenide. Advances in materials science have made
possible the production of devices with ever-shorter wavelengths, producing light in a variety of
colors. LEDs are usually built on an n-type substrate, with an electrode attached to the p-type layer
deposited on its surface. P-type substrates, while less common, occur as well. Many commercial
LEDs, especially GaN/InGaN, also use sapphire substrate.

Figure 9: LED working

15
2.3.3 LED Display types:

 Bar graph
 Seven segment
 Star burst
 Dot matrix

Basic LED types:

Miniature LEDs

Figure 10: LED types

Different sized LEDs. 8 mm, 5mm and 3 mm

These are mostly single-die LEDs used as indicators, and they come in various-size packages:

 surface mount
 2 mm
 3 mm (T1)
 5 mm (T1³⁄₄)
 10 mm
 Other sizes are also available, but less common.

Common package shapes:

 Round, dome top


 Round, flat top
 Rectangular, flat top (often seen in LED bar-graph displays)
 Triangular or square, flat top

The encapsulation may also be clear or semi opaque to improve contrast and viewing angle.

There are three main categories of miniature single die LEDs:

16
 Low current — typically rated for 2 mA at around 2 V (approximately 4
mW consumption).
 Standard — 20 mA LEDs at around 2 V (approximately 40 mW) for red, orange, yellow
& green, and 20 mA at 4–5 V (approximately 100 mW) for blue, violet and white.
 Ultra-high output — 20 mA at approximately 2 V or 4–5 V, designed for viewing in
direct sunlight.

Five- and twelve-volt LEDs

These are miniature LEDs incorporating a series resistor, and may be connected
directly to a 5 V or 12 V supply.

Flashing LEDs

Flashing LEDs are used as attention seeking indicators where it is desired to avoid the
complexity of external electronics. Flashing LEDs resemble standard LEDs but they contain an
integrated multivibrator circuit inside which causes the LED to flash with a typical period of one
second. In diffused lens LEDs this is visible as a small black dot. Most flashing LEDs emit light
of a single color, but more sophisticated devices can flash between multiple colors and even fade
through a color sequence using RGB color mixing.

High power LEDs

High power LEDs from lumileds mounted on a star shaped heat sink High power LEDs
(HPLED) can be driven at more than one ampere of current and give out large amounts of
light. Since overheating destroys any LED the HPLEDs must be highly efficient to minimize
excess heat, furthermore they are often mounted on a heat sink to allow for heat dissipation.
If the heat from a HPLED is not removed the device will burn out in seconds.

A single HPLED can often replace an incandescent bulb in a flashlight or be set in an array
to form a powerful LED lamp. LEDs have been developed that can run directly from mains power
without the need for a DC converter. For each half cycle part of the LED diode emits light and part
is dark, and this is reversed during the next half cycle. Current efficiency is 80 lm/W..

17
Multi-color LEDs

A “bi-color LED” is actually two different LEDs in one case. It consists of two dies
connected to the same two leads but in opposite directions. Current flow in one direction produces
one color, and current in the opposite direction produces the other color. Alternating the two colors
with sufficient frequency causes the appearance of a third color. A “tri-color LED” is also two
LEDs in one case, but the two LEDs are connected to separate leads so that the two LEDs can be
controlled independently and lit simultaneously.

RGB LEDs contain red, green and blue emitters, generally using a four-wire connection
with one common (anode or cathode). The Taiwanese LED manufacturer Everlight has introduced
a 3 watt RGB package capable of driving each die at 1 watt.

Alphanumeric LEDs

LED displays are available in seven-segment and starburst format. Seven-segment displays handle
all numbers and a limited set of letters. Starburst displays can display all letters. Seven-segment
LED displays were in widespread use in the 1970s and 1980s, but increasing use of liquid crystal
displays, with their lower power consumption and greater display flexibility, has reduced the
popularity of numeric and alphanumeric LED displays.

2.3.4 Applications:

Automotive applications with LEDS

Instrument Panels & Switches, Courtesy Lighting, CHMSL, Rear Stop/Turn/Tai,


Retrofits, New Turn/Tail/Marker Lights.

Consumer electronics & general indication

Household appliances, VCR/ DVD/ Stereo/Audio/Video devices, Toys/Games


Instrumentation, Security Equipment, Switches.

Illumination with LEDs

Architectural Lighting, Signage (Channel Letters), Machine Vision, Retail Displays,


Emergency Lighting (Exit Signs), Neon and bulb Replacement, Flashlights, Accent Lighting -
Pathways, Marker Lights.

18
Sign applications with LEDs

Full Color Video, Monochrome Message Boards, Traffic/VMS, Transportation –


Passenger Information.

Signal application with LEDs

Traffic, Rail, Aviation, Tower Lights, Runway Lights, Emergency/Police Vehicle Lighting.

Mobile applications with LEDs

Mobile Phone, PDA's, Digital Cameras, Lap Tops, General Backlighting.

Photo sensor applications with LEDs

Medical Instrumentation, Bar Code Readers, Color & Money Sensors, Encoders,
Optical Switches, Fiber Optic Communication.

2.3.5 Conclusion

The basic principle, types and applications of LED are thus studied.

2.4 RFID (RADIO FREQUENCY IDENTIFIER)

2.4.1 Introduction:

Radio-frequency identification (RFID) is an automatic identification method, relying on


storing and remotely retrieving data using devices called RFID tags or transponders. An RFID tag
is an object that can be applied to or incorporated into a product, animal, or person for the purpose
of identification using radio waves. Some tags can be read from several meters away and beyond
the line of sight of the reader. Most RFID tags contain at least two parts. One is an integrated circuit
for storing and processing information, modulating and demodulating a (RF) signal, and other
specialized functions. The second is an antenna for receiving and transmitting the signal. Chip less
RFID allows for discrete identification of tags without an integrated circuit, thereby allowing tags
to be printed directly onto assets at a lower cost than traditional tags.

19
Figure 11: Working of RFID

Primarily, the two main components involved in a Radio Frequency Identification


system are the Transponder ( tags that are attached to the object ) and the Interrogator (RFID
reader). Communication between the RFID reader and tags occurs wirelessly and generally
does not require a line of sight between the devices.
2.4.2 RFID transponder / tag:
An RFID transponder, considered as a next generation barcode, is a miniscule microchip
that is attached to an antenna. They come in a wide variety of sizes, shapes, and forms and
can be read through most materials with the exception of conductive materials like water and
metal, but with modifications and positioning even these can be overcome.

Figure 12: RFID Tag

20
Passive tags
Passive tags are generally smaller, lighter and less expensive than those that are active
and can be applied to objects in harsh environments, are maintenance free and will last for
years. These transponders are only activated when within the response range of a reader.
The RFID reader emits a low-power radio wave field which is used to power up the tag so as
to pass on any information that is contained on the chip.

Active tags
Active tags differ in that they incorporate their own power source, where as the tag is
a transmitter rather than a reflector of radio frequency signals which enables a broader range
of functionality like programmable and read/write capabilities.

Semi-passive tags
Semi-passive tags are similar to active tags in that they have their own power source, but
the battery only powers the microchip and does not power the broadcasting of a signal. The
response is usually powered by means of backscattering the RF energy from the reader, where
energy is reflected back to the reader as with passive tags. An additional application for the
battery is to power data storage. Semi-passive tags leads to greater sensitivity than passive
tags, typically 100 times more. The enhanced sensitivity can be leveraged as Semi-passive
tags have three main advantages: greater sensitivity than passive tags; longer battery powered
life cycle than active tags; they can perform active functions (such as temperature logging)
under their own power, even when no reader is present for powering the circuitry.

2.4.3 RFID reader/ Interrogator:


An RFID reader typically contains a module (transmitter and receiver), a control unit
and a coupling element (antenna). The reader has three main functions: energizing,
demodulating and decoding. In addition, readers can be fitted with an additional interface
that converts the radio waves returned from the RFID tag into a form that can then be passed
on to another system, like a computer or any programmable logic controller. Anti-Collision

21
algorithms permit the simultaneous reading of large numbers of tagged objects, while
ensuring that each tag is read only once.

Figure: RFID Reader

RFID operates in several frequency bands. The exact frequency is controlled by the
Radio Regulatory body in each country.

RFID Frequencies:

The generic frequencies for RFID are:

 125 - 134 kHz


 13.56 MHz
 UHF (400 – 930 MHz)
 2.45 GHz
 5.8 GHz

Although there are other frequencies used, these are the main ones.

In the UHF band, there are two areas of interest. Several frequencies in the 400 MHz
band and then the band 860 – 930 MHz.

22
Each of the frequency bands have advantages and disadvantages for operation. The lower
frequencies 125-134 kHz and 13.56 MHz work much better near water or humans than do the
higher frequency tags. Comparing passive tags, the lower frequencies usually have less range, and
they have a slower data transfer rate. The higher frequency ranges have more regulatory controls
and differences from country to country.

2.4.4 Applications:

RFID tags are useful for a huge variety of applications. Some of these applications include:
supply chain management, automated payment, physical access control, counterfeit prevention,
and smart homes and offices. RFID tags are also implanted in all kinds of personal and consumer
goods, for example, passports, partially assembled cars, frozen dinners, ski-lift passes, clothing,
and public transportation tickets. Implantable RFID tags for animals allow concerned owners to
label their pets and livestock. Verichip Corp. has also created a slightly adapted implantable RFID
chip, the size of a grain of rice, for use in humans. Since its introduction, the Verichip was approved
by the U.S. Food and Drug Administration, and this tiny chip is currently deployed in both
commercial and medical systems.

2.4.5 Conclusion:

The working of RFID reader, RFID tags and their applications are thus studied.

2.5 MICROCONTROLLER

2.5.1 Introduction

Microprocessors vs. Microcontrollers:

• Microprocessors are single-chip CPUs used in microcomputers.

• Microcontrollers and microprocessors are different in three main aspects: hardware


architecture, applications, and instruction set features.

23
• Hardware architecture: A microprocessor is a single chip CPU while a microcontroller is
a single IC contains a CPU and much of remaining circuitry of a complete computer (e.g.,
RAM, ROM, serial interface, parallel interface, timer, interrupt handling circuit).

• Applications: Microprocessors are commonly used as a CPU in computers while


microcontrollers are found in small, minimum component designs performing control
oriented activities.

• Microprocessor instruction sets are processing Intensive.

• Their instructions operate on nibbles, bytes, words, or even double words.

• Addressing modes provide access to large arrays of data using pointers and offsets.

• They have instructions to set and clear individual bits and perform bit operations.

• They have instructions for input/output operations, event timing, enabling and setting
priority levels for interrupts caused by external stimuli.

• Processing power of a microcontroller is much less than a microprocessor.

Difference between 8051 and 8052:

The 8052 microcontroller is the 8051's "big brother." It is a slightly more powerful microcontroller,
sporting a number of additional features which the developer may make use of:

 256 bytes of Internal RAM (compared to 128 in the standard 8051).


 A third 16-bit timer, capable of a number of new operation modes and 16-bit reloads.
 Additional SFRs to support the functionality offered by the third timer.

AT89S52:

2.5.2 Features:

• Compatible with MCS-51 Products

• 8K Bytes of In-System Programmable (ISP) Flash Memory

24
– Endurance: 1000 Write/Erase Cycles

• 4.0V to 5.5V Operating Range

• Fully Static Operation: 0 Hz to 33 MHz

• Three-level Program Memory Lock

• 256K Internal RAM

• 32 Programmable I/O Lines

• 3 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

• Dual Data Pointer

• Power-off Flag

2.5.3 DESCRIPTION OF MICROCONTROLLER 89S52:

The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller with


8Kbytes of in-system programmable Flash memory. The device is manufactured
Using Atmel’s high-density nonvolatile memory technology and is compatible with the
industry-standard 80C51 micro controller. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a
versatile 8-bit CPU with in-system programmable flash one monolithic chip; the

25
Atmel AT89S52 is a powerful micro controller, which provides a highly flexible and cost-
effective solution to many embedded control applications.

Figure 14: Description of microcontroller 89S52

26
Figure 15: Pin description of 89S52

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of
RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, full duplex
serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with
static logic for perationdown to zero frequency and supports two software selectable power
saving modes. The Idle Mode stops the CPU while allowing the RAM timer/counters, serial
port, and interrupt system to continue functioning. The Power-down mode saves the RAM
contents but freezes the oscillator, disabling all other chip functions until the next interrupt or
hardware reset.

PIN DESCRIPTION OF MICROCONTROLLER 89S52

VCC

27
Supply voltage.

GND

Ground.

Port 0

Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin
can sink eight TTL inputs. When 1sare 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 0 also receives the code bytes during Flash programming
and outputs the code bytes during program verification. External pull-ups are required
during program verification

Port 1
Port 1 is an 8-bit bi-directional 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. 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 1 also receives the low-order address bytes during Flash
programming and verification.
Table 1: Port1 Functions

28
Port 2

Port 2 is an 8-bit bi-directional 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. 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 use 8-bit addresses (MOVX
@ RI), Port 2emits the contents of the P2 Special Function Register. Port 2 also receives the
high-order address bits and some control signals during Flash programming and verification.

Port 3

Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are writt 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 also serves the functions
of various special features of the AT89S52, as shown in the following table.

Port 3 also receives some control signals for Flash programming

Table 2: Port 3 functions

29
RST

Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device.

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 of1/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 micro
controller is in external execution mode.

PSEN

Program Store Enable (PSEN) is the read strobe to external program memory. When
the AT89S52 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external
data memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH.Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. A should be
strapped to VCC for internal program executions. This pin also receives the 12-
voltProgramming enables voltage (VPP) during Flash programming.

30
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier
that can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz
crystal or ceramic resonator may be used. To drive the device from an External clock source,
XTAL2 should be left unconnected while XTAL1 is driven, as shown in Figure 2.

Figure 16. Oscillator Connections

Special Function Register (SFR) Memory: -

Special Function Registers (SFR s) are areas of memory that control specific
functionality of the 8051 processor. For example, four SFRs permit access to the 8051’s 32
input/output lines. Another SFR allows the user to set the serial baud rate, control and access
timers, and configure the 8051’s interrupt system.

The Accumulator: The Accumulator, as its name suggests is used as a general


register to accumulate the results of a large number of instructions. It can hold 8-bit (1-byte)
value and is the most versatile register.

31
The “R” registers: The “R” registers are a set of eight registers that are named R0,
R1. Etc up to R7. These registers are used as auxiliary registers in many operations.

The “B” registers: The “B” register is very similar to the accumulator in the sense
that it may hold an 8-bit (1-byte) value. Two only uses the “B” register 8051 instructions:
MUL AB and DIV AB.

The Data Pointer: The Data pointer (DPTR) is the 8051’s only user accessible 16-bit
(2Bytes) register. The accumulator, “R” registers are all 1-Byte values. DPTR, as the name
suggests, is used to point to data. It is used by a number of commands, which allow the 8051
to access external memory.

THE PROGRAM COUNTER AND STACK POINTER:

The program counter (PC) is a 2-byte address, which tells the 8051 where the next
instruction to execute is found in memory. The stack pointer like all registers except DPTR
and PC may hold an 8-bit (1-Byte) value

32
Interrupt Registers:

The individual interrupt enable bits are in the IE register . Two priorities can be set for
each of the six interrupt sources in the IP register.

Table 3: Bits in IE register

Timer 2

Timer 2 is a 16-bit Timer / Counter that can operate as either a timer or an event
counter. The type of operation is selected by bit C/T2 in the SFR T2CON . Timer 2 has three
operating Modes : capture , auto-reload ( up or down Counting ) , and baud rate generator .
The modes are selected by bits in T2CON . Timer 2 consists of two 8-bit registers , TH2 and
TL2 . In the Timer function , the TL2 register is incremented every machine cycle . Since a
machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator
frequency.In the Counter function , the register is incremented in response to a 1-to-0
transition at its corresponding external input pin , T2 .When the samples show a high in one
cycle and a low in the next cycle, the count is incremented . Since two machine cycles (24
Oscillator periods ) are required to recognize 1-to-0 transition , the maximum count rate is 1 /
24 of the oscillator frequency . To ensure that a given level is sampled at least once before it
changes , the level should be held for atleast one full machine cycle .

33
Capture Mode

In the capture mode , two options are selected by bit EXEN2 in T2CON . If
EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2
in T2CON . This bit can then be used to generate an interrupt . If EXEN2 = 1 , Timer
2 performs the same operation , but a 1-to-0 transition at external input T2EX also
causes the current value in TH2 and TL2 to be captured into RCAP2H and RCAP2L
, respectively

Auto-reload (Up or Down Counter)

Timer 2 can be programmed to count up or down when configured in its 16-bit


autoreload mode. This feature is invoked by the DCEN (Down Counter Enable) bit located in
the SFR T2MOD . Upon reset , the DCEN bit is set to 0 so that timer 2 will default to count
up. When DCEN is set , Timer 2 can count up or down , depending on the value of the T2EX
pin . In this mode , two options are selected by bit EXEN2 in T2CON . If EXEN2 = 0 , Timer
2 counts up to 0FFFFH and then sets the TF2 bit upon overflow . If EXEN2 = 1 , a 16-bit
reload can be triggered either by an overflow or by a 1-to-0 transition at external input T2EX.

Baud Rate Generator

Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in
T2CON . Note that the baud rates for transmit and receive can be different if Timer 2 is used
for the receiver or transmitter and Timer 1 is used for the other
function .The baud rates in Modes 1 and 3 aredetermined by Timer 2’s overflow rate according
to the following equation .

Modes 1 and 3 Baud Rates =Timer 2 Overflow Rate

16

The timer operation is different for Timer 2 when it is used as a baud rate generator
.Normally ,as a timer , it increments every machine cycle (at 1/12 the oscillator frequency).As
a baud rate generator , however, it increments every state time ( at 1/2 the oscillator frequency
).

34
Timer 0

Timer 0 functions as either a timer or event counter in four modes of operation . Timer 0
is controlled by the four lower bits of the TMOD register and bits 0, 1, 4 and 5 of the TCON
register

Mode 0 ( 13-bit Timer)

Mode 0 configures timer 0 as a 13-bit timer which is set up as an 8-bit timer (TH0
register) with a modulo 32 prescaler implemented with the lower five bits of the TL0 register
. The upper three bits of TL0 register are indeterminate and should be ignored . Prescaler
overflow increments the TH0 register.
Mode 1 ( 16-bit Timer )
Mode 1 is the same as Mode 0, except that the Timer register is being run all 16 bits .
with Mode 1 configures timer 0 as a 16-bit timer with the TH0 and registers connected in
TL0 cascade . The selected input increments the TL0 register .

Mode 2 (8-bit Timer with Auto-Reload)

Mode 2 configures timer 0 as an 8-bit timer ( TL0 register ) that automatically


reloads from the TH0 register . TL0 overflow sets TF0 flag in the TCON register
and reloads TL0 with the contents of TH0 , which is preset by software .

Mode 3 ( Two 8-bit Timers )

Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate 8-
bit timers. This mode is provided for applications requiring an additional 8-bit timer or
counter .

35
Timer 1

Timer 1 is identical to timer 0 , except for mode 3 , which is a hold-count


mode .

Mode 3 ( Halt )

Placing Timer 1 in mode 3 causes it to halt and hold its count . This can be
used to halt Timer 1 when TR1 run control bit is not available i.e. , when Timer 0
is in mode 3 .

Baud Rates :

The baud rate in Mode 0 is fixed. The baud rate in Mode 2 depends on
the value of bit SMOD in Special Functio Register PCON. If SMOD = 0 (which is
its value on reset), the baud rate is 1/64 the oscillator frequency . If SMOD = 1, the
baud rate is 1/32 the oscillator frequency. In the 89S52 , the baud rates in Modes 1
and 3 are determined by the Timer 1 overflow rate. In case of Timer 2 , these baud
rates can be determined by Timer 1 , or by Timer 2 , or by both (one for transmit and
the other for receive ).

36
TCON REGISTER :Timer/counter Control Register

Table 4: TCON Register

37
TMOD REGISTER: Timer/Counter 0 and 1 Modes

Table 5: TMOD Register

2.5.4 Conclusion

The description, features and working of microcontroller are thus studied.

2.6 CRYSTAL OSCILLATOR


2.6.1 Introduction
A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a
vibrating crystal of piezoelectric material to create an electrical signal with a precise frequency.
This frequency is commonly used to keep track of time, as in quartz wristwatches, to provide a
stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters
and receivers. The most common type of piezoelectric resonator used is the

38
quartz crystal, so oscillator circuits incorporating them became known as crystal oscillators,
but other piezoelectric materials including polycrystalline ceramics are used in similar circuits.
Quartz crystals are manufactured for frequencies from a few tens of kilohertz to hundreds
of megahertz. More than two billion crystals are manufactured annually. Most are used for
consumer devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz
crystals are also found inside test and measurement equipment, such as counters, signal
generators, and oscilloscopes.

Figure17: Crystal Oscillator

A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a
regularly ordered, repeating pattern extending in all three spatial dimensions.
When a crystal of quartz is properly cut and mounted, it can be made to distort in an
electric field by applying a voltage to an electrode near or on the crystal. This property is
known as electrostriction or inverse piezoelectricity. When the field is removed, the quartz
generates an electric field as it return`s to its previous shape, and this can generate a voltage.
The result is that a quartz crystal behaves like an RLC circuit, composed of an inductor,
capacitor and resistor, with a precise resonant frequency.
Quartz has the further advantage that its elastic constants and its size change in such a
way that the frequency dependence on temperature can be very low. The specific
characteristics depend on the mode of vibration and the angle at which the quartz is cut
(relative to its crystallographic axes). Therefore, the resonant frequency of the plate,
which depends on its size, does not change much. This means that a quartz clock, filter
or oscillator remains accurate.

39
CRYSTAL OSCILLATOR TYPES AND THEIR ABBREVIATIONS:
• ATCXO — Analog temperature controlled crystal oscillator
• CDXO — Calibrated dual crystal oscillator
• DTCXO — Digital temperature compensated crystal oscillator
• EMXO — Evacuated miniature crystal oscillator
• GPSDO — Global positioning system disciplined oscillator
• MCXO — Microcomputer-compensated crystal oscillator
• OCVCXO — oven-controlled voltage-controlled crystal oscillator
• OCXO — Oven-controlled crystal oscillator
• RbXO — Rubidium crystal oscillators (RbXO), a crystal oscillator (can be an
MCXO) synchronized with a built-in rubidium standard which is run only
occasionally to save power
• TCVCXO — Temperature-compensated voltage-controlled crystal oscillator
• TCXO — Temperature-compensated crystal oscillator
• TMXO – Tactical miniature crystal oscillator
• TSXO — Temperature-sensing crystal oscillator, an adaptation of the TCXO
• VCTCXO — Voltage-controlled temperature-compensated crystal oscillator
VCXO — Voltage-controlled crystal oscillator
2.6.2 Coclusion

The crystal oscillator and its types are thus studied.

2.7 MAX 232


2.7.1 INTRODUCTION:
A standard serial interface for PC, RS232C, requires negative logic, i.e., logic 1 is -3V
to 12V and logic 0 is +3V to +12V. To convert TTL logic, say, TxD and RxD pins of the
microcontroller thus need a converter chip. A MAX232 chip has long been using in many
microcontrollers boards. It is a dual RS232 receiver / transmitter that meets all RS232
specifications while using only +5V power supply. It has two on-board charge pump voltage
converters which generate +10V to -10V power supplies from a single 5V supply.

40
It has four level translators, two of which are RS232 transmitters that convert
TTL/CMOS input levels into +9V RS232 outputs. The other two level translators are RS232
receivers that convert RS232 input to 5V. Typical MAX232 circuit is shown below.

Figure 18: MAX232


2.7.2 FEATURES:

1. Operates With Single 5-V Power Supply

2. LinBiCMOSE Process Technology

3. Two Drivers and Two Receivers

4.±30-V Input Levels

5. Low Supply Current. 8 mA Typical


6. Meets or Exceeds TIA/EIA-232-F and ITU Recommendation V.28

7. Designed to be Interchangeable with Maxim MAX232

8. Applications:

• TIA/EIA-232-F
• Battery-Powered Systems
• Terminals
• Modems
• Computers

41
9. ESD Protection Exceeds 2000 V per MIL-STD-883, Method 3015

10. Package Options Include Small-Outline (D, DW) Packages and Standard Plastic
(N) DIPs

2.7.3 Conclusion:
The features of max232 are thus studied.

2.8 LCD (Liquid Cristal Display)

2.8.1 Introduction:

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.

A program must interact with the outside world using input and output devices that
communicate directly with a human being. One of the most common devices attached to an
controller is an LCD display. Some of the most common LCDs connected to the controller

42
are 16X1, 16x2 and 20x2 displays. This means 16 characters per line by 1 line 16 characters
per line by 2 lines and 20 characters per line by 2 lines, respectively.
Many microcontroller devices use 'smart LCD' displays to output visual information.
LCD displays designed around LCD NT-C1611 module, are inexpensive, easy to use, and it
is even possible to produce a readout using the 5X7 dots plus cursor 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 10 I/O lines (RS RW D7 D6 D5 D4 D3 D2 D1 D0). For a
4-bit data bus it only requires the supply lines plus 6 extra lines(RS RW D7 D6 D5 D4). When
the LCD display is not enabled, data lines are tri-state and they do not interfere with the
operation of the microcontroller.

2.8.2 Features:
(1) Interface with either 4-bit or 8-bit microprocessor.
(2) Display data RAM
(3) 80x 8 bits (80 characters).
(4) Character generator ROM
(5). 160 different 5 7 dot-matrix character patterns.
(6)Character generator RAM
(7) 8 different user programmed 5 7 dot-matrix patterns.
(8).Display data RAM and character generator RAM may be
Accessed by the microprocessor.
(9) Numerous instructions
(10). Clear Display, Cursor Home, Display ON/OFF, Cursor ON/OFF,Blink
Character, Cursor Shift, Display Shift.
(11). Built-in reset circuit is triggered at power ON.
(12). Built-in oscillator.

Data can be placed at any location on the LCD. For 16×1 LCD, the address
locations are:

43
Figure 19 : Address locations for a 1x16 LCD

Shapes and sizes:

Figure 20: LCDs

Even limited to character based modules,there is still a wide variety of shapes and sizes
available. Line lenghs of 8,16,20,24,32 and 40 charecters are all standard, in one, two
and four line versions.

44
Several different LC technologies exists. “supertwist” types, for example, offer
Improved contrast and viewing angle over the older “twisted nematic” types. Some modules
are available with back lighting, so so that they can be viewed in dimly-lit conditions. The
back lighting may be either “electro-luminescent”, requiring a high voltage inverter circuit, or
simple LED illumination.

Electrical block diagram:

Figure 21: Electrical block diagram of LCD

Power supply for lcd driving:

Figure 22: Power supply for lcd driving:

45
PIN DESCRIPTION:

Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16
Pins (two pins are extra in both for back-light LED connections).

Figure 23: pin diagram of 2x16 lines lcd

Table 6: LCD functions

CONTROL LINES:

46
EN:

Line is called "Enable." This control line is used to tell the LCD that you are sending it
data. To send data to the LCD, your program should make sure this line is low (0) and then set the
other two control lines and/or put data on the data bus. When the other lines are completely ready,
bring EN high (1) and wait for the minimum amount of time required by the LCD datasheet (this
varies from LCD to LCD), and end by bringing it low (0) again.

RS:

Line is the "Register Select" line. When RS is low (0), the data is to be treated as a command
or special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data
being sent is text data which sould be displayed on the screen. For example, to display the letter
"T" on the screen you would set RS high.

RW:

Line is the "Read/Write" control line. When RW is low (0), the information on the data bus
is being written to the LCD. When RW is high (1), the program is effectively querying (or reading)
the LCD. Only one instruction ("Get LCD status") is a read command. All others are write
commands, so RW will almost always be low.

Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected
by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3,
DB4, DB5, DB6, and DB7.

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 Instructions
- 1 Character

47
Writing data to the LCD:

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)on LCD:

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
Entering Text:

First, a little tip: it is manually a lot easier to enter characters and commands in
hexadecimal rather than binary (although, of course, you will need to translate commands
from binary couple of sub-miniature hexadecimal rotary switches is a simple matter,
although a little bit into hex so that you know which bits you are setting). Replacing the d.i.l.
switch pack with a of re-wiring is necessary.

The switches must be the type where On = 0, so that when they are turned to the zero
position, all four outputs are shorted to the common pin, and in position “F”, all four
outputs are open circuit.

All the available characters that are built into the module are shown in Table 3. Studying the
table, you will see that codes associated with the characters are quoted in binary and hexadecimal,
most significant bits (“left-hand” four bits) across the top, and least significant bits (“right-hand”
four bits) down the left. Most of the characters conform to the ASCII standard, although the
Japanese and Greek characters (and a few other things) are obvious exceptions. Since these
intelligent modules were designed in the “Land of the Rising Sun,” it

48
seems only fair that their Katakana phonetic symbols should also be incorporated. The more
extensive Kanji character set, which the Japanese share with the Chinese, consisting of several
thousand different characters, is not included!

Using the switches, of whatever type, and referring to Table 3, enter a few characters
onto the display, both letters and numbers. The RS switch (S10) must be “up” (logic 1) when
sending the characters, and switch E (S9) must be pressed for each of them. Thus the
operational order is: set RS high, enter character, trigger E, leave RS high, enter another
character, trigger E, and so on.

The first 16 codes in Table 3, 00000000 to 00001111, ($00 to $0F) refer to the CGRAM.
This is the Character Generator RAM (random access memory), which can be used to hold
user-defined graphics characters. This is where these modules really start to show their
potential, offering such capabilities as bar graphs, flashing symbols, even animated characters.
Before the user-defined characters are set up, these codes will just bring up strange looking
symbols.

Codes 00010000 to 00011111 ($10 to $1F) are not used and just display blank characters.
ASCII codes “proper” start at 00100000 ($20) and end with 01111111 ($7F). Codes 10000000
to 10011111 ($80 to $9F) are not used, and 10100000 to 11011111 ($A0 to $DF) are the
Japanese characters.

Initialization by Instructions:

If the power conditions for the normal operation of the internal reset circuit are not
satisfied, then executing a series of instructions must initialize LCD unit. The procedure for
this initialization process is as above show.

49
Figure 24: LCD initialisation

50
Figure 25: LCD flow chart

2.8.3 Conclusion

The working and features of LCD are thus studied.

51
CHAPTER-3

SOFTWARE DESCRIPTION

Keil Software

Installing the Keil software on a Windows PC

 Insert the CD-ROM in your computer’s CD drive


 On most computers, the CD will “auto run”, and you will see the Keil installation menu.
If the menu does not appear, manually double click on the Setup icon, in the
root directory: you will then see the Keil menu.
 On the Keil menu, please select “Install Evaluation Software”. (You will not require a
license number to install this software).
 Follow the installation instructions as they appear.

Loading the Projects

The example projects for this book are NOT loaded automatically when you install the
Keil compiler.

These files are stored on the CD in a directory “/Pont”. The files are arranged by chapter:
for example, the project discussed in Chapter 3 is in the directory “/Pont/Ch03_00-
Hello”.

Rather than using the projects on the CD (where changes cannot be saved), please copy
the files from CD onto an appropriate directory on your hard disk.

Note: you will need to change the file properties after copying: file transferred from the
CD will be ‘read only’.

Configuring the Simulator

Open the Keil Vision2

Go to Project – Open Project and browse for Hello in Ch03_00 in Pont and open it.

52
Figure 26: Step 1

Go to Project – Select Device for Target ‘Target1’

Figure 27: Step 2

53
Select 8052(all variants) and click OK

Figure 28: IC selection

Now we need to check the oscillator frequency:

Go to project – Options for Target ‘Target1’

54
Figure 29: Ensuring oscillator frequency

Make sure that the oscillator frequency is 12MHz.

Figure 30: Options for target

55
Building the Target
Build the target as illustrated in the figure below

Figure 31: Building the target

Running the Simulation


Having successfully built the target, we are now ready to start the debug session and run the
simulator.
First start a debug session

56
Figure 32: Debugging

The flashing LED we will view will be connected to Port 1. We therefore want to
observe the activity on this port

Figure 33: Viewing peripherals

57
Figure 34:Viewing port 1

To ensure that the port activity is visible, we need to start the ‘periodic window update’ flag

Figure 35: Periodic window update flag

58
Go to Debug - Go

Figure 36: Debug-Go

59
While the simulation is running, view the performance analyzer to check the delay
durations.

Figure 37: Performance Analyser-step 1

Figure 38: Performance Analyser-step 2

60
Go to Debug – Performance Analyzer and click on it

Figure 39: Performance Analyser-step 3


Double click on DELAY_LOOP_Wait in Function Symbols: and click Define button

Figure 40: Performance Analyser-step 4

61
PROGRAM:

#include<reg52.h>

#include<string.h>

#include<intrins.h>

#define lcd P0

sbit sw=P1^0;

sbit rs=P1^5;

sbit rw=P1^6;

sbit en=P1^7;

sbit lcd_bsy = P0^7;

sbit mtr0=P2^0;

sbit mtr1=P2^1;

void lcd_init(void);

void lcdcmd(unsigned char value);

void lcddata(unsigned char value);

void LCD_Busy_Chk(void);

void msgdisplay(unsigned char b[]);

void delay(unsigned int value);

void integer_lcd(int);

62
void conv_serial(unsigned long int ch);

void enter(void);

void sendbyte(unsigned char *);

void sendslot(unsigned char);

unsigned char interruptno[13];

bit MsgRead;

void comp(void);

bit flag;

int K=0,K1=0,J=0,J1=0,J2=0;

int std1,std2,std3,std4,cstd1;

////////////////////////////////////////////////////////////////////////////////////////////////////

void main()

mtr0=0;mtr1=0;std1=0;std2=0;std3=0;std4=0;cstd1=0;

//RL=0;

SCON = 0x50;

TMOD = 0x20;

TH1 = -3;///////////////GSM 9600

TR1 = 1;

63
sw=1;

lcd_init();

lcdcmd(0x01);

lcdcmd(0x80);

msgdisplay(" ATTENDANCE ");

lcdcmd(0xC0);

msgdisplay(" SYSTEM - RFID ");

delay(200);delay(200);delay(200);delay(200);

EA=1;

ES=1;

MsgRead=0;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SWIPE THE CARD");

while(1)

TH1=-3;

if(MsgRead)

EA=0;

64
comp();

MsgRead=0;

EA=1;

ES=1;

//////////////////////////////////////////////////////////////////

void serialintr(void) interrupt 4

unsigned char i;

if(RI==1)

interruptno[i]=SBUF;

lcddata(interruptno[i]);

RI=0;

i++;

65
if(i==12)

MsgRead=1;

i=0;

//////////////////////////////////////////////////////////////

void comp(void)

if(strncmp(interruptno,"1E009777E51B",12)==0)

K=K+1;

if(K%2==1)

std1=1;cstd1++;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay(" CHAITANYA IN ");

66
mtr0=1;mtr1=0;

delay(2000);

mtr0=0;mtr1=0;

delay(3000);

mtr0=0;mtr1=1;

delay(2000);

mtr0=0;mtr1=0;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SWIPE THE CARD");

else

cstd1--;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay(" CHAITANYA OUT ");

mtr0=1;mtr1=0;

delay(2000);

mtr0=0;mtr1=0;

delay(3000);

67
mtr0=0;mtr1=1;

delay(2000);

mtr0=0;mtr1=0;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SWIPE THE CARD");

else if(strncmp(interruptno,"1E0097A981A1",12)==0)

K1=K1+1;

if(K1%2==1)

std2=1;cstd1++;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay(" AKSHAY IN ");

mtr0=1;mtr1=0;

delay(2000);

mtr0=0;mtr1=0;

delay(3000);

68
mtr0=0;mtr1=1;

delay(2000);

mtr0=0;mtr1=0;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SWIPE THE CARD");

else

cstd1--;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay(" AKSHAY OUT ");

mtr0=1;mtr1=0;

delay(2000);

mtr0=0;mtr1=0;

delay(3000);

mtr0=0;mtr1=1;

delay(2000);

mtr0=0;mtr1=0;

lcdcmd(0x01);lcdcmd(0x80);

69
msgdisplay("SWIPE THE CARD");

else if(strncmp(interruptno,"1E0097A97555",12)==0)

J=J+1;

if(J%2==1)

std3=1;cstd1++;

lcdcmd(0x01);

lcdcmd(0x80);

msgdisplay("SHANKAR IN ");

mtr0=1;mtr1=0;

delay(500);

mtr0=0;mtr1=0;

delay(1000);

mtr0=0;mtr1=1;

delay(500);

mtr0=0;mtr1=0;

70
lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SWIPE THE CARD");

else

cstd1--;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SHANKAR OUT ");

mtr0=1;mtr1=0;

delay(500);

mtr0=0;mtr1=0;

delay(1000);

mtr0=0;mtr1=1;

delay(500);

mtr0=0;mtr1=0;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SWIPE THE CARD");

71
else if(strncmp(interruptno,"1E0097A97A5A",12)==0)

J1=J1+1;

if(J1%2==1)

std4=1; cstd1++;

lcdcmd(0x01);lcdcmd(0x80);

// msgdisplay(" 14671A04A4");

// lcdcmd(0xC0);

msgdisplay(" SRUJAN IN ");

mtr0=1;mtr1=0;

delay(500);

mtr0=0;mtr1=0;

delay(1000);

mtr0=0;mtr1=1;

delay(500);

mtr0=0;mtr1=0;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SWIPE THE CARD");

72
}

else

cstd1--;

lcdcmd(0x01);lcdcmd(0x80);

// msgdisplay(" 14671A04A4");

// lcdcmd(0xC0);

msgdisplay(" SRUJAN OUT ");

mtr0=1;mtr1=0;

delay(500);

mtr0=0;mtr1=0;

delay(1000);

mtr0=0;mtr1=1;

delay(500);

mtr0=0;mtr1=0;

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SWIPE THE CARD");

73
else

lcdcmd(0x01); lcdcmd(0x80);

msgdisplay("Invalid card");

delay(200);delay(200);

delay(200);delay(200);

lcdcmd(0x01);lcdcmd(0x80);

msgdisplay("SWIPE THE CARD");

//////////////////////////////////////////////////////////////

void lcd_init(void)

lcdcmd(0x38);

lcdcmd(0x38);

lcdcmd(0x0c);

lcdcmd(0x06);

lcdcmd(0x01);

74
lcdcmd(0x80);

delay(5);

//////////////////////////////////////////////////////////////

void lcdcmd(unsigned char value) // LCD COMMAND

LCD_Busy_Chk();

lcd=value;

rs=0;

rw=0;

en=1;

_nop_();

en=0;

/////////////////////////////////////////////////////////////////////////

void lcddata(unsigned char value)

LCD_Busy_Chk();

lcd=value;

75
rs=1;

rw=0;

en=1;

_nop_();

en=0;

/////////////////////////////////////////////////////////////////////////

void LCD_Busy_Chk(void)

lcd_bsy=1;

rs=0;

rw=1;

while(lcd_bsy==1)

en=0;

_nop_();

_nop_();

_nop_();

_nop_();

76
en=1;

/////////////////////////////////////////////////////////////////////////

void msgdisplay(unsigned char b[])

unsigned char s,count=0;

for(s=0;b[s]!='\0';s++)

if(s==16)

lcdcmd(0xc0);

if(s==32)

lcdcmd(0x01);

lcddata(b[s]);

///////////////////////////////////////////////////////////////

void delay(unsigned int value)

77
unsigned int x,y;

for(x=0;x<100;x++)

for(y=0;y<value;y++);

///////////////////////////////////////////////////////////////////

CHAPTER 4

ADVANTAGES AND APPLICATIONS

4.1 ADVANTAGES:

1. Reduce paperwork and save time and money with mobile and cloud-based attendance
management system

2. Eliminate duplicate data entry and errors in time and attendance entries

3. Improve visibility to track and manage student attendance & absenteeism across
multiple campuses

4. Real-time status tracking of leave requests

5. Automatic calculation of leave and reward points accrued 6. Easy attendance recording
using RFID & Biometric based attendance system

7. Track the attendance of teachers and staff, assign work and manage allocation

8. Keep the parents informed about the student’s performance via Email & SMS alerts

9. Auto-generate various types of reports of class or student attendance

4.2 APPLICATIONS:

Library.

Hospitals.

Schools and Colleges.

Transportation and Logistics,Sports

78
CHAPTER 5

RESULT
The project “RFID Based Attendance System” was designed such that required operation
is achieved.

CHAPTER 6

REFERENCES
The sites which were used while doing this project:

1. www.wikipedia.com

2. www.allaboutcircuits.com

3. www.microchip.com

4. www.howstuffworks.com

Books referred:

1.Embedded Systems by Mazidi and Mazidi .

2.C programming for embedded microcontrollers by Warwick A. Smith

79

Potrebbero piacerti anche