You are on page 1of 89

VECHILE REGISTRATION USING SMART CARD

IDENTIFICATION

G. SRIHARI
D. LAKSHMI PARVATHI
N.HARI NARAYANA

Department of Electronics and Communication Engineering


MAHATMA GANDHI INSTITUTE OF TECHNOLOGY
(Affiliated to Jawaharlal Nehru Technological University, Hyderabad, A.P.)

Chaitanya Bharathi P.O., Gandipet, Hyderabad – 500 075


2010
VECHILE REGISTRATION USING SMART CARD
IDENTIFICATION

PROJECT REPORT
SUBMITTED IN PARTIAL FULFILLMENT
OF THE REQUIREMENTS FOR THE DEGREE OF
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
BY

G. SRIHARI (07265A0409)
D. LAKSHMI PARVATHI (07265A0407)
N.HARI NARAYANA (07265A0410)

Department of Electronics and Communication Engineering


MAHATMA GANDHI INSTITUTE OF TECHNOLOGY
(Affiliated to Jawaharlal Nehru Technological University, Hyderabad, A.P.)

Chaitanya Bharathi P.O., Gandipet, Hyderabad – 500 075


2010
MAHATMA GANDHI INSTITUTE OF TECHNOLOGY
7(Affiliated to Jawaharlal Nehru Technological University, Hyderabad, A.P.)

Chaitanya Bharathi P.O., Gandipet, Hyderabad-500 075

Department of Electronics and Communication Engineering

CERTIFICATE

Date:

This is to certify that the project work entitled “Vehicle Registration Using
Smart Card Identification” is a bonafide work carried out by

G. SRIHARI (07265A0409)
D. LAKSHMI PARVATHI (07265A0407)
N.HARI NARAYANA (07265A0410)

in partial fulfillment of the requirements for the degree of BACHELOR OF


TECHNOLOGY in ELECTRONICS & COMMUNICATION
ENGINEERING by the Jawaharlal Nehru Technological University, Hyderabad
during the academic year 2009-10.

The results embodied in this report have not been submitted to any other
University or Institution for the award of any degree or diploma.

-------------------------- --------------------------
Mr A.Veerabhadra Rao, Asst Professor Dr. E Nagbhooshanam
Faculty Advisor/Liaison Professor & Head

ACKNOWLEDGEMENT

We express our deep sense of gratitude to our Guide Mr.Ravi kiran ,NSTL,
Hyderabad, for his invaluable guidance and encouragement in carrying out our
Project.

We are highly indebted to our Faculty Liaison Mrs. Mr A.Veerabhadra Rao,


Assistant Professor, Electronics and Communication Engineering Department, who
has given us all the necessary technical guidance in carrying out this Project.

We wish to express our sincere thanks to Dr. E. Nagabhooshanam, Head of


the Department of Electronics and Communication Engineering, M.G.I.T., for
permitting us to pursue our Project in Cranes Varsity and encouraging us throughout
the Project.

Finally, we thank all the people who have directly or indirectly help us
through the course of our Project.

G.Srihari
D.Lakshmi parvathi
N.Hari Narayana
(ii)

ABSTRACT

From the past days man is inventing various things to lead a Comfortable &
luxurious life. Not only inventing newer things but also he is continuously attempting
to implement new technologies into that field. In this attempt he got success in finding
out a computer, which can be undoubtedly called, as his fantasy.

This project titled as “Vehicle Registration using Smart Card Identification”


avoids the entry of unauthorized person or vehicle into the apartment. If an
unauthorized person wants to enter into the apartment he has to get the permission
from the concerned person in that apartment. Currently security guards used to give
the permission to enter into the apartment for authorized person/vehicle, and stop each
vehicle for checking which has been done manually. This is time consuming and also
delays movement of vehicles. This can be avoided if a system is developed which
automates the manual process of checking the vehicle details. This system can give
very reliable solution.

In this system a smartcard is mounted on the vehicle, when the vehicle is


passed by the gate the data in smartcard is read by smartcard reader which is fixed at
the gate. The data in the smart card corresponds to the identification number of that
particular vehicle. The microcontroller verifies the data regarding that particular
vehicle and decides either to pass the vehicle or hold the vehicle.
(iii)
Table of contents

CERTIFICATE FROM ECE DEPARTMENT (i)


ACKNOWLEDGEMENTS (ii)
ABSTRACT (iii)
LIST OF FIGURES (v)
LIST OF TABLES (vi)

CHAPTER 1. OVERVIEW
1.1 Introduction 1
1.2 Aim of the project 2
1.3 Methodology 2
1.4 Significance and applications 2
1.5 Organization of work 2

CHAPTER 2. FUNDAMENTALS OF MICROCONTROLLER


2.1 Introduction 3
2.2 Necessity of microcontroller 4
2.3 Features of microcontroller 5
2.4 Block diagram of microcontroller 6
2.5 Pin configuration of microcontroller 8

CHAPTER 3. HARDWARE COMPONENT


3.1 Introduction 16
3.2 Lcd 17
3.3 Serial Communication 22
3.4 Max 232 Dual Driver\Receiver 27
3.5 Pc AT Keyboard 30
3.6 Latch (74HC573) 32
3.7 Smart Card 34
3.8 Stepper Motor 41
3.9 Photo Sensor 46
3.10 Power Supply 51
(iv.a)

CHAPTER 4. BLOCK AND SCHEMATIC DIAGRAM


4.1 Block diagram and its explanation 54
4.2 Schematic diagram and its explanation 57

CHAPTER 4. SOFTWARE COMPONENT


5.1 Introduction about keil sofware 61
5.2 Flow Chart 62
5.3 Source Code 65

CHAPTER 6. RESULTS AND CONCLUSIONS


6.1 Future Enhancement 76
6.2 Conclusion 76

REFERENCES 77
(iv.b)

LIST OF FIGURES

2.1 Function block diagram of Microcontroller……..………….…..6

2.2 Pin configuration of microcontroller …………………………..8

2.3 Osillator and timming signals…………………….………….....15

3.1 Front panel of Lcd display.…………………………..………….17

3.2 Back panel of Lcd display ………………………….……….….18

3.3 Pin configuration of Lcd diaplay……………………………..…18

3.4 Interfacing of Lcd to microcontroller ………………..………...21

3.5 Pin diagram of Max 232……………………………………...…28

3.6 Functional table of driver and receiver………………….............28

3.7 Logic diagram of Max 232 …………………………………….29

3.8 Basic memory cell and truth table…………………………….....32

3.9 Pin configuration of Latch.....................................................…...33

3.10 Stepper motor……………………………………..……………43

3.11 Variable reluctance motor……………………………………...43

3.12 Unipolar motor………………………………………………....44

3.13 Photo transmitter……………………………………………….49

3.14 receiver characteristics ………………………………………...49

3.15 Diffuse reflection sensors for short ranges……………………..50

3.16 Diffuse reflection sensor with background suppression………..50

3.17 Shows the voltage regulator…………………………………….51

3.18 Block diagram of power supply………………………………...52

3.19 Circuit of capacitor filer………………………………………...53


(v)

4.1 Block diagram of project…………………………………………54

4. Circuit diagram of transmitter……………………………………..57

4.3 Circuit diagram of receiver……………………………………….58

4.4 circuit diagram of stepper motor………………………………...58

LIST OF TABLES

2.1 Alternate function of port 3…………………………………....…14

2.2 Memory location of interrupt……………………………………..15

3.1 Pin description of Lcd……………………………………………19

3.2 Lcd Commands codes……………………………………………20

3.3 Operating condition for Max 232…………………………………29


(vi)
1.1 Introduction

EMBEDDED SYSTEMS

Embedded systems are designed to do some specific task, rather than be a


general-purpose computer for multiple tasks. Some also have real time
performance constraints that must be met, such as safety and usability; others
may have low or no performance requirements, allowing the system hardware to
be simplified to reduce costs.

An embedded system is not always a separate block very often it is


physically built-in to the device it is controlling the software written for
embedded systems is often called firmware, and is stored in read-only memory
or flash convector chips rather than a disk drive. It often runs with limited
computer hardware resources such as small or no keyboard, screen, and little
memory.

From the past days man is inventing various things to lead a Comfortable
& luxurious life. Not only inventing newer things but also he is continuously
attempting to implement new technologies into that field. In this attempt he got
success in finding out a computer, which can be undoubtedly called, as his
fantasy..

Here, through this project avoids the entry of unauthorized person or vehicle
into the apartment. If an unauthorized person wants to enter into the apartment he
has to get the permission from the concerned person in that apartment

To keep this in an implementation we require two sections with a RF TX


and a RF RX on the either side. So the devices are been operated on one side and
they indirectly been controlled from other side.
1.2 AIM OF THE PROJECT

This project titled as “Vehicle Registration using Smart Card Identification”


avoids the entry of unauthorized person or vehicle into the apartment. If an
unauthorized person wants to enter into the apartment he has to get the
permission from the concerned person in that apartment.

1.3 Methodology

In this system a smartcard is mounted on the vehicle, when the vehicle is


passed by the gate the data in smartcard is read by smartcard reader which is
fixed at the gate. The data in the smart card corresponds to the identification
number of that particular vehicle. The microcontroller verifies the data regarding
that particular vehicle and decides either to pass the vehicle or hold the vehicle.

1.4 Significance and applications

Currently security guards used to give the permission to enter into the
apartment for authorized person/vehicle, and stop each vehicle for checking which has
been done manually. This is time consuming and also delays movement of vehicles.
This can be avoided if a system is developed which automates the manual process of
checking the vehicle details. This system can give very reliable solution.

1.5 Organization of work

1. Introduction of the project are given in chapter 1

2. Details about 8051 microcontroller used in this project are given in chapter.

3. Details about basic hardware component used in project are given in


chapter.

4. Details about circuit diagram and schematic diagram are given in chapter.

5. Details about software components and source code are given in chaper

6. Details about future scope and conclusion are given in chapter.


2. MICRO-CONTROLLER (AT89s51)
2.1 Introduction

Micro-controller unit is constructed with ATMEL 89C51 Micro-controller


chip. The ATMEL AT89C51 is a low power, higher performance CMOS 8-bit
microcomputer with 4K bytes of flash programmable and erasable read only memory
(PEROM). Its high-density non-volatile memory compatible with standard MCS-51
instruction set makes it a powerful controller that provides highly flexible and cost
effective solution to control applications.

Micro-controller works according to the program written in it. The program is


written in such a way, so that the output from the ADC will be converted into its
equivalent voltage and based on the magnitude of the voltage, it calculates the
parameter value. Now this magnitude is again digitalized and fed to LCD display unit
through the latch.

Micro-controllers are "embedded" inside some other device so that they can
control the features or actions of the product. Another name for a micro-controller,
therefore, is "embedded controller". Micro-controllers are dedicated to one task and
run one specific program. The program is stored in ROM (read-only memory) and
generally does not change. Micro-controllers are often low-power devices. A battery-
operated Microcontroller might consume 50 milli watts. A micro-controller has a
dedicated input device and often (but not always) has a small LED or LCD display for
output. A micro-controller also takes input from the device it is controlling and
controls the device by sending signals to different components in the device
Microprocessor has following instructions to perform:
1. Reading instructions or data from program memory ROM.
2. Intrepreting the instruction and executing it.
3. Microprocessor Program is a collection of instructions stored in nonvolatile
memory.
4. Read Data from I/O device
5. Process the input read, as per the instructions read in program memory.
6. Read or write data to Data memory.
7. Write data to I/O device and output the result of processing to O/P device.
2.2 NECESSITY OF MICROCONTROLLERS

Microprocessors brought the concept of programmable devices and made


many applications of intelligent equipment. Most applications, which do not need
large amount of data and program memory, tended to be:

Costly: The microprocessor system had to satisfy the data and program
requirements so, sufficient RAM and ROM are used to satisfy most applications .The
peripheral control equipment also had to be satisfied. Therefore, almost all-peripheral
chips were used in the design. Because of these additional peripherals cost will be
comparatively high.

8085 chip needs: An Address latch for separating address from multiplex address
and data.32-KB RAM and 32-KB ROM to be able to satisfy most applications. As
also
Timer / Counter, Parallel programmable port, Serial port, Interrupt controller are
needed for its efficient applications.
In comparison a typical Micro controller 8051 chip has all that the 8051 board
has except a reduced memory as follows.
4K bytes of ROM as compared to 32-KB, 128 Bytes of RAM as compared to 32-KB.

Bulky: On comparing a board full of chips (Microprocessors) with one chip with all
components in it (Micro controller).

Debugging: Lots of Microprocessor circuitry and program to debug. In Micro


controller there is no Microprocessor circuitry to debug Slower Development time: As
we have observed Microprocessors need a lot of debugging at board level and at
program level, where as, Micro controller do not have the excessive circuitry and the
built-in peripheral chips are easier to program for operation.
So peripheral devices like Timer/Counter, Parallel programmable port, Serial
Communication Port, Interrupt controller and so on, which were most often used were
integrated with the Microprocessor to present the Micro controller .RAM and ROM
also were integrated in the same chip. The ROM size was anything from 256 bytes to
32Kb or more. RAM was optimized to minimum of 64 bytes to 256 bytes or more.
Why AT 89C51? :
The system requirements and control specifications clearly rule out the use of
16, 32 or 64 bit micro controllers or microprocessors. Systems using these may be
earlier to implement due to large number of internal features. They are also faster and
more reliable but, the above application is satisfactorily served by 8-bit micro
controller. Using an inexpensive 8-bit Microcontroller will doom the 32-bit product
failure in any competitive market place.

Coming to the question of why to use AT89C51 of all the 8-bit


Microcontroller available in the market the main answer would be because it has 4 Kb
on chip flash memory which is just sufficient for our application. The on-chip Flash
ROM allows the program memory to be reprogrammed in system or by conventional
non-volatile memory Programmer. Moreover ATMEL is the leader in flash
technology in today’s market place and hence using AT 89C51 is the optimal
solution.

2.3 Features of microcontroller


The 8051 architecture consists of these specific features:
Eight –bit CPU with registers A (the accumulator) and B
Sixteen-bit program counter (PC) and data pointer (DPTR)
Eight- bit stack pointer (PSW)
Eight-bit stack pointer (Sp)
Internal ROM or EPROM (8751) of 0(8031) to 4K (8051)
Internal RAM of 128 bytes:
Four register banks, each containing eight registers
Sixteen bytes, which maybe addressed at the bit level
Eighty bytes of general- purpose data memory
Thirty –two input/output pins arranged as four 8-bit ports:p0-p3
Two 16-bit timer/counters: T0 and T1
Full duplex serial data receiver/transmitter: SBUF
Control registers: TCON, TMOD, SCON, PCON, IP, and IE
Two external and three internal interrupts sources.
Oscillator and clock circuits.
2.4 Block diagram of microcontroller

Fig 2.1 Show the Functional block diagram of micro controller

Description
The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with
4K bytes 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 instruction set and pinout. 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 on a monolithic chip, the Atmel AT89S51 is a powerful
microcontroller which provides a highly-flexible and cost-effective solution to many
embedded control applications.
The 8051 have three general types of memory. They are on-chip
memory, external Code memory and external Ram. On-Chip memory refers to
physically existing memory on the micro controller itself. External code memory is
the code memory that resides off chip. This is often in the form of an external
EPROM. External RAM is the Ram that resides off chip. This often is in the form of
standard static RAM or flash RAM.

Code memory
Code memory is the memory that holds the actual 8051 programs that is to be
run. This memory is limited to 64K. Code memory may be found on-chip or off-chip.
It is possible to have 4K of code memory on-chip and 60K off chip memory
simultaneously. If only off-chip memory is available then there can be 64K of off chip
ROM. This is controlled by pin provided as EA
b) Internal RAM
The 8051 have a bank of 128 of internal RAM. The internal RAM is found on-
chip. So it is the fastest Ram available. And also it is most flexible in terms of reading
and writing. Internal Ram is volatile, so when 8051 is reset, this memory is cleared.
128 bytes of internal memory are subdivided. The first 32 bytes are divided into 4
register banks. Each bank contains 8 registers. Internal RAM also contains 128 bits,
which are addressed from 20h to 2Fh. These bits are bit addressed i.e. each individual
bit of a byte can be addressed by the user. They are numbered 00h to 7Fh. The user
may make use of these variables with commands such as SETB and CLR.
2.5 Pin configuration of microcontroller

Fig 2.2 Show the pin diagram of of microcontroller 89C51 IC


.
Special Function registered memory:
Special function registers are the areas of memory that control specific
functionality of the 8051 micro controller.

a) Accumulator (0E0h)
As its name suggests, it is used to accumulate the results of large no of
instructions. It can hold 8 bit values.

B) B register (0F0h)
The B register is very similar to accumulator. It may hold 8-bit value. The b
register is only used by MUL AB and DIV AB instructions. In MUL AB the higher
byte of the product gets stored in B register. In div AB the quotient gets stored in B
with the remainder in A.
C) Stack pointer (81h)
The stack pointer holds 8-bit value. This is used to indicate where the next
value to be removed from the stack should be taken from. When a value is to be
pushed onto the stack, the 8051 first store the value of SP and then store the value at
the resulting memory location. When a value is to be popped from the stack, the 8051
returns the value from the memory location indicated by SP and then decrements the
value of SP.

d) Data pointer
The SFRs DPL and DPH work together work together to represent a 16-bit
value called the data pointer. The data pointer is used in operations regarding external
RAM and some instructions code memory. It is a 16-bit SFR and also an addressable
SFR.

e) Program counter
The program counter is a 16 bit register, which contains the 2 byte address,
which tells the 8051 where the next instruction to execute to be found in memory.
When the 8051 is initialized PC starts at 0000h. And is incremented each time an
instruction is executes. It is not addressable SFR.

f) PCON (power control, 87h)


The power control SFR is used to control the 8051’s power control modes.
Certain operation modes of the 8051 allow the 8051 to go into a type of “sleep mode ”
which consume much lee power.

g) TCON (timer control, 88h)


The timer control SFR is used to configure and modify the way in which the
8051’s two timers operate. This SFR controls whether each of the two timers is
running or stopped and contains a flag to indicate that each timer has overflowed.
Additionally, some non-timer related bits are located in TCON SFR. These bits are
used to configure the way in which the external interrupt flags are activated, which
are set when an external interrupt occurs.

h) TMOD (Timer Mode, 89h)


The timer mode SFR is used to configure the mode of operation of each of
the two timers. Using this SFR your program may configure each timer to be a 16-bit
timer, or 13 bit timer, 8-bit auto reload timer, or two separate timers. Additionally you
may configure the timers to only count when an external pin is activated or to count
“events ” that are indicated on an external pin.

i) TO (Timer 0 low/high, address 8A/8C h)


These two SFRs taken together represent timer 0. Their exact behavior
depends on how the timer is configured in the TMOD SFR; however, these timers
always count up. What is configurable is how and when they increment in value.

j) T1 (Timer 1 Low/High, address 8B/ 8D h)


These two SFRs, taken together, represent timer 1. Their exact behavior
depends on how the timer is configured in the TMOD SFR; however, these timers
always count up. What is
Configurable is how and when they increment in value.

k) P0 (Port 0, address 90h, bit addressable)


This is port 0 latch. Each bit of this SFR corresponds to one of the pins on a
micro controller. Any data to be outputted to port 0 is first written on P0 register. For
e.g., bit 0 of port 0 is pin P0.0, bit 7 is pin p0.7. Writing a value of 1 to a bit of this
SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to low level.

l) P1 (port 1, address 90h, bit addressable)


This is port latch1. Each bit of this SFR corresponds to one of the pins on a
micro controller. Any data to be outputted to port 0 is first written on P0 register. For
e.g., bit 0 of port 0 is pin P1.0, bit 7 is pin P1.7. Writing a value of 1 to a bit of this
SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to low level

m) P2 (port 2, address 0A0h, bit addressable)


This is a port latch2. Each bit of this SFR corresponds to one of the pins on a
micro controller. Any data to be outputted to port 0 is first written on P0 register. For
e.g., bit 0 of port 0 is pin P2.0, bit 7 is pin P2.7. Writing a value of 1 to a bit of this
SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to low level.

n) P3(port 3,address B0h, bit addressable)


This is a port latch3. Each bit of this SFR corresponds to one of the pins on a
micro controller. Any data to be outputted to port 0 is first written on P0 register. For
e.g., bit 0 of port 0 is pin P3.0, bit 7 is pin P3.7. Writing a value of 1 to a bit of this
SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to low level

o) IE (interrupt enable, 0A8h)


The Interrupt Enable SFR is used to enable and disable specific interrupts. The
low 7 bits of the SFR are used to enable/disable the specific interrupts, where the
MSB bit is used to enable or disable all the interrupts. Thus, if the high bit of IE is 0
all interrupts are disabled regardless of whether an individual interrupt is enabled by
setting a lower bit.
p) IP (Interrupt Priority, 0B8h)
The interrupt priority SFR is used to specify the relative priority of each
interrupt. On 8051, an interrupt maybe either low or high priority. An interrupt may
interrupt interrupts. For e.g., if we configure all interrupts as low priority other than
serial interrupt. The serial interrupt always interrupts the system, even if another
interrupt is currently executing. However, if a serial interrupt is executing no other
interrupt will be able to interrupt the serial interrupt routine since the serial interrupt
routine has the highest priority.

q) PSW (Program Status Word, 0D0h)


The program Status Word is used to store a number of important bits that are
set and cleared by 8051 instructions. The PSW SFR contains the carry flag, the
auxiliary carry flag, the parity flag and the overflow flag. Additionally, it also
contains the register bank select flags, which are used to select, which of the “R”
register banks currently in use.

r) SBUF (Serial Buffer, 99h)


SBUF is used to hold data in serial communication. It is physically two
registers. One is writing only and is used to hold data to be transmitted out of 8051 via
TXD. The other is read only and holds received data from external sources via RXD.
Both mutually exclusive registers use address 99h.

I/O ports:
One major feature of a microcontroller is the versatility built into the
input/output (I/O) circuits that connect the 8051 to the outside world. The main
constraint that limits numerous functions is the number of pins available in the 8051
circuit. The DIP had 40 pins and the success of the design depends on the flexibility
incorporated into use of these pins. For this reason, 24 of the pins may each used for
one of the two entirely different functions which depend, first, on what is physically
connected to it and, then, on what software programs are used to “program” the pins.

PORT 0
Port 0 pins may serve as inputs, outputs, or, when used together, as a bi
directional low-order address and data bus for external memory. To configure a pin as
input, 1 must be written into the corresponding port 0 latch by the program. When
used for interfacing with the external memory, the lower byte of address is first sent
via PORT0, latched using Address latch enable (ALE) pulse and then the bus is
turned around to become the data bus for external memory.

PORT 1
Port 1 is exclusively used for input/output operations. PORT 1 pins have no
dual function. When a pin is to be configured as input, 1 is to be written into the
corresponding Port 1 latch.

PORT 2
Port 2 maybe used as an input/output port. It may also be used to supply a
high –order address byte in conjunction with Port 0 low-order byte to address external
memory. Port 2 pins are momentarily changed by the address control signals when
supplying the high byte a 16-bit address. Port 2 latches remain stable when external
memory is addressed, as they do not have to be turned around (set to 1) for data input
as in the case for Port 0.

PORT 3
Port 3 may be used to input /output port. The input and output functions can
be programmed under the control of the P3 latches or under the control of various
special function registers. Unlike Port 0 and Port 2, which can have external
addressing functions and change all eight-port bits when in alternate use, each pin of
port 3 maybe individually programmed to be used as I/O or as one of the alternate
functions?

The Port 3 alternate uses are:


Table 2.1 shows the alternate function of port3
Pin No Alternate Use
P3.0 - RXD Serial data input
P3.1 - TXD Serial data output
P3.2 - INTO 0 External interrupt 0
P3.3 - INTO 1 External interrupt 1
P3.4 - T0 External Timer 0 input
P3.5 – T1 External timer 1 input
P3.6 - WR External memory write pulse
P3.7 - RD External memory read pulse-

INTERRUPTS:

Interrupts are hardware signals that are used to determine conditions that exist
in external and internal circuits. Any interrupt can cause the 8051 to perform a
hardware call to an interrupt –handling subroutine that is located at a predetermined
absolute address in the program memory.

Five interrupts are provided in the 8051. Three of these are generated
automatically by the internal operations: Timer flag 0, Timer Flag 1, and the serial
port interrupt (RI or TI) Two interrupts are triggered by external signals provided by
the circuitry that is connected to the pins INTO 0 and INTO1. The interrupts maybe
enable or disabled, given priority or otherwise controlled by altering the bits in the
Interrupt Enabled (IE) register, Interrupt Priority (IP) register, and the Timer Control
(TCON) register. . These interrupts are mask able i.e. they can be disabled. Reset is a
non maskable interrupt which has the highest priority. It is generated when a high is
applied to the reset pin. Upon reset, the registers are loaded with the default values.
Each interrupt source causes the program to do store the address in PC onto
the stack and causes a hardware call to one of the dedicated addresses in the program
memory. The appropriate memory locations for each for each interrupt are as follows:
Table 2.2 shows the memory location of interrupt
Interrupt Address
RESET 0000
IE0 (External interrupt 0) 0003
TF0 (Timer 0 interrupt) 000B
IE1 (External interrupt 1) 0013
TF1 (Timer 1 interrupt) 001B
SERIAL 0023

Oscillator Characteristics:
The heart of the 8051 circuitry that generates the clock pulses by which all the
internal all internal operations are synchronized. Pins XTAL1 And XTAL2 is
provided for connecting a resonant network to form an oscillator. Typically a quartz
crystal and capacitors are employed. The crystal frequency is the basic internal clock
frequency of the microcontroller. The manufacturers make 8051 designs that run at
specific minimum and maximum frequencies typically 1 to 16MHz
.
Fig 2.3 shows the oscillator and timing signal

3. Hardware Components

3.1 Introduction :

In this chapter we are going to cover all parts of “VECHILE


REGISTRATION USING SMART CARD” in detailed manner and their
functions in brief. Here we are more interested about the Microcontroller since it
is the heart of the project. So the complete architecture is explained and also
significance of the Microcontroller.

Components Used For Hardware Design:

1. LCD
2. SERIAL COMMUNICATION
3. MAX 232 DUAL DRIVER\RECEIVER
4. PC AT KEYBOARD
5. LATCH(74HC573)
6. SMART CARD
7. STEPPER MOTOR
8. PHOTO SENSOR
9. LED
10. POWER SUPPLY

3.2. Liquid Crystal Display

Introduction to LCD:
In recent years the LCD is finding widespread use replacing LED s (seven-
segment LED or other multi segment LED s). This is due to the following
reasons:
1. The declining prices of LCD s.
2. The ability to display numbers, characters and graphics. This is in
contract to LED s, which are limited to numbers and a few characters.
3. Incorporation of a refreshing controller into the LCD, there by relieving the
CPU of the task of refreshing the LCD. In the contrast, the LED must be
refreshed by the CPU to keep displaying the data.
4. Ease of programming for characters and graphics.
Fig 3.1 shows the front panel of lcd display

USES:
The LCD s used exclusively in watches, calculators and measuring
instruments is the simple seven-segment displays, having a limited amount of
numeric data. The recent advances in technology have resulted in better
legibility, more information displaying capability and a wider temperature range.
These have resulted in the LCD s being extensively used in telecommunications
and entertainment electronics. The LCD s has even started replacing the cathode
ray tubes (CRTs) used for the display of text and graphics, and also in small TV
applications.

Fig 3.2 shows the back panel of lcd display

Specifications

 Number of Characters: 16 characters x 2 Lines


 Character Table: English-European (RS in Datasheet)
 Module dimension: 80.0mm x 36.0mm x 13.2mm(MAX)
 View area: 66.0 x 16.0 mm
 Active area: 56.2 x 11.5 mm
 Dot size: 0.56 x 0.66 mm
 Dot pitch: 0.60 x 0.70 mm
 Character size: 2.96 x 5.46 mm
 Character pitch: 3.55 x 5.94 mm
 LCD type: STN, Positive, Transflective, Yellow/Green
 Duty: 1/16
 View direction: Wide viewing angle
 Backlight Type: yellow/green LED
 RoHS Compliant: lead free
 Operating Temperature: -20°C to + 70°C

LCD PIN DIAGRAM:

Fig 3.3 shows the pin configuration of lcd display


LCD pin description
The LCD discussed in this section has 14 pins. The function of each pin is given
in table.

TABLE 3.1 shows the Pin description for LCD:

Pin symbol I/O Description


1 Vss -- Ground
2 Vcc -- +5V power supply
3 VEE -- Power supply to
control contrast
4 RS I RS=0 to select
command register
RS=1 to select
data register
5 R/W I R/W=0 for write
R/W=1 for read
6 E I/O Enable

7 DB0 I/O The 8-bit data bus

8 DB1 I/O The 8-bit data bus

9 DB2 I/O The 8-bit data bus

10 DB3 I/O The 8-bit data bus

11 DB4 I/O The 8-bit data bus

12 DB5 I/O The 8-bit data bus


13 DB6 I/O The 8-bit data bus

14 DB7 I/O The 8-bit data bus

TABLE 3.2 shows the LCD Command Codes

Code(hex) Command to LCD Instruction


Register

1 Clear display screen

2 Return home

4 Decrement cursor

6 Increment cursor
5 Shift display right

7 Shift display left

8 Display off, cursor off

A Display off, cursor on

C Display on, cursor off

E Display on, cursor on

F Display on, cursor blinking

10 Shift cursor position to left

14 Shift cursor position to right

18 Shift the entire display to the left

1C Shift the entire display to the right

80 Force cursor to beginning of 1st line

C0 Force cursor to beginning of 2nd line

38 2 lines and 5x7 matrix

LCD INTERFACING

Sending commands and data to LCDs with a time delay:


Fig 3.4 shows the interfacing the lcd to microcontroller

To send any command from table 2 to the LCD, make pin RS=0. For data, make
RS=1.Then place a high to low pulse on the E pin to enable the internal latch of
the LCD.

3.3. Serial Communication

The information from micro controller is sent to system through serial


communication by using MAX-232 ic in between micro controller and RS232 DB9
connector. This MAX-232 acts as voltage level translator i.e., the TTL logic voltage
level is to be transformed to RS232 DB9 connector voltage level of the system. In
short a MAX –232 is nothing but a clamper circuit, which consists of diodes and
capacitors i.e., the voltage level translator. is done through clamping circuit here
diodes are inbuilt, whereas the capacitors are to be connected externally .

In order to connect micro controller to a modem or a pc to modem a serial port


is used. Serial is a very common protocol for device communication that is standard
on almost every PC. Most computers include two RS-232 based serial ports. Serial is
also a common communication protocol that is used by many devices for
instrumentation; numerous GPIB-compatible devices also come with an RS-232 port.
Furthermore, serial communication can be used for data acquisition in conjunction
with a remote sampling device
The concept of serial communication is simple. The serial port sends and receives
bytes of information one bit at a time. Although this is slower than parallel
communication, which allows the transmission of an entire byte at once, it is simpler
and can be used over longer distances. For example, the IEEE 488 specifications for
parallel communication state that the cabling between equipment can be no more than
20 meters total, with no more than 2 meters between any two devices. serial, however,
can extend as much as 1200 meters.
Typically, serial is used to transmit ASCII data. Communication is completed using 3
transmission lines: (1) Ground, (2) Transmit, and (3) Receive. Since serial is
asynchronous, the port is able to transmit data on one line while receiving data on
another. Other lines are available for handshaking, but are not required. The important
serial characteristics are baud rate, data bits, stop bits, and parity. For two ports to
communicate, these parameters must match.

Baud rate: It is a speed measurement for communication. It indicates the number


of bit transfers per second. For example, 300 baud is 300 bits per second. When a
clock cycle is referred it means the baud rate. For example, if the protocol calls for a
4800 baud rate, then the clock is running at 4800Hz. This means that the serial port is
sampling the data line at 4800Hz. Common baud rates for telephone lines are 14400,
28800, and 33600. Baud rates greater than these are possible, but these rates reduce
the distance by which devices can be separated. These high baud rates are used for
device communication where the devices are located together, as is typically the case
with GPIB devices.

Data bits: a measurement of the actual data bits in a transmission. When the
computer sends a packet of information, the amount of actual data may not be a full 8
bits. Standard values for the data packets are 5, 7, and 8 bits. Which setting choosen
depends on what information transferred? For example, standard ASCII has values
from 0 to 127 (7 bits). Extended ASCII uses 0 to 255 (8 bits). If the data being
transferred is simple text (standard ASCII), then sending 7 bits of data per packet is
sufficient for communication. A packet refers to a single byte transfer, including
start/stop bits, data bits, and parity. Since the number of actual bits depends on the
protocol selected, the term packet is used to cover all instances.

Stop bits: used to signal the end of communication for a single packet. Typical
values are 1, 1.5, and 2 bits. Since the data is clocked across the lines and each device
has its own clock, it is possible for the two devices to become slightly out of sync.
Therefore, the stop bits not only indicate the end of transmission but also give the
computers some room for error in the clock speeds. The more bits that are used for
stop bits, the greater the lenience in synchronizing the different clocks, but the slower
the data transmission rate.

Parity: a simple form of error checking that is used in serial communication.


There are four types of parity: even, odd, marked, and spaced. The option of using no
parity is also available. For even and odd parity, the serial port sets the parity bit (the
last bit after the data bits) to a value to ensure that the transmission has an even or odd
number of logic high bits. For example, if the data is 011, then for even parity, the
parity bit is 0 to keep the number of logic-high bits even. If the parity is odd, then the
parity bit is 1, resulting in 3 logic-high bits. Marked and spaced parity does not
actually check the data bits, but simply sets the parity bit high for marked parity or
low for spaced parity. This allows the receiving device to know the state of a bit to
enable the device to determine if noise is corrupting the data or if the transmitting and
receiving device clocks are out of sync.

WHAT IS RS –232C?
RS-232 (ANSI/EIA-232 Standard) is the serial connection found on IBM-
compatible PCs. It is used for many purposes, such as connecting a mouse, printer, or
modem, as well as industrial instrumentation. Because of improvements in line
drivers and cables, applications often increase the performance of RS-232 beyond the
distance and speed listed in the standard. RS-232 is limited to point-to-point
connections between PC serial ports and devices. RS-232 hardware can be used for
serial communication up to distances of 50 feet .

DB-9 pin connector


12345
6789

(out of computer and exposed end of cable)

Pin Functions:
Data: TxD on pin 3, RxD on pin 2
Handshake: RTS on pin 7, CTS on pin 8, DSR on pin 6,
CD on pin 1, DTR on pin 4
Common: Common pin 5(ground)
Other: RI on pin 9
The method used by RS-232 for communication allows for a simple connection of
three lines: Tx, Rx, and Ground. The three essential signals for 2 way RS-232
Communications are these:
TXD: carries data from DTE to the DCE.
RXD: carries data from DCE to the DTE
SG: signal ground

Here in our project DTE is the micro controller at the remote station and PC at
the base station, DCE is the modem at both the stations. However the data to be
transmitted, both sides have to be clocking the data at the same baud rate. Even
though this method is sufficient for most applications, it is limited in being able to
respond to problems such as the receiver getting overloaded. This is where serial
handshaking can help. This method uses actual hardware lines. There are two pairs of
hand shaking signals DTR/DSR and RTS/CTS.each pair has uses defined by the
standard. There are several ways to describe the state of RS-232 and other control
signals. A signal with a valid positive voltage may be described as true to indicate that
it is in the active state for example when DTR is true the data terminal is ready. to
bring the signal true the controlling device raises the line. A signal with a valid
negative voltage may be described as false or ff to indicate that it’s inactive state .for
example when DTR is false, the data terminal is not ready. To bring the signal false
the controlling device lowers the line.
The DTR/DSR handshake is intended for providing information about the
status of the phone line or other communications channel connected to the modem.
the terminal raises DTR to request the modem to connect to the communication
channel. In response the modem raises DSR to indicate that it is connected .DSR is
false when the modem is not connected to the communication channel or on detecting
a fault. the terminal may also raise DTR in response to RI (ring indicator) to tell the
modem to answer a call.

The RTS/CTS handshake provides additional information about whether a


device is ready to receive data. This signal pair provides a full handshake. when the
terminal has data to send ,it raises RTS (request to send). In response the modem
raises CTS (clear to send) to indicate that it is ready to receive. When the transmission
is finished the terminal may lower RTS. the modem should then be continue
processing whatever data it has received and lower CTS when it’s ready to respond to
the next RTS. When RTS is false, the terminal should wait for CTS to be false
before raising RTS to request a new transmission.

RI is true when a ringing signal is present on the communications channel.


The signal is true when the audible ring is present and false in the pauses between the
rings .The final control signal is the CD (carrier detect). The modem raises CD when
it detects a signal of expected frequency on the phone lines, indicating that a
connection has been established to a remote modem.

We have three types of connection between DTE AND DCE

1.without handshaking: In this situation, only the data lines and signal ground
are directly connected in the modem communication cable. All other pins have no
connection. The three-wire modem cable is often simple but can we use it in all
circumstances? There is a problem, if either of the two devices checks the DSR or CD
inputs. These signals normally define the ability of the other side to communicate. As
they are not connected, their signal level will never go high. This might cause a
problem.
The same holds for the RTS/CTS handshaking sequence. If the software on
both sides is well structured, the RTS output is set high and then a waiting cycle is
started until a ready signal is received on the CTS line. This causes the software to
hang because no physical connection is present to either CTS line to make this
possible. The only type of communication, which is allowed on such a modem line is
data-only traffic on the directly connected RX/TX lines.

2.loop back handshaking: The simple modem cable without handshaking shows
incompatibilities with common software. The main problem with this cable is that
there is a possibility for the software to hang if it checks the modem signal lines in a
proper way. I.e. with this modem cable, good written programs will perform worse
than badly written programs.
To overcome this problem and still be able to use a modem communication
cable with only three lines in it, a fake modem cable layout has been defined. The
modem cable with loop back handshaking resulted from this. The main purpose of
this modem cable is to let well-defined software think there is handshaking available,
with a modem cable, which has no provisions for it.

Consider first the DSR signal (pin 6). This input indicates that the other side is
ready to start communicating. In the layout, the line is linked back to the DTR output
(pin 4). This means, that the software doesn't see the ready signal of the other device,
but its own.
The same holds for the CD input (pin 1). The assumption is, that if software
has been written to check the DSR line to test communication availability, it will
probably also set the DTR output to indicate its own state. This is true for at least 99%
of all serial communication software. This implies that at least 99% of all serial
communication software is capable of faking its own DSR check with this modem
cable. The same trick is used with the CTS input. In the original use, RTS is set, and
then CTS is checked before starting the communication. By setting the RTS output
(pin 7) the CTS input on the same connector (pin 8) is receiving clearance
immediately. There is no possibility of a software hang-up because of dangling RTS
requests.

The modem cable with loop back handshaking is often advised as the best low
cost available modem cable. The simple modem cable without handshaking has the
disadvantage that it does not permit proper written software to communicate with it.
Software, which is aware of the lack of handshaking signals, can however use it
without problems.

The connection that is implemented in the project is the modem cable with
loop back connections since the project main focus is on transmitting, receiving and
not on the acknowledgements.

3.4. Max 232 --- Dual Driver/Receiver

FEATURES:
 Operates from a single 5V Power Supply with 1.0uF Charge-Pump
Capacitors
 Operates up to 120 k bit/s
 Two Drivers and Two Receivers
 ±30 V Input Levels
 Low Supply Current . . . 8 mA Typical
Upgrade with Improved ESD (15kV HBM) and 0.1uF Charge-Pump
Capacitors is available With the MAX202.
Applications-- TIA/EIA-232-F, Battery-Powered Systems, Terminals,
Modems, and Computers

DESCRIPTION:
The MAX232 is a dual driver/receiver that includes a
capacitive voltage generator to supply TIA/EIA-232-F voltage levels from a
single 5V supply. Each receiver converts TIA/EIA-232-F inputs to 5V
TTL/CMOS levels. These receivers have a typical threshold of 1.3V, a typical
hysteresis of 0.5 V, and can accept up to 30V inputs. Each driver converts
TTL/CMOS input levels into TIA/EIA-232-F levels.

PIN DIAGRAM OF MAX232

Fig 3.5 shows the pin diagram of max 232

FUNCTION TABLE

Fig 3.6 shows the function table of driver and receiver

LOGIC DIAGRAM (POSITIVE LOGIC)


Fig 3.7 shows the logic diagram of max 232

RECOMMENDED OPERATING CONDITIONS

Table 3.3 shows the operating conditions

PARAMETER MIN NOR MAX UNIT

VCC Supply voltage 4.5 5 V


5.5

VIH High-level input 2 V


voltage (T1IN,T2IN)

VIL Low-level input 0.8 V


voltage (T1IN, T2IN)

R1IN, R2IN Receiver input ± V


voltage 30

3.5. PC AT Keyboard

Features
• Interfacing Standard PC AT Keyboard• Requires Only Two I/O Pins. One of
them must be an External Interrupt Pin
• No Extra Hardware Required
• Complete Example in C, Implementing a Keyboard to Serial Converter

Introduction
Most microcontrollers requires some kind of a human interface. This design note
describes one way of doing this using a standard PC AT Keyboard

The Physical Interface


The physical interface between the keyboard and the host is shown in Figure 1. Two
signal lines are used, clock and data. The signal lines are open connector, with pull-up
resistors located in the
keyboard. This allows either the keyboard or the host system to force a line to low
level. Two connector types are available, the 5-pin DIN connector of “5D” type.

Interfacing PC AT Keyboard Application Note


Timing
The timing for the data transferred from the keyboard to the host . The
protocol is: one start bit (always 0), eight data bits, one odd parity bit and one stop bit
(always 1).
The data is valid during the low period of the clock pulse. The keyboard is generating
the clock signal, and the clock pulses are typically 30-50 s low and 30-50 s high.
The host system can send commands to the keyboard by forcing the clock line low. It
then pulls the data line low (the start bit). Now, the clock line must be released. The
keyboard will count 10 clock pulses.

The data line must be set up to the right level by the host before the trailing
edge of the clock pulse. After the 10th bit, the keyboard checks for a high level on the
data line (the stop bit), and if it is high, it forces it low. This tells the host that the data
is received by the keyboard.

Scan Codes
The AT keyboard has a scan code associated with each key. When a key is pressed,
this code is transmitted. If a key is held down for a while, it starts repeating. The
repeat rate is typically 10 per second. When a key is released, a “break” code ($F0) is
transmitted followed by the key scancode. For most of the keys, the scan code is one
byte. Some keys like the Home, Insert and Delete keys have an extended scan code,
from two to five bytes.

The Software
The code supplied with this application note is a simple keyboard to RS-232 interface.
The scan codes received from the keyboard are translated into appropriate ASCII
characters and transmitted by the UART. The source code is written in C, and is
easily modified and adaptable to all microconrollers with SRAM.

The algorithm
Keyboard reception is handled by the interrupt function

INT0_interrupt. The reception will operate independent of the rest of the program.
The algorithm is quite simple: Store the value of the data line at the leading edge of
the clock pulse. This is easily handled if the clock line is connected to the INT0 or
INT1 pin. The interrupt function will be executed at every edge of the clock cycle,
and data will be stored at the falling edge. After all bits are received, the data can be
decoded. This is done by calling the decode function. For character keys,
this function will store an ASCII character in a buffer. It will take into account if the
shift key is held down when a key is pressed. Other keys like function keys,
navigation keys (arrow keys, page up/down keys etc.) and modifier keys like Ctrl and
Alt are ignored. The mapping from scan codes to ascii characters are handled with
table look-ups, one table for shifted characters
and one for un-shifted.

3.6. LATCH (74HC573)

Basic Memory cell:


A basic memory cell is a circuit that store one bit of information. This one-bit
memory element is called a Flip-Flop or LATCH, since it latches (or locks) data in it.
A flip-flop has two out puts Q and Q , That are always complements of each
other. It can exist in two stable states: set and reset. In set state, Q IS HIGH (Logic 1)
and Q is low (logic 0);
Where as in reset state Q is HIGH (logic 1) and Q is LOW (logic 0). For a Flip-Flop
to act as a memory device, it should retain the information stored in it. Thus if it is
set state it should remain set and if it is in reset state, it should remain reset.
This function can be realized by using two NAND or NOR
inverters connected in a feed back loop as shown in figure

Basic memory cell

Truth table
Q A2 Q A1 Q
1 1 0 0 1
0 0 1 1 0

Fig 3.8 shows the basic memory cell and the truth tale

From the truth-table, if Q=1,it remains 1 and Q remains 0.If Q=0, it


remains 0 and Q
Remains 1.It is not possible to have both Q and Q IN THE SAME STATE (HIGH or
LOW) .
For this project 74HC573 LATCH is used .This is useful as input or output
port for microcontroller 89C51. This latch has the output capability of bus driver. It is
a 3-state non-inverting output for bus printed applications. The 74HC/HCT573 are
high-speed Si-gate CMOS devices and are pin compatible with low power TTL. It is a
D-type transparent latches having separate D-type inputs for each latch and 3-state
outputs for bus oriented applications. For 74HC573 latch enable (LE) input and an
output enable (OE) input are common to all latches. This contains eight D-type
transparent latches with 3-state true outputs. When LE is HIGH, data at the Dn inputs
enter the latches . In this condition the latches are transparent , i.e a latch output will
change state each time its corresponding D-input changes. When LE is LOW the
latches store the information that was present at the D-inputs a set-up time preceding
the HIGH-to-LOW transition of LE.

Fig 3.9 shows the pin configuration of latch


3.7. Smart Card

A small electronic device about the size of a credit card that contains electronic
memory, and possibly an embedded integrated circuit (IC). Smart cards containing an
IC are sometimes called Integrated Circuit Cards (ICCs).
Smart cards are used for a variety of purposes, including:
1 Storing a patient's medical records
2 Storing digital cash
3 Generating network IDs (similar to a token)
To use a smart card, either to pull information from it or add data to it, you need a
smart card reader, a small device into which you insert the smart card.
Contact Cards The most common type of smart card. Electrical contacts located on
the outside of the card connect to a card reader when the card is inserted.

Increased levels of processing power, flexibility and memory add cost. Single
function cards are often the most cost-effective solution. Choose the right type of
smart card for your application by evaluating cost versus functionality and determine
your required level of security. All of these variables should be weighted against the
expected lifecycle of the card. On average the cards typically comprise only 10 to 15
percent of the total system cost with the infrastructure, issuance, training and
advertising making up the other 85 percent. The following chart demonstrates some
general rules of thumb;

Memory Cards
Memory cards have no sophisticated processing power and cannot manage
files dynamically. All memory cards communicate to readers through synchronous
protocols. In all memory cards you read and write to a fixed address on the card.
There are three primary types of memory cards: 1). Straight, 2). Protected, and 3).
Stored Value.

1. Straight Memory Cards


These cards just store data and have no data processing capabilities. These
cards are the lowest cost per bit for user memory. They should be regarded as floppy
disks of varying sizes without the lock mechanism. These cards cannot identify
themselves to the reader, so your host system has to know what type of card is being
inserted into a reader. These cards are easily duplicated and cannot be tracked by on-
card identifiers.

2. Protected / Segmented Memory Cards


These cards have built-in logic to control the access to the memory of the card.
Sometimes referred to as Intelligent Memory cards, these devices can be set to write
protect some or all of the memory array. Some of these cards can be configured to
restrict access to both reading and writing. This is usually done through a password or
system key. Segmented memory cards can be divided into logical sections for planned
multi-functionality. These cards are not easily duplicated but can possibly be
impersonated by hackers. They typically can be tracked by an on-card identifier.
3. Stored Value Memory Cards
These cards are designed for the specific purpose of storing value or tokens.
The cards are either disposable or rechargeable. Most cards of this type incorporate
permanent security measures at the point of manufacture. These measures can include
password keys and logic that are hard-coded into the chip by the manufacturer. The
memory arrays on these devices are set-up as decrements or counters. There is little or
no memory left for any other function. For simple applications such as a telephone
card the chip has 60 or 12 memory cells, one for each telephone unit. A memory cell
is cleared each time a telephone unit is used. Once all the memory units are used, the
card becomes useless and is thrown away. This process can be reversed in the case of
rechargeable cards.

CPU/MPU Microprocessor Multifunction Cards


These cards have on-card dynamic data processing capabilities. Multifunction
smart cards allocate card memory into independent sections or files assigned to a
specific function or application. Within the card is a microprocessor or
microcontroller chip that manages this memory allocation and file access. This type of
chip is similar to those found inside all personal computers and when implanted in a
smart card, manages data in organized file structures, via a card operating system
(COS). Unlike other operating systems, this software controls access to the on-card
user memory. This capability permits different and multiple functions and/or different
applications to reside on the card, allowing businesses to issue and maintain a
diversity of ‘products’ through the card. One example of this is a debit card that also
enables building access on a college campus. Multifunction cards benefit issuers by
enabling them to market their products and services via state-of-the-art transaction
and encryption technology. Specifically, the technology enables secure identification
of users and permits information updates without replacement of the installed base of
cards, simplifying program changes and reducing costs. For the card user,
multifunction means greater convenience and security, and ultimately, consolidation
of multiple cards down to a select few that serve many purposes.
There are many configurations of chips in this category including chips that
support cryptographic PKI functions with on board math co-processors or Java virtual
machine hardware blocks. As a rule of thumb - the more functions the higher the cost.

Contact less Cards


These are smart cards that employ a radio frequency (RFID) between card and
reader without physical insertion of the card. Instead the card is passed along the
exterior of the reader and read. Types include proximity cards which are implemented
as a read-only technology for building access. These cards function with a limited
memory and communicate at 125 MHz. True read & write contact less cards were
first used in transportation for quick decrementing and re-loading of fare values where
their lower security was not an issue. They communicate at 13.56 MHz, and conform
to the ISO14443 standard. These cards are often straight memory types. They are also
gaining popularity in retail stored value, since they can speed-up transactions and not
lower transaction processing revenues (i.e. VISA and Mastercard), like traditional
smart cards.
Variations of the ISO14443 specification include A, B, and C, which specify chips
from either specific or various manufacturers. A=Philips B=Everybody else and
C=Sony chips. Contact less card drawbacks include the limits of cryptographic
functions and user memory versus microprocessor cards and the limited distance
between card and reader required for operation.
Combination Cards
These are hybrids that employ both contact and contact less technology in one
card. Combo-cards can also contain two different types of chips in contrast to a Dual-
Interface card where a single chip manages both functions.
Operating Systems
The two primary types of smart card operating systems 1). Fixed File
Structure and 2). Dynamic Application System. As with card types, selection of a card
OS depends on the application the card is developed for. The other defining difference
is in the Encryption Capabilities of the OS and the Chip. These are typically
distinguished by Symmetric Key and Public Key. See the security section of this site
for more information.
1). Fixed File Structure
This type treats the card as a secure computing and storage device. Files and
permissions are set in advance by the issuer. These specific parameters are ideal and
economical for a fixed type of card structure and functions that will not change in the
near future. An example of this kind of card is a low-cost employee multi-function
badge.
2). Dynamic Application System
This type of operating system, which includes the MULTOS and JAVA card
varieties, enables developers to build, test, and deploy different applications securely.
Because the OS and applications are more separate, updates can easily and repeatedly
be made. See our software page for more information. An example card is a SIM card
for mobile GSM where updates and security are downloaded to the phone and
dynamically changed

Smart Card Readers/Terminals


For the sake of clearly defining all of the different hardware devices that smart
cards can be plugged into, the industry has adopted the following definitions:
The term 'reader' is used to describe a unit that interfaces with a PC for the majority of
its processing requirements. In contrast a 'terminal' is a self-contained processing
device.
Both readers and terminals read and write to smart cards. Readers come in many form
factors and in a wide variety of capabilities. The easiest way to describe a reader is by
the method of it's interface to a PC. Smart card readers are available that interface to
RS232 serial ports, USB ports, PCMCIA slots, floppy disk slots, parallel ports,
infrared IRDA ports and keyboards and keyboard wedge readers.
Another difference in reader types is the on-board intelligence and
capabilities. Extensive price and performance differences exist between an industrial
strength intelligent reader that supports a wide variety of card protocols and a home
style win-card reader that only works with microprocessor cards and performs all
processing of the data in the PC.
The options in terminal choices are just as wide. Most units have their own
operating systems and development tools. They typically support other functions such
as magnetic-stripe reading, modem functions and transaction printing.

Smart Card Overview


A smart card, a type of chip card is a plastic card embedded with a computer
chip that stores and transacts data between users. This data is associated with either
value or information or both and is stored and processed within the card's chip, either
a memory or microprocessor. The card data is transacted via a reader that is part of a
computing system. Smart card-enhanced systems are in use today throughout several
key applications, including healthcare, banking, entertainment and transportation. To
various degrees, all applications can benefit from the added features and security that
smart cards provide. According to Dataquest, the worldwide smart card market will
grow to 6.8 Billion units and $11 Billion by 2006.
Applications
First introduced in Europe over a decade ago, smart cards debuted as a stored
value tool for pay phones to reduce theft. As smart cards and other chip-based cards
advanced, people found new ways to use them, including charge cards for credit
purchases and for record keeping in place of paper.
In the U.S., consumers have been using chip cards for everything from visiting
libraries to buying groceries to attending movies, firmly integrating them into our
everyday lives. Several states have chip card programs in progress for government
applications ranging from the Department of Motor Vehicles to Electronic Benefit
Transfer (EBT). Many industries have implemented the power of smart cards into
their products such as the new GSM digital cellular phones to TV-satellite decoders.
Why Smart Cards
Smart cards greatly improve the convenience and security of any transaction.
They provide tamper-proof storage of user and account identity. Smart cards also
provide vital components of system security for the exchange of data throughout
virtually any type of network. They protect against a full range of security threats,
from careless storage of user passwords to sophisticated system hacks. Multifunction
cards can also serve as network system access and store value and other data. People
worldwide are now using smart cards for a wide variety of daily tasks, these include:
Loyalty and Stored Value
A primary use of smart cards is stored value, particularly loyalty programs that
track and incentives repeat customers. Stored value is more convenient and safer than
cash. For issuers, float is realized on unspent balances and residuals on balances that
are never used.
For multi-chain retailers that administer loyalty programs across many
different businesses and Point of sale systems, smart cards can centrally locate and
track all data. The applications are numerous, from parking and laundry to gaming, as
well as all retail and entertainment uses. Securing Information and Physical Assets In
addition to information security, smart cards achieve greater physical security of
services and equipment, because the card restricts access to all but the authorized
user(s). E-mail and PCs are being locked-down with smart cards. Information and
entertainment is being delivered via to the home or PC. Home delivery of service is
encrypted and decrypted per subscriber access. Digital video broadcasts accept smart
cards as electronic keys for protection. Smart cards can also act as keys to machine
settings for sensitive laboratory equipment and dispensers for drugs, tools, library
cards, health club equipment etc.
E-Commerce
Smart cards make it easy for consumers to securely store information and cash
for purchasing. The advantages they offer consumers are:
The card can carry personal account, credit and buying preference information that
can be accessed with a mouse click instead of filling out forms. Cards can manage and
control expenditures with automatic limits and reporting. Internet loyalty programs
can be deployed across multiple vendors with disparate POS systems and the card acts
as a secure central depository for points or rewards. Micro Payments - paying nominal
costs without transaction fees associated with credit cards or for amounts too small for
cash, like reprint charges.
Personal Finance
As banks enter competition in newly opened markets such as investment
brokerages, they are securing transactions via smart cards at an increased rate. This
means:
Smart cards increase trust through improved security. Two-Factor
Authentication insures protection of data and value across the internet. Threats such
as the "Man in the middle" and "Trojan Horses" that replay a user name and password
are eliminated
This will improve customer service. Customers can use secure smart cards for fast,
24-hour electronic funds transfers over the internet
Costs are reduced: transactions that normally would require a bank employee's time
and paperwork can be managed electronically by the customer with a smart card
Health Care
The explosion of health care data brings up new challenges to the efficiency of
patient care and privacy safeguards. Smart cards solve both challenges with secure
storage and distribution of everything from emergency data to benefits status.
Rapid identification of patients; improved treatment A convenient way to carry data
between systems or to sites without systems Reduction of records maintenance costs
Network Security
Business to business Intranets and Virtual Private Networks “VPNs” are
enhanced by the use of smart cards. Users can be authenticated and authorized to have
access to specific information based on preset privileges. Additional applications
range from secure email to electronic commerce.
Physical Access
Businesses and universities of all types need simple identity cards for all employees
and students. Most of these people are also granted access to certain data, equipment
and departments according to their status. Multifunction, microprocessor-based smart
cards incorporate identity with access privileges and also store value for use in
various locations, such as cafeterias and store.
3.8. Stepper Motor

These motors are also called stepping motors or step motors. This
name is used because this motor rotates trough a fixed angular step in response
to each input current pulse received by its controller. In the recent years, there
has been wide demand of stepping motors because of the explosive growth of
the computer industry. This popularity is due to the fact that they can be
directly controlled by computers, microprocessors and programmable
controllers.

As we know industrial motors are used to convert electric into


mechanical energy but they cannot be used for precision positioning of an
object. These stepper motors are ideally suited for situations where precise
positioning is required.

When a command pulse is received each time the output shaft


rotates in a series of discrete angular intervals. When number of pulses
supplied are definite then shaft of the stepper motor turns through definite
known angle. This makes stepper motor suited for open loop position control
because no feedback need to be taken from the shaft.
Such motors develop some torques ranging from 1Mn-m. In a tiny wristwatch
motor of 3mm diameter, up to 40N-M in a motor of 15cm diameter suitable for
machine tool applications. Power output ranges from 1Wto a max of 2500W.
The only moving party in a stepper motor is its rotor, which has no windings,
commutator or brushes. This feature makes it quite robust and reliable.
Step Angle: The angle through which motor shaft rotates for each command is
called the step angle. Smaller the stepper angle, greater the no. of steps for
revolution and higher the resolution or accuracy of positioning obtained. The
step angle can be as small as 0.72 degrees as large as 90 degrees. But most
common step sizes are 1.8, 2.5, 7.5 and 15.
A=(Ns-Nr/Ns-Nr)*360
Ns = step angle in terms of stator poles
Nr = step angle in terms of rotor.
A = 360/mNr = 360/(no. of stator phases * no. of rotor
teeth)
Resolution is given by the number of steps needed to complete one revolution
of the rotor shaft. Higher the resolution greater the extraordinary ability to
operate at very high stepping rates up to (20,000 steps 1 second)
Operation at high speeds is called slewing.
Stepping motors come in two varieties, permanent magnet
and variable reluctance (there are also hybrid motors, which are
indistinguishable from permanent magnet motors from the controller's point of
view). Lacking a label on the motor, you can generally tell the two apart by feel
when no power is applied. Permanent magnet motors tend to "cog" as you twist
the rotor with your fingers, while variable reluctance motors almost spin freely
(although they may cog slightly because of residual magnetization in the rotor).
You can also distinguish between the two varieties with an ohmmeter. Variable
reluctance motors usually have three (sometimes four) windings, with a
common return, while permanent magnet motors usually have two independent
windings, with or without center taps. Center-tapped windings are used in
unipolar permanent magnet motors.
Stepping motors come in a wide range of angular resolution. The
coarsest motors typically turn 90 degrees per step, while high- resolution
permanent magnet motors are commonly able to handle 1.8 or even 0.72
degrees per step. With an appropriate controller, most permanent magnet and
hybrid motors can be run in half steps, and some controllers can handle smaller
fractional steps or micro steps.
For both permanent magnet and variable reluctance stepping motors, if
just one winding of the motor is energized, the rotor (under no load) will snap
to a fixed angle and then hold that angle until the torque exceeds the holding
torque of the motor, at which point, the rotor will turn, trying to hold at each
successive equilibrium point.
Fig 3.10 shows the stepper motor

Variable Reluctance Motors


If your motor has three windings, typically connected as shown in the
schematic diagram in Figure 1.1, with one terminal common to all windings, it
is most likely a variable reluctance stepping motor. In use, the common wire
typically goes to the positive supply and the windings are energized in
sequence.

Fig 3.11 shows the variable reluctance motor


The cross section shown in Figure 1.1 is of 30 degree per step variable
reluctance motor. The rotor in this motor has 4 teeth and the stator has 6 poles,
with each winding wrapped around two opposite poles. With winding number 1
energized, the rotor teeth marked X are attracted to this winding's poles. If the
current through winding 1 is turned off and winding 2 is turned on, the rotor
will rotate 30 degrees clockwise so that the poles marked Y line up with the
poles marked 2.
To rotate this motor continuously, we just apply power to the 3 windings in
sequence. Assuming positive logic, where a 1 means turning on the current
through a motor winding, the following control sequence will spin the motor
illustrated in Figure 1.1 clockwise 24 steps or 2 revolutions:
Winding 1 1001001001001001001001001
Winding 2 0100100100100100100100100
Winding 3 0010010010010010010010010
Time --->
There are also variable reluctance stepping motors with 4 and 5 windings,
requiring 5 or 6 wires. The principle for driving these motors is the same as that
for the three winding variety, but it becomes important to work out the correct
order to energize the windings to make the motor step nicely.

Unipolar Motors

Fig 3.12 shows the unipolar motor


Unipolar stepping motors, both Permanent magnet and hybrid stepping motors
with 5 or 6 wires are usually wired as shown in the schematic in Figure 1.2,
with a center tap on each of two windings. In use, the center taps of the
windings are typically wired to the positive supply, and the two ends of each
winding are alternately grounded to reverse the direction of the field provided
by that winding.
The motor cross section shown in Figure 1.2 is of a 30 degree per step
permanent magnet or hybrid motor -- the difference between these two motor
types is not relevant at this level of abstraction. Motor winding number 1 is
distributed between the top and bottom stator pole, while motor winding
number 2 is distributed between the left and right motor poles. The rotor is a
permanent magnet with 6 poles, 3 souths and 3 norths, arranged around its
circumference.
For higher angular resolutions, the rotor must have proportionally more poles.
The 30- degree per step motor in the figure is one of the most common
permanent magnet motor designs, although 15 and 7.5 degree per step motors
are widely available. Permanent magnet motors with resolutions as good as 1.8
degrees per step are made, and hybrid motors are routinely built with 3.6 and
1.8 degrees per step, with resolutions as fine as 0.72 degrees per step available.
As shown in the figure, the current flowing from the center tap of winding 1 to
terminal a causes the top stator pole to be a north pole while the bottom stator
pole is a south pole. This attracts the rotor into the position shown. If the power
to winding 1 is removed and winding 2 is energized, the rotor will turn 30
degrees, or one step.
To rotate the motor continuously, we just apply power to the two windings in
sequence. Assuming positive logic, where a 1 means turning on the current
through a motor winding, the following two control sequences will spin the
motor illustrated in Figure 1.2 clockwise 24 steps or 4 revolutions:
Winding 1a 1000100010001000100010001
Winding 1b 0010001000100010001000100
Winding 2a 0100010001000100010001000
Winding 2b 0001000100010001000100010
time --->

Winding 1a 1100110011001100110011001
Winding 1b 0011001100110011001100110
Winding 2a 0110011001100110011001100
Winding 2b 1001100110011001100110011
time --->
3.9. Photo Sensor

This sensor consists of IR transmitter and receivers on a single plain. Where


Infrared (IR) radiation is part of the electromagnetic spectrum, which includes
radio waves, microwaves, visible light, and ultraviolet light, as well as gamma
rays and X-rays.

The IR range falls between the visible portion of the spectrum and
radio waves. IR wavelengths are usually expressed in microns, with the lR
spectrum extending from 0.7 to 1000microns.
Using advanced optic systems and detectors, non-contact IR
thermometers can focus on nearly any portion or portions of the0.7-14 micron
band. Because every object (with the exception of a blackbody) emits an
optimum amount of IR energy at a specific point along the IR band, each
process may require unique sensor models with specific optics and detector
types.

For example, a sensor with a narrow spectral range center data 3.43
microns is optimized for measuring the surface temperature of polyethylene and
related materials. A sensor set up for 5 microns is used to measure glass surfaces.
A micron sensor is used for metals and foils. The broader spectral ranges are
used to measure lower temperature surfaces, such as paper, board, poly, and foil
composites.
The intensity of an object's emitted IR energy increases or decreases in
proportion to its temperature. It is the emitted energy, measured as the target's
emissivity that indicates an object's temperature.

Emissivity is a term used to quantify the energy-emitting


characteristics of different materials and surfaces. IR sensors have adjustable
emissivity settings, usually from 0.1 to 1.0, which allow accurate temperature
measurements of several surface types.
The emitted energy comes from an object and reaches the IR sensor through its
optical system, which focuses the energy onto one or more photosensitive
detectors. The detector then converts the IR energy into an electrical signal,
which is in turn converted into a temperature value

Based on the sensor's calibration equation and the target's


emissivity. This temperature value can be displayed on the sensor or, in the case
of the smart sensor, converted to a digital output and displayed on a computer
terminal.
IR remote controls use wavelengths between 850 - 950nm. At
this short wavelength, the light is invisible to the human eye, but a domestic
camcorder can actually view this portion of the electromagnetic spectrum.
Viewed with a camcorder, an IR LED appears to change brightness.
All remote controls use an encoded series of pulses, of which there are thousands
of combinations. The light output intensity varies with each remote control;
remotes working at 4.5V dc generally will provide a stronger light output than a
3V dc control. Also, as the photodiode in this project has a peak light response at
850nm, it will receive a stronger signal from controls operating closer to this
wavelength. The photodiode will actually respond to IR wavelengths from
400nm to 1100nm, so all remote controls should be compatible.
A sensor is a type of transducer, or mechanism, which responds to a type
of energy by producing another type of energy signal, usually electrical. They are
either direct indicating (an electrical meter) or are paired with an indicator
(perhaps indirectly through an analog to digital converter, a computer and a
display) so that the value sensed is translated for human understanding. Types of
sensors include electromagnetic, chemical, biological and acoustic. Aside from
other applications, sensors are heavily used in medicine, industry& robotics.

In order to act as an effectual sensor, the following guidelines must be met:


• the sensor should be sensitive to the measured property
• the sensor should be insensitive to any other property
• the sensor should not influence the measured property
In theory, when the sensor is working perfectly, the output signal of a sensor is
exactly proportional to the value of the property it is meant to measure. The gain
is then defined as the ratio between output signal and measured property. For
example, if a sensor measures temperature and has an actual voltage output, the
gain is a constant with the unit.

When the sensor is not perfect, various deviations can occur, including gain
error, long term drift, and noise. These and other deviations can be classified as
systematic, or random, errors. Systematic deviations may be compensated for by
means of some kind of calibration strategy. Noise is an example of a random
error that can be reduced by signal processing, such as filtering, usually at the
expense of the dynamic behavior of the sensor.

A sensor network is a computer network of spatially distributed devices using


sensors to monitor conditions (such as temperature, sound, vibration, pressure,
motion or pollutants) at a variety of locations. Usually the devices are small and
inexpensive, allowing them to be produced and deployed in large numbers; this
constrains their resources in terms of energy, memory, and computational speed
and bandwidth. Each device is equipped with a radio transceiver, a small micro
controller, and an energy source, most commonly a battery. The devices work off
each other to deliver data to the computer which has been set up to monitor the
information. Sensor networks involve three areas: sensing, communications, and
computation (hardware, software, algorithms). They are applied in many areas,
such as video surveillance, traffic monitoring, home monitoring and
manufacturing.

PRINCIPlE:

Transmitter and receiver are incorporated in a single housing. The


modulated infrared light of the transmitter strikes the object to be detected and is
reflected in a diffuse way. Part of the reflected light strikes the receiver and starts
the switching operation. The two states – i.e. reflection received or no reflection
– are used to determine the presence or absence of an object in the sensing range.

This system safely detects all objects that have sufficient reflection. For objects
with a very bad degree of reflection (matt black rough surfaces) the use of
diffuse reflection sensors for short ranges or with background suppression is
recommended.

FIG 3.13 shows the PHOTO TRANSMITTER

FIG 3.14: RECEIVER CHARACTERISTICS


Sensitivity setting - Diffuse reflection sensors

For diffuse reflection sensors with sensitivity setting the sensitivity should
always be set to maximum independent of the required range in order to achieve
the highest possible operational safety. Only in the case of interfering
backgrounds (walls, machine parts) could it be necessary to reduce the range.

Diffuse reflection sensors for short ranges

Short-range diffuse type sensors are diffuse reflection sensors which have been
specifically designed for short ranges. Light and dark objects are almost equally
detectable within the set sensing ranging.

FIG 3.15: Diffuse reflection sensors for short ranges


Short-range diffuse types have high excess gains which allow usage even under
extreme environmental conditions (e.g. dust, mist etc.). Objects outside the range
are not detected.

Diffuse reflection sensor with foreground suppression


Diffuse reflection sensors with foreground suppression are the preferred choice
in the case of well reflecting backgrounds and less well reflecting objects. They
are adjusted to the background (background serves as reflector). Reflections
from the foreground are evaluated as an interruption of the light beam.

Diffuse reflection sensor with background suppression


Diffuse reflection sensors with background suppression limit the range to
adjustable, geometrically defined areas. This makes it possible to optically
suppress
interfering elements (e.g. shining machine parts) behind the object to be sensed.
Objects within the range are detected largely independent of their reflective
characteristics (colour, size, surface). Thus the effective range does not depend
on the target objects, but only on the set range.

Fig 3.16 shows the diffuse reflection sensor with background suppression
3.10. Power Supply

Description
A variable regulated power supply, also called a variable bench power supply,
is one where you can continuously adjust the output voltage to your requirements.
Varying the output of the power supply is the recommended way to test a project after
having double checked parts placement against circuit drawings and the parts
placement guide.

This type of regulation is ideal for having a simple variable bench power
supply. Actually this is quite important because one of the first projects a hobbyist
should undertake is the construction of a variable regulated power supply. While a
dedicated supply is quite handy e.g. 5V or 12V, it's much handier to have a variable
supply on hand, especially for testing.

Most digital logic circuits and processors need a 5 volt power supply. To use
these parts we need to build a regulated 5 volt source. Usually you start with an
unregulated power supply ranging from 9 volts to 24 volts DC To make a 5 volt
power supply, we use a LM7805 voltage regulator IC (Integrated Circuit). The IC is
shown below.

Fig 3.17 shows the voltage regulator


IC 7508
The LM7805 is simple to use. You simply connect the positive lead of your
unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin,
connect the negative lead to the common pin and then when you turn on the power,
you get a 5 volt supply from the Output pin.

Block Diagram:

Fig 3.18 shows the block diagram of power supply

Circuit Features:
Brief description of operation: Gives out well regulated +5V output, output
current capability of 100 mA Circuit protection: Built-in overheating protection shuts
down output when regulator IC gets too hot Circuit complexity: Very simple and
easy to build Circuit performance: Very stable +5V output voltage, reliable operation
Availability of components: Easy to get, uses only very common basic components
Design testing: Based on datasheet example circuit, I have used this circuit
successfully as part of many electronics projects Applications: Part of electronics
devices, small laboratory power supply Power supply voltage: Unregulated DC 8-
18V power supply Power supply current: Needed output current + 5 mA Component
costs: Few dollars for the electronics components + the input transformer cost.

PEAK INVERSE VOLTAGE:


Suppose Vm is the maximum voltage across the half secondary winding
at the instant secondary voltage reaches its maximum value in the positive direction.
At this instant D1 is conducting while D2 is not conducting. Therefore whole of the
secondary voltage appears across the non-conducting diode. Consequently the peak
inverse voltage is twice the maximum voltage across the half secondary winding.

FILTER CIRCUIT:
A filter circuit is a device which removes the ac component of rectifier
output but allows the dc component to the load.
The most commonly used filter circuits are capacitor filter, choke input
filter and capacitor input filter or pi-filter. We used capacitor filter here.

CAPACITOR FILTER: This consists of a capacitor C placed across the rectifier


output in parallel with the load RL. The pulsating direct voltage of the rectifier is
applied across the capacitor. As the rectifier voltage increases , it charges the
capacitor and also supplies current to the load. At the end of quarter cycle the
capacitor is charged to the peak value Vm of the rectifier voltage. Now the rectifier
voltage starts to decrease. As this occurs the capacitor discharges through the load and
the voltage across it decrease. The voltage across load will decrease only slightly
because immediately the next voltage peak comes and recharges the capacitor. This
process is repeated again and again. At the output very little ripple is left. Moreover
output voltage is higher as it remains substantially near the peak value of rectifier
output voltage.
The capacitor filter circuit is extremely popular because of its low cost, small
size, little weight and good characteristics. For small load currents this type of filter is
preferred. it is commonly used in transistor radio battery eliminators.

R e c tif ie r O /P C RL

C a p a c ito r F ilte r

Fig 3.19 shows the circuit of capacitor filer

HEAT SINK:
More often transistors gets heated when the circuit is ON for long time.
In order to avoid heating up of transistors we use heat sinks.
4. BLOCK AND SCHEMATIC DIAGRAM

4.1 Block Diagram

Fig 4.1 shows the block diagram of project


Block Diagram Explanation

Microcontrollers:

In this project the micro-controller is playing a major role. Micro-


controllers were originally used as components in complicated process-control
systems. However, because of their small size and low price, Micro-controllers are
now also being used in regulators for individual control loops. In several areas
Micro-controllers are now outperforming their analog counterparts and are cheaper
as well.

In our project we have two sections; one is transmitter another one is


receiver. In transmitting section we have AT89S51 Microcontroller; in receiver
section we have another AT89C51 Microcontroller. The purpose of this project
work is to transmit the data securely by the method encryption. For that purpose we
are controlling the encoder in the transmitter section and decoder in the receiver
section by using two micro controllers.

It is assumed that a Microcontroller with reasonable software is available for


computations and simulations so that many tedious details can be left to the
Microcontroller. The control system design is also carried out up to the stage of
implementation in the form of controller programs in assembly language OR in C-
Language.

Smart Card Reader

This smart card reader is used to detect the information from the smart card ..
the reader will generates the electromagnetic waves . When the smart card is
detected the information will be passed to microcontroller through serial
communication

Switching unit

For switching unit we are using IC CD4016BC is used. It is bilateral switch


intended for the transmission or multiplexing of analog of digital signals. The
CD4016B is composed of 4, two transistor analog switches. These switches do not
have any linearization or compensation circuitry for Ron. At low supply voltages,
<5v the CD4016B’s on resistance becomes non linear . it is recommended that at
5v, voltages on the in/out pins be maintained within about 1v of either VDD of
VSS. And that at 3V the voltages on the In/out pins should be at VDD or VSS for
reliable operation.

Max232:

The MAX232 is a dual driver/receiver that includes a capacitive voltage generator


to supply TIA/EIA-232-F voltage levels from a single 5V supply. Each receiver
converts TIA/EIA-232-F inputs to 5V TTL/CMOS levels. These receivers have a
typical threshold of 1.3V, a typical hysteresis of 0.5 V, and can accept up to 30V
inputs. Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels

AT keyboard:

The code supplied with this application note is a simple keyboard to RS-232
interface. The scan codes received from the keyboard are translated into appropriate
ASCII characters and transmitted by the UART. The source code is written in C,
and is easily modified and adaptable to all microcontrollers with SRAM.
4.2 Schematic Diagram

Schematic Diagram for Transmitter Side


Fig 4.2 shows the circuit diagram of transmitter
Schematic Diagram Receiver side
Fig 4.3 shows the circuit diagram of receiver

Schematic Diagram Stepper motor

Fig 4.4 shows the circuit diagram of stepper motor


SCHEMATIC EXPLANATION:
This schematic explanation includes the detailed pin connections of every
device with the microcontroller.
Let us see the pin connections of each and every device with the
microcontroller in detail.
Power Supply:
The main aim of this power supply is to convert the 230V AC
into 5V DC in order to give supply for the TTL or CMOS devices. In this
process we are using a step down transformer, a bridge rectifier, a smoothing
circuit and the RPS.
At the primary of the transformer we are giving the 230V AC supply. The
secondary is connected to the opposite terminals of the Bridge rectifier as the
input. From other set of opposite terminals we are taking the output to the
rectifier.
The bridge rectifier converts the AC coming from the secondary of the
transformer into pulsating DC. The output of this rectifier is further given to the
smoother circuit which is capacitor in our project.
The smoothing circuit eliminates the ripples from the pulsating DC and
gives the pure DC to the RPS to get a constant output DC voltage. The RPS
regulates the voltage as per our requirement.

Microcontroller:
The microcontroller AT89S51 with Pull up resistors at Port0 and crystal
oscillator of 11.0592 MHz crystal in conjunction with couple of capacitors of is
placed at 18th & 19th pins of 89S51 to make it work (execute) properly.

Reflection Sensors:
These reflection sensors are arranged in such a manner to detect the Vehicles.
These sensors are connected to the P2.0 port of the microcontroller.

LCD module:
This module is used to display the status of the devices.
This module consists of 8 data lines D0 – D7, which are connected to the
8 pins of port1 (P0). Additionally this module is having 3 control lines namely
RS, RW and EN, which are connected to the port3 higher pins P3.5, P3.6 and
P3.7 respectively. And the supply connections are given from the Power supply
output 7805 to the VCC and VSS. And same configuration with be setup at
receiver end also.

Max 232

This module is used for the voltage conversion between Micro


controller and smart card reader. Is consists of two I/O inputs. One will be used
for smart card reader and another is used for to get the response from the receiver
end
.
Switching unit

This module is used for switching between two I/O pins of Max 232 and the Tx
and Rx pins
Of microcontroller i.e. P3.0 and P3.1
These two I/O will be control by the microcontroller pin P2.5 and
P2.6 which used as a control signal for switching unit

ATKEY Board

This module is used to enter the data in to microcontroller. For that keyboard
is connect to P3.2 and P3.4. Where P3.4 is used to generate clock frequency and
P3.2 is used to send ASCII value data

Devices:
The device stepper motor is connected to the port pins P0.0 to P0.4 of the
microcontroller through latch 47HC573 and ULN2903 driver. Latch is used to
enable the stepper motor and ULN2903 driver is used to drive the stepper motor.
Opto couples are used to isolate the ground between two power supply

Key pad
Four switches are used as a keypad. Keypad is used at the receiver side to give
a response to the transmitter side which is connected to the port P1.0 to P1.3 of
microcontroller at receiver side

5. SOFTWARE COMPONENT
5.1 Introduction of Keil Software

This software is used for execution of microcontroller programs. Keil


development tools for the MC architecture support every level of software developer
from the professional applications engineer to the student just learning about
embedded software development. The industry-standard keil C compilers, macro
assemblers, debuggers, real, time Kernels, Single-board computers and emulators
support all avr derivatives and help you to get more projects completed on schedule.

The keil software development tools are designed to solve the complex
problems facing embedded software developers. When starting a new project, simply
select the microcontroller you the device database and the µvision IDE sets all
compiler, assembler, linker, and memory options for you. Numerous example
programs are included to help you get started with the most popular embedded avr
devices.

The keil µ Vision debugger accurately simulates on-chip peripherals (PC,


CAN, UART, SPI, Interrupts, I/O ports, A/D converter, D/A converter and PWM
modules)of your avr device. Simulation helps you understand h/w
Configurations and avoids time wasted on setup problems. Additionally with
simulation, you can write and test applications before target h/w is available.

5.2 FLOW CHART


Flow Chart for Authorized Person (with Vehicles)
Flow Chart for UN/Authorized (without Vehicles)
Flow Chart for Receiver side
5.3 SOURCE CODE
AT MASTER SIDE

Main Program Coding

#include <stdio.H>
#include <AT89X52.H>
#include "headerFile.h"
#include <string.h>
volatile unsigned char pFlag=0;
extern volatile unsigned char fst,sFlag;
extern volatile unsigned char fFlag;
int main(void)
{
unsigned char opt;
BUZZER = 0;
DISABLE
STEP_LE = 1;
STEPPORT = (STEPPORT && 0x0F)|| 0x00;
STEP_LE = 0;
lcdInit();
serInit();
putStrL("Vehicle Registration Using Smartcard",0x01);
delay(1500);
while(1)
{
if(VEHICLEINT == 0)
{
putStrL("Vehicle Identified at Main Gate",0x01);
delay(1500);
putStrL("Processing! Please Wait.....................",0x01);
delay(1500);
chk_ID();
if(sFlag == 1)
{
putStrL("Request Granted!You may go now!",0x01);
openGate();
delay(1000);
}
else
{
putStrL("ID Check Failed!Select Option",0x01);
delay(1500);
putStrL("1.Authorised 2.Unauthorised",0x01);
delay(1500);
keyboard_Init();
opt = getAtkey();
if(opt == '1')
aProcess();
else if(opt == '2')
uProcess();
else
{
putStrL("Oooops!Transaction Cancelled!",0x01);
delay(1500);
}
}
}
putStrL("VRS Welcomes U!!Plz Cooperate Us!",0x01);
delay(1500);
putStrL("Plz Follow Instructions!",0x01);
delay(1500);
}
}
/*...........................Authorised Processing...................................................*/
void aProcess(void)
{
unsigned char *psw,chance;
chance = 3;
while(chance--)
{
keyboard_Init();
putStrL("Enter Password:",0x01);
putComL(0xC0);
delay(100);
psw = getData();
disable_kb();
putStrL(psw,0x01);
delay(1000);
chkPsw(psw);
if(pFlag == 1)
{
pFlag = 0;
putStrL("Password Accepted!",0x01);
delay(1000);
putStrL("Request Granted!You may go now!",0x01);
openGate();
delay(1000);
break;
}
else if(fFlag == 0)
{
putStrL("Password Rejected",0x01);
delay(1000);
continue;
}
else
{
fFlag = 0;
putStrL("Oooops!Transaction Cancelled",0x01);
delay(1000);
continue;
}
}
}
/*...........................Unauthorised Processing...................................................*/
void uProcess(void)
{
unsigned char *no,*name,*from,sResp;
DISABLE
delay(100);
SLAVE
putStrL("Plz Provide UR Info For Permission",0x01);
delay(1000);
keyboard_Init();
putStrL("Flat No:",0x01);
putComL(0xC0);
delay(1000);
no = getData();
putStrL("Name:",0x01);
putComL(0xC0);
delay(1000);
name = getData();
putStrL("From:",0x01);
putComL(0xC0);
delay(1000);
from = getData();
disable_kb();
putStrL("Transmitting to Slave.....",0x01);
delay(1000);
putStrS(no);
putCharS(0x0D);
delay(1000);
putStrS(name);
putCharS(0x0D);
delay(1000);
putStrS(from);
putCharS(0x0D);
putStrL("Waiting for Slave Response.........!",0x01);
delay(500);
sResp = getCharS();
sResp = getCharS();
putComL(0x01);
putCharL(sResp);
delay(1000);
if(sResp == 'Y')
{
putStrL("Request Granted!You may go now!",0x01);
openGate();
delay(1500);
}
else if(sResp == 'N')
{
putStrL("Sorry!!Request Rejected!",0x01);
delay(1500);
}
}
/*.........................................PSW Check....................................................*/
void chkPsw(unsigned char *val)
{
unsigned char *user = "4321";
putStrL("Verifying Password.........",0x01);
delay(1000);
if(strcmp(val,user)==0)
pFlag = 1;
}
void openGate(void)
{
sendStepper('F',0x05); //sendStepper(Forward/Backward,No.of Rotations)

delay(1000);
sendStepper('B',0x05);
}
void sendStepper(unsigned char udFlag,unsigned char stepCount)
{
code unsigned char upTable[5] = {0x10,0x20,0x40,0x80};
code unsigned char downTable[5] = {0x80,0x40,0x20,0x10};
unsigned char i,j,temp;
STEP_LE = 1;
for(i=0;i<=stepCount;i++)
{
for(j=0;j<4;j++)
{
temp = (STEPPORT & 0x0F);
if(udFlag == 'F')
STEPPORT = temp | upTable[j];
else
STEPPORT = temp | downTable[j];
delay(130);
}
}
STEPPORT = (STEPPORT & 0x0F) | 0x00;
STEP_LE = 0;
}
/*.........................................delay....................................................*/
void delay(unsigned int del)
{
unsigned int i,j;
for(i=0;i<=del;i++)
for(j=0;j<=109;j++);
}
/*.........................................beep....................................................*/
void beep(unsigned int dur)
{
BUZZER = 1;
delay(dur);
BUZZER = 0;
}
/*.........................................Transmitting to PC....................................................*/
/*
void send2pc(unsigned char *pcStr)
{
PC
putStrS(pcStr);
putCharS(0x0D);
putCharS(0x0A);
SMART
}
*/

SLAVE PROGRAM
Main Program Coding
#include <AT89X52.H>
#include <stdio.h>
#include "driver.h"
volatile unsigned char kFlag;
volatile unsigned char sFlag=0,i=0;
unsigned char no[8],name[8],from[8];
unsigned char keypad = 0;
extern unsigned char ptr[20];
int main(void)
{
unsigned char key=0,count=5,ynFlag=0;
BUZZER = 0;
lcdInit();
serInit();
ser_int();
keyInit();
putStrL("VEHICLE REGISTRATION USING SMARTCARD",0x01);
delay(1000);
while(1)
{ while(sFlag==0);
sFlag = 0;
putStrL("Visitor Waiting at Main Gate!",0x01);
BUZZER = 1;
delay(800);
BUZZER = 0;

putStrL("Press Key To View Info!",0x01);


delay(1000);
key = getkey();
putStrL("You have Choosen:",0x01);
putCharL(key);
delay(1000);
if(key == '1')
{
putStrL("Key Accepted!",0x01);
delay(500);
dispDetails();
ynFlag = 1;
}
else
{
putStrL("Ooops!Entered Valid Key!",0x01);
delay(1000);
ynFlag = 0;
}
if(ynFlag == 1)
{
ynFlag = 0;
putStrL("Accept/Reject!Make Option!",0x01);
kFlag = 0;
key = getkey();
if(key == '2')
{
putStrL("Request From Visitor Accepted!",0x01);
putCharS('Y');
delay(1000);
}
else
{
putStrL("Request From Visitor Rejected!",0x01);
putCharS('N');
delay(1000);
}
}
else
{
putStrL("Ooooops!Timed Out!Request Rejected",0x01);
IE = 0x00;
putCharS('N');
delay(2000);
IE = 0x90;
}
} //Outer while closing
}
unsigned char getkey(void)
{
unsigned char key;
while(kFlag == 0);
kFlag = 0;
key = ((~keypad >>4) & 0x07);
key += 0x31;
// putCharL(key);
return key;
}
void keyInit(void)
{
IE=0X94;
IT1=1;
}
void key(void)interrupt 2
{
keypad=P1;
kFlag=1;
delay(100);
P3_3 = 1;
}
void serIsr(void)interrupt 4
{
static unsigned char count = 0,i,j,k;
unsigned char ch;
if(!TI)
{
ch = getCharS();
putCharL(ch);
if(ch == 0x0D)
{
count++;
}
if(count == 0)
no[i++] = ch;
else if(count == 1)
name[j++] = ch;
else if(count == 2)
from[k++] = ch;
else if(count == 3)
{
sFlag = 1;
count = 0;
no[i] = NUL;
name[j] = NUL;
from[k] = NUL;
}
else;
}
}
void dispDetails(void)
{
putStrL("Flat No:",0x01);
putStrL(no,0xC0);
delay(1000);
putStrL("Name:",0x01);
putStrL(name,0xC0);
delay(1000);
putStrL("From:",0x01);
putStrL(from,0xC0);
delay(1000);
}
void delay(unsigned int del)
{
unsigned int i,j;
for(i=0;i<=del;i++)
for(j=0;j<=109;j++);
}
6.1 Future Enhancement

In this project, the receiver is controlled with the help of the serial
communication cable(RS-232). This project is enhanced with some wireless
technology. We can control the receiver through wireless remote by arranging
the circuitry with keypad and control through the remote.

6.2 Conclusion

The project “VECHILE REGISTRATION USING SMART CARD”


has been successfully designed and tested.

Integrating features of all the hardware components used have developed it.
Presence of every module has been reasoned out and placed carefully thus
contributing to the best working of the unit.

Secondly, using highly advanced IC’s and with the help of growing technology
the project has been successfully implemented.

Finally we conclude that VECHILE REGISTRATION USING SMART


CARD Technology is an emerging field and there is a huge scope for research
and development
References

 The 8051 Micro controller and Embedded Systems


-Muhammad Ali Mazidi
Janice Gillispie
Mazidi

 The 8051 Micro controller Architecture, Programming & Applications


-Kenneth
J.Ayala

 Fundamentals Of Micro processors and Micro computers


-B.Ram

 Micro processor Architecture, Programming & Applications


-Ramesh S.Gaonkar

 Electronic Components
-D.V.Prasad

 Wireless Communications
Theodore S. Rappaport

References on the Web:


www.national.com
www.atmel.com
www.microsoftsearch.com
www.geocities.com

You might also like