Download - Project Btech
www.btechzone.com
ABSTRACT
Smart cards are secure tokens that can provide security services to a wide range of
applications. Along with other technology advances, smart card technology has changed
dramatically as well. However, its communication standards, largely unchanged, do not
match with those of mainstream computing, which has limited its success in the Internet
age.
In our daily life we are seeing toll gate. We are going to pay certain amount to the
government in form of tax through this toll gate. We can see this toll gates being placed
in some national high ways etc.,
So in order to pay tax we are normally going to pay in form of cash, but instead of
that as the technology is growing we can make use of smart card which is nothing but
like a memory card in which we are going to store the details of particular person and
certain amount.
The main objective of this project is to pay the toll gate tax using smart card.
Smart card must be recharged with some amount and whenever a person wants to pay the
toll gate tax, he needs to insert his smart card and deduct amount using keypad.
By using this kind of projects there is no need to carry the amount in form of cash
and so we can have security as well.
www.btechzone.com
Page 1
www.btechzone.com
INTRODUCTION
1.1 History:
In the past toll-gates will work on the token system so it will take more man
power as well the time taken process this delay causes some of the disturbances in the
highways .In order to maintain and the construction of the highways Government leaving
this projects and handling it to the private sector so therefore in order to collect the taxes
who traveling on those highways we need a new system to collect the taxes which is
more efficient and less time taking and convenient so a new type of toll gates are
introduced.
1.2. TechnologyTrends:
Up to now we are using the contact type smart cards. But during the latest trends
contact less smartcards are also introduced it will work on the RF FREQUENCIES with
the help of these smartcards there is no need to insert the smartcard in the reader it will
read the smartcard from the distance also both the smartcard and the smartcard reader
will have Transmitter and the Receiver so therefore it will mutually transfer the
information not only that it is very fast compare to the contact type smartcards.
A New type of system has been introduced which is “SMARTCARD BASED
TOLL GATE AUTOMATED SYSTEM”, The main objective of this project is to pay
the toll gate tax using smart card. Smart card must be recharged with some amount and
whenever a person wants to pay the toll gate tax, he needs to insert his smart card and
deduct amount using keypad.
By using this kind of projects there is no need to carry the amount in form of
cash and so we can have security as well.
www.btechzone.com
Page 2
www.btechzone.com
1.3My Project:
The main objective of this project is to pay the toll gate tax using smart card.
Smart card must be recharged with some amount and whenever a person wants to pay the
toll gate tax, he needs to insert his smart card and deduct amount using keypad.
By using this kind of projects there is no need to carry the amount in form of cash
and so we can have security as well.
This Project will help to collect the toll-gate tax very easily and fastly by using
the smartcard if a vehicle comes at the toll-gate the driver needs to insert the smartcard
into the smartcard reader it will checks the card balance and according to type of the
vehicle class the linear keypad has to be pressed when ever if a key is pressed the amount
will deducted from the smartcard and the gate will open automatically after some delay it
will close. so these are the details about my project .
1.4Advantages of using with other:
1.Cost Effective
2.Speed
3.Less Complexity
4.Easy to use
www.btechzone.com
Page 3
www.btechzone.com
2.SMARTCARD BASED TOLL –GATE AUTOMATED SYSTEM
2.1. Overview:
The Project “SMARTCARD BASED TOLL-GATE AUTOMATED SYSTEM”
will work on the principle on the contact type communication between the smart card and
the reader. Whenever a smart card is inserted in to the smartcard reader the reader will
read the data which is present on the smartcard, and this information is transferred to the
microcontroller through the RS232 the microcontroller will checks the balance present on
the smartcard and displayed on the LCD. The linear keypad is provided to select
according to the type of the vehicle, with the given keys and the amount will deducted
from the smartcard and the microcontroller send the signal to the H-bridge now the H-
bridge will rotate the motor in anticlockwise after some delay it will rotate in clockwise.
2.2 HARDWARE MODULE:
FIG2.2 BLOCK DIAGRAM OF SMARTCARD BASED TOLL-GATE AUTOMATED SYSTEMwww.btechzone.com
Page 4
LCD
MICROCONTROLLER
POWER SUPPLY
MAX232
KeypadSMART CARD Reader
MICROCONTROLLER
www.btechzone.com
2.3.Controller section:
Fig 2.3 Controller section block diagram
2.3.1Power supply:
In this system we are using 5V power supply for microcontroller of Transmitter
section as well as receiver section. We use rectifiers for converting the A.C. into D.C and
a step down transformer to step down the voltage. The full description of the Power
supply section is given in this documentation in the following sections i.e. hardware
components.
2.3.2Microcontroller (8052):
In this project work 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 www.btechzone.com
Page 5
MICRO-CONTROLLER
POWER SUPPLY
LCD
KEYPAD
www.btechzone.com
regulators for individual control loops. In several areas Micro-controllers are now
outperforming their analog counterparts and are cheaper as well.
The purpose of this project work is to present control theory that is relevant to the
analysis and design of Micro-controller system with an emphasis on basic concept and
ideas. 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.
2.3.3Keypad Section:
This section consists of a Linear Keypad. This keypad is used to enter the amount
to deduct from smart card. The keypad is interfaced to microcontroller which
continuously scans the keypad.
2.3.4LCD Display Section:
This section is basically meant to show up the status of the project. This project
makes use of Liquid Crystal Display to display / prompt for necessary information.
2.4READER SECTION
2.4.1Smart Card Reader Section:
This section consists of a Smart card reader. The Smart card reader is a device
which reads the smart card being inserted into it. The data stored on the smart card which
resembles the information of a person is read by the smart card reader. The card reader
communicates with microcontroller using serial communication. The card reader is
interfaced to microcontroller using MAX 232, a serial driver.
www.btechzone.com
Page 6
www.btechzone.com
2.4.2Max232:
The data which we are entering in to the hyper terminal editor is available at the
COM1 port. Then the data enters in to the MAX232 voltage converter via the RS232
cable. The MAX232 converts the voltage levels of the RS232 to the TTL level and then
sends to the UART of the microcontroller. So the main duty of the max232 is for the
voltage conversions.
Fig2.4:Reader section block diagram
2.5SOFTWARE MODULE:
In order to interface all the other devices to the micro-controller and to obtain the specific tasks which are required for the project we have to write the software program in order to write the program for the micro-controller we have to follow the C-program .so therefore in order to use this c-program written in to the micro-controller it requires a
www.btechzone.com
Page 7
SMART CARD READER
MAX 232
POWER SUPPLY
MICRO-CONTROLLER
www.btechzone.com
special compiler the compiler we are using in this project is keil compiler which is cheap and very easy way to debug the program and to burn the program.
3.HARDWARE DESCRIPTION
In this project the Hardware description is classified in to two sections they are: 1.CONTROL SECTION 2.READER SECTION3.1 CONTROL SECTION: This control section mainly consists of 1.ATMEL89S52 MICROCONTROLLER 2. LINEAR KEYPAD 3. LIQUID CRYSTAL DISPLAY(LCD)
3.1.1MICROCONTROLLER(AT89S52)
A Micro controller consists of a powerful CPU tightly coupled with memory,
various I/O interfaces such as serial port, parallel port timer or counter, interrupt
controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog
converter, integrated on to a single silicon chip.
If a system is developed with a microprocessor, the designer has to go for external
memory such as RAM, ROM, EPROM and peripherals. But controller is provided all
these facilities on a single chip. Development of a Micro controller reduces PCB size and
cost of design.
One of the major differences between a Microprocessor and a Micro controller is
that a controller often deals with bits not bytes as in the real world application.
3.1.2.Features• Compatible with MCS-51® Products• 8K Bytes of In-System Programmable (ISP) Flash Memory– Endurance: 1000 Write/Erase Cycles• 4.0V to 5.5V Operating Range• Fully Static Operation: 0 Hz to 33 MHz• Three-level Program Memory Lock• 256 x 8-bit Internal RAM• 32 Programmable I/O Lineswww.btechzone.com
Page 8
www.btechzone.com
• Three 16-bit Timer/Counters• Eight Interrupt Sources• Full Duplex UART Serial Channel• Low-power Idle and Power-down Modes• Interrupt Recovery from Power-down Mode• Watchdog Timer• Dual Data Pointer• Power-off Flag
3.1.3DescriptionThe AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller
with 8K 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 programmemory to be reprogrammed in-system or by a conventional nonvolatile memory programmer.By combining a versatile 8-bit CPU with in-system programmable Flash ona monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides ahighly-flexible and cost-effective solution to many embedded control applications.The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytesof RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, asix-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator,and clock circuitry. In addition, the AT89S52 is designed with static logic for operationdown to zero frequency and supports two software selectable power saving modes.The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, andinterrupt system to continue functioning. The Power-down mode saves the RAM contentsbut freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset
www.btechzone.com
Page 9
www.btechzone.com
3.1.4Pin diagram:
Figure3.1.4: pin diagram of micro controller
www.btechzone.com
Page 10
www.btechzone.com
3.1.5PIN DECRIPTION:
VCC - Supply voltage.
GND - Ground.
Port 0:
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink
eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance
inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during
accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0
also receives the code bytes during Flash programming and outputs the code bytes during
program verification. External pull-ups are required during program verification.
PORT0 is used for to interface the LCD
Port 1:
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers
can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by
the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being
pulled low will source current (IIL) because of the internal pull-ups. Port 1 also receives the
low-order address bytes during Flash programming and verification.
PORT1 IS USED TO INTERFACE THE H-BRIDGE
www.btechzone.com
Page 11
www.btechzone.com
TABLE1:PORT1 FUCTIONS
Port 2:
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers
can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by
the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being
pulled low will source current (IIL) because of the internal pull-ups. Port 2 also receives the
high-order address bits and some control signals during Flash programming and verification.
PORT2 IS USED TO INTERFACE THE LINEAR KEYPAD
Port 3:
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by
the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being
pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control
signals for Flash programming and verification. Port 3 also serves the functions of various
special features of the AT89S51, as shown in the following table.
www.btechzone.com
Page 12
www.btechzone.com
TABLE2:PORT3 FUNCTIONS
PORT3 IS USED TO INTERFACE THE SMARTCARD
READER
RST: Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out.
The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the
default state of bit DISRTO, the RESET HIGH out feature is enabled.
ALE/PROG:
Address Latch Enable (ALE) is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG) during
Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator
frequency and may be used for external timing or clocking purposes. Note, however, that one
ALE pulse is skipped during each access to external data memory. If desired, ALE operation
can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only
during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the
ALE-disable bit has no effect if the microcontroller is in external execution mode.
PSEN:
www.btechzone.com
Page 13
www.btechzone.com
Program Store Enable (PSEN) is the read strobe to external program memory. When
the AT89S51 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external
data memory.
EA/VPP:
External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH. Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be
strapped to VCC for internal program executions. This pin also receives the 12-volt
programming enable voltage (VPP) during Flash programming.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2:
Output from the inverting oscillator amplifier.
XTAL1 &XTAL2 Is connected to the crystal oscillator to provide the fixed frequency
of 11.0592 Mhz
3.1.6INTERRUPTSA single microcontroller can serve several devices. There are two ways to do
that: INTERRUPTS or POLLING.
3.1.6.1POLLING:
In polling the microcontroller continuously monitors the status of a given device; when the status condition is met, it performs the service .After that, it moves on to monitor the next device until each one is serviced. Although polling can monitor the status of several devices and serve each of them as certain condition are met.
3.1.6.2INTERRUPTS:www.btechzone.com
Page 14
www.btechzone.com
In the interrupts method, whenever any device needs its service, the device notifies the microcontroller by sending it an interrupts signal. Upon receiving an interrupt signal, the microcontroller interrupts whatever it is doing and serves the device. The program associated with the interrupts is called the interrupt service routine (ISR).or interrupt handler.
3.1.6.3INTERRUPTS Vs POLLING:
The advantage of interrupts is that the microcontroller can serve many devices
(not all the same time, of course); each device can get the attention of the microcontroller
based on the priority assigned to it. The polling method cannot assign priority since it
checks all devices in round-robin fashion. More importantly, in the interrupt method the
microcontroller can also ignore (mask) a device request for service. This is again not
possible with the polling method. The most important reason that the interrupt method is
preferable is that the polling method wastes much of the microcontroller’s time by
polling devices that do not need service. So, in order to avoid tying down the
microcontroller, interrupts are used.
3.1.6.4INTERRUPT SERVICE ROUTINE
For every interrupt, there must be an interrupt service routine (ISR), or interrupt
handler. When an interrupt is invoked, the microcontroller runs the interrupts service
routine. For every interrupt, there is a fixed location in memory that holds the address of
its ISR. The group of memory location set aside to hold the addresses of ISR and is called
the Interrupt Vector Table. Shown below:
3.1.6.5Interrupt Vector Table for the 8051:
www.btechzone.com
Page 15
www.btechzone.com
S.No. INTERRUPT ROM LOCATION
(HEX)
PIN FLAG
CLEARING
1. Reset 0000 9 Auto
2. External
hardware
Interrupt 0
0003 P3.2 (12) Auto
3. Timers 0 interrupt (TF0)
000B Auto
4. External
hardware
Interrupt
1(INT1)
0013 P3.3 (13) Auto
5. Timers 1 interrupt (TF1)
001B Auto
6. Serial COM (RI and TI)
0023 Programmer clears it
3.1.7KEYPAD Basically a Keypad can be classified into 2 categories. One is Linear Keypad and the
other is Matrix keypad.
3.1.7.1Linear Keypad:
This Keypad got ‘n’ no. of keys connected to ‘n’ data lines of microcontroller.
This Keypad is used in places where one needs to connect less no. of keys.
In this project, Linear Keypad is used with 3 switches being connected because
the no. of switches is less (less than 8).
Generally, in Linear Keypads one end of the switch is connected to
Microcontroller (Configured as i/p) and other end of the switch is connected to the
www.btechzone.com
Page 16
www.btechzone.com
common ground. So whenever a key of Linear Keypad is pressed the logic on the
microcontroller pin will go LOW. Here in this project, a linear keypad is used with
switches connected in a serial manner. Linear keypad is used in this project because it
takes less no. of port pins. The Linear Keypad with 4 Keys is shown below.
Figure3.1.7.1: micro-controller interfacing with linear keypad
3.1.8LIQUID CRYSTAL DISPLAY(L.C.D)
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.
www.btechzone.com
Page 17
www.btechzone.com
3.1.8.1USES:
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.
3.1.8.2LCD PIN DIAGRAM:
FIG3.1.8.2 LCD PIN DIAGRAM
3.1.8.3LCD INTERFACING
Sending commands and data to LCDs with a time delay:
www.btechzone.com
Page 18
www.btechzone.com
FIG 3.1.8.3 LCD INTERFACINGTo send any command 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.1.9REGULATED POWER SUPPLY
The Regulated Power Supply consists of a 1.STEP DOWN TRANSFORMER
2.FULL WAVE BRIDGE RECTIFIERwww.btechzone.com
Page 19
www.btechzone.com
3.FILTER
4.REGULATOR
3.1.9.1 Step down transformer: The Transformer step downs the ac voltage to the
required level .We are using(0-9v).
3.1.9.2Full wave bridge rectifier: It is used to convert the ac voltage in to the pulsating dc
voltage.
3.1.9.3Filter:It will remove the ac frequency components of the circuit we are using
(1000micro farad capacitor) .
3.1.9.4Regulator: which maintains the constant supply voltage to the circuit we are using
(7805Regulator) which will provides 5v to the circuit.
FIG3.1.9.BLOCKDIAGRAM OF REGULATED POWER SUPPLY
3.2READER SECTION
www.btechzone.com
Page 20
www.btechzone.com
The reader section mainly consists of the smartcard reader and the smart card.
3.2.1Smart Card Reader:
Smart Card Readers are also known as Card Programmers (because they can write
to a card), card terminals, card acceptance device (CAD) or an interface device (IFD).
When the smart card and the card reader come into contact, each identifies itself to the
other by sending and receiving information. If the messages exchanged do not match, no
further processing takes place.
3.2 .2Working principle
Smart Card Readers are also known as card programmers (because they can write
to a card), card terminals, card acceptance device (CAD) or an interface device (IFD).
There is a slight difference between the card reader and the terminal. The term 'reader' is
generally 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.
The reader provides a path for your application to send and receive commands
from the card. There are many types of readers available, such as serial, PC Card, and
standard keyboard models. Unfortunately, the ISO group was unable to provide a
standard for communicating with the readers so there is no one-size-fits-all approach to
smart card communication.
Each manufacturer provides a different protocol for communication with the reader.
First you have to communicate with the reader.
Second, the reader communicates with the card, acting as the intermediary before
sending the data to the card.
Third, communication with a smart card is based on the APDU format. The card
will process the data and return it to the reader, which will then return the data to its
originating source.
www.btechzone.com
Page 21
www.btechzone.com
3.2.3Communicating with a Smart Card Reader
The reader provides a path for your application to send and receive commands
from the card. There are many types of readers available, such as serial, PC Card, and
standard keyboard models. Unfortunately, the ISO group was unable to provide a
standard for communicating with the readers so there is no one-size-fits-all approach to
smart card communication.
Each manufacturer provides a different protocol for communication with the reader.
First you have to communicate with the reader.
Second, the reader communicates with the card, acting as the intermediary before
sending the data to the card.
Third, communication with a smart card is based on the APDU format. The card
will process the data and return it to the reader, which will then return the data to
its originating source.
In our project the Smart Card used is of the type Contact type cards. Basically this type of
Smart Cards got SIM like Structure Embedded on a Plastic card for Physical Structure
and Strength. There exist different types of SIM structures according to the type of
Application, Memory and features involved in the Smart Card.
cards and its off-line nature, it is extremely difficult to "hack" the value off a card,
or otherwise put unauthorized information on the card. Because it is hard to get the data
without authorization, and because it fits in one’s pocket, a smart card is uniquely
appropriate for secure and convenient data storage. Without permission of the card
holder, data could not be captured or modified. Therefore, smart card could further
enhance the data privacy of user.
www.btechzone.com
Page 22
www.btechzone.com
3.3SMART CARD
A smart card, chip card, or integrated circuit card (ICC), is any pocket-sized card
with embedded integrated circuits which can process data or Memory. This implies that it
can receive input which is processed — by way of the ICC applications — and delivered
as an output.
A smart card resembles a credit card in size and shape, but inside it is completely
different. First of all, it has an inside -- a normal credit card is a simple piece of plastic.
The inside of a smart card usually contains an Embedded Microprocessor or EEPROM
(memory) or some times both. The microprocessor is under a gold contact pad on one
side of the card. Think of the microprocessor as replacing the usual magnetic stripe on a
credit card or debit card.
3.3.1Basics:
The smart card is defined as a “Credit Card” with a “Brain” on it, the brain being
a small Embedded Computer Chip. Because of this “Embedded Brain”, smart card is also
known as chip or integrated circuit (IC) card. Some types of smart card may have a
microprocessor embedded, while others may only have a non-volatile memory content
included. In general, a plastic card with a chip embedded inside can be considered as a
smart card.
In either type of smart card, the storage capacity of its memory content is much
larger than that in magnetic stripe cards. The total storage capacity of a magnetic stripe
card is 125 bytes while the typical storage capacity of a smart card ranges from 1K bytes
to 64K bytes. In other words, the memory content of a large capacity smart card can hold
the data content of more than 500 magnetic stripe cards.
Obviously, large storage capacity is one of the advantages in using smart card, but
the single-most important feature of smart card consists of the fact that their stored data
can be protected against unauthorized access and tampering. Inside a smart card, access
to the memory content is controlled by a secure logic circuit within the chip. As access to
www.btechzone.com
Page 23
www.btechzone.com
data can only is performed via a serial interface supervised by the operating system and
the secure logic system, confidential data written onto the card is prevented from
unauthorized external access. This secret data can only be processed internally by the
microprocessor.
Due to the high security level of smart cards and its off-line nature, it is extremely
difficult to "hack" the value off a card, or otherwise put unauthorized information on the
card. Because it is hard to get the data without authorization, and because it fits in one’s
pocket, a smart card is uniquely appropriate for secure and convenient data storage.
Without permission of the card holder, data could not be captured or modified. Therefore,
smart card could further enhance the data privacy of user.
Therefore, smart card is not only a data store, but also programmable, portable,
tamper-resistant memory storage
3.3.2TYPES
According to the definitions of “smart card” in the Smart card technology], the word smart card has three different meanings:
IC card with ISO 7816 interface
Processor IC card
Personal identity token containing ICs
Basically, based on their physical characteristics, IC cards can be categorized into 4 main types, memory card, contact CPU card, contact-less card and combi card.
3.3.2.1Memory Cards
A memory card is a card with only memory and access logic onboard. Similar to the magnetic stripe card, a memory card can only be used for data storage. No data processing capability should be expected. Without the on-board CPU, memory cards use a synchronous communication mechanism between the reader and the card where the communication channel is always under the direct control of the card reader. Data stored on the card can be retrieved with an appropriate command to the card.
In traditional memory cards, no security control logic is included. Therefore, unauthorized access to the memory content on the card could not be prevented. While in current memory cards, with the security control logic programmed on the card, access to the protection zone is restricted to users with the proper password only.
www.btechzone.com
Page 24
www.btechzone.com
3.3.2.2Contact CPU Cards
A more sophisticated version of smart card is the contact CPU card. A microprocessor is embedded in the card. With this real “brain”, program stored inside the chip can be executed. Inside the same chip, there are four other functional blocks: the mask-ROM, Non-volatile memory, RAM and I/O port [HKSAR1997, Rankl1997].
Except for the microprocessor unit, a memory card contains almost all components that are included in a contact CPU card. Both of them consist of Non-volatile memory, RAM, ROM and I/O unit. Based on ISO 7816 specifications, the external appearance of these contact smart cards is exactly the same. The only difference is the existence of the CPU and the use of ROM. In the CPU card, ROM is masked with the chip’s operating system which executes the commands issued by the terminal, and returns the corresponding results. Data and application program codes are stored in the non-volatile memory, usually EEPROM, which could be modified after the card manufacturing stage.
One of the main features of a CPU card is security. In fact, contact CPU card has been mainly adopted for secure data transaction. If a user could not successfully authenticate him/herself to the CPU, data kept on the card could not be retrieved. Therefore, even when a smart card is lost, the data stored inside the card will not be exposed if the data is properly stored. Also, as a secure portable computer, a CPU card can process any internal data securely and outputs the calculated result to the terminal.
3.3.2.3Contact less Cards
Contact less smart card is the one in which the chip communicates with the card reader through RFID induction technology (at data rates of 106 - 848 Kbits/sec). These cards require only close proximity to an antenna to complete transaction. They are often used when transactions must be processed quickly or hands-free, such as on mass transit systems, where smart cards can be used without even removing them from a wallet.
Contact-less card is highly suitable for large quantity of card access and data transaction. However, contact-less smart card has not been standardized. There are about 16 different contacts-less card technologies and card types in the market [ADE]. Each of these cards has its specific advantages, but they may not be compatible with each other. Nevertheless, because of its high production cost and the technology is relatively new, this type of cards has not been widely adopted.
3.3.2.4Combi-Card
At the current stage, contact and contact-less smart card are using two different communication protocols and development processes. Both cards have their advantages and disadvantages. Contact smart cards have higher level of security and readily-available infrastructure, while contact-less smart card provide a more efficient and
www.btechzone.com
Page 25
www.btechzone.com
convenient transaction environment. In order to provide customers with the advantages of these two cards, two methods could be employed.. The second method is to create a card that combines the contact functions with the contactless functions. Because the manufacturing cost of the hybrid reader is very expensive, the later solution is usually chosen.
3.3.3Electrical signals description
VCC: Power supply input
RST: Either used it (reset signal supplied from the interface device) or in combination
with an internal reset control circuit (optional use by the card). If internal reset is
implemented, the voltage supply on Vcc is mandatory.
CLK: Clocking or timing signal (optional use by the card).
GND: Ground (reference voltage).
VPP: Programming voltage input (deprecated / optional use by the card).
I/O: Input or Output for serial data to the integrated circuit inside the card.
3.3.4The following classes are used for communicating with the reader:
ISO command classes for communicating with 7816 protocol
Classes for communicating with the reader
Classes for converting data to a manufacturer-specific format
An application for testing and using the cards for an intended and specific purpose
The main protocol is 7816 is using maximum no of smart cards
www.btechzone.com
Page 26
www.btechzone.com
3.3.5INTERFACING SMARTCARD WITH MICRO-CONTROLLER:
If the smartcard want to communicate with the micro-controller it is not possible directly because the smartcard reader sends the RS-LEVELS but the microcontroller is capable of understanding the only TTL-LEVELS therefore we have to use an level converter which is capable of converting the rs levels to the TTL levels vice versa therefore in this case we are using the max RS 232 IC SMARTCARD READER IS CONNECTED TO THE THIRD PORT OF THE MCRO-CONTROLLER
FIG3.3.5INTERFACING SMART CARD WITH MICROCONTROLLER
www.btechzone.com
Page 27
www.btechzone.com
3.3.6Applications Of SmartCard
With the rapid expansion of Internet technology and electronic
commerce, smart cards are now more widely accepted in the commercial market as
stored-value and secure storage cards. Moreover, it has also been widely used as an.
The smart card has also been used in transportation such as the Octopus card which has been adopted by the MTRC and KCRC to replace of the old Magnetic stripe card. Medical record can also be stored in the smart card. This enables critical information of the patient to be retrieved whenever it is required.
The applications can be classified into 6 main categories: Electronic Payment, Security and Authentication, Transportation, Telecommunications, Loyalty Program and Health Care Applications.
3.3.6.1ELECTRONIC PAYMENT
Electronic Purse
The Electronic Purse is also known as electronic cash.. The electronic cash can be used for small purchases without necessarily requiring the authorization of a PIN. The card is credited from the cardholder’s bank account or some other ways. purchase goods or services, electronic value is deducted from the card and transferred to the retailer’s account., The cardholder could credit his/her card at the bank any time when required.
Stored Value Cards
Another use of smart cards in electronic commerce is Electronic token. It is an example of the stored-value card. The principle is that some memory in the smart card is set aside to store electronic tokens or electronic tickets. A smart card can store tokens for different services and each of the tokens can be refilled, depending on the types of the memory .
3.3.6.2TELECOMMUNICATION APPLICATIONS
Since 1988, smart card has become an essential component in cellular phone systems.
Network data, subscriber’s information and all mobile network critical data are kept
inside the card.. Moreover, through the IC card, any calls through the mobile phone In
www.btechzone.com
Page 28
www.btechzone.com
more and more value-added services, such as electronic banking, could be supported by
using this microprocessor card.
4. SOFTWARE DESCRIPTION 4.1Specifying the Tasks: The tasks which are used to do the required functions in the project in order to do all the tasks perfectly and uniformly we have to use the software program which helps to run the tasks perfectly by using the hardware. This project performs different tasks to obtain the desired output. Therefore these are the tasks which are used in this project.
4.1.1Task1: Initialize the header files for the Micro-Controller, Strings ,LCD, Serial communication, smartcards. All these header files which helps to use of all the devices. Arrange the port locations for the linear-keypad and the motor by specifying the port numbers and the bits.
4.1.2Task2: Using the display and read operate commands to specify the required tasks. After this use the serial communication interrupt command to establish communication between microcontroller and the smartcard reader assigning the vehicle category and the fare amount.
4.1.3Task3: Using the display strings to display the introduction message on the LCD while kit is on after providing some delay use of another display string insert the card .when card is inserted use the display string the welcome to toll gate after this use the smartcard strings to read the smartcard and to validate the card and show the balance if amount is sufficient it uses the display string to display vehicle category according to vehicle category assign the fare amount therefore fare amount =amount && fare amount and then use the display string to display the toll fare & fare amount and writes the data into the smartcard reader and process the operation. If fare amount is low use the display strings to indicate the invalid vehicle or less amount in card please recharge all these display messages will be displayed on LCD after some delay it will show the remove the prepaid card.
4.1.4Task4: In order to indicate the vehicle category type it will be assigned to the read void according to the vehicle category class assigned to s-bits which is assigned to the k bit
www.btechzone.com
Page 29
www.btechzone.com
port=0 then LCD will use the display string of vehicle class and amount will return to the controller.
4.1.5Task5 : To execute the motor section we use the void operate commands it will work on actual amount=actual amount-fare amount then amount will be write in to the card and then if m=0&m=1 delay will run then motor will run in anticlockwise after that m=1&m=0 after some delay it will run on the clockwise.
These are the five tasks which helps to performs this project functions perfectly.
4.2ALGORITHM: Initialize all the header files for the smartcards and microcontroller and serial and strings and LCD .Initialize the port locations .Enable the serial communication interrupt .Enable the receiver interrupt. Assigning read strings for the to read the data from the smartcard and. Assign the operate string to write the data to the smartcard. Assign the display string to display the amount on the LCD.
4.3PROGRAM CODE USED IN OUR PROJECT #include<reg51.h>
#include<string.h>
#include<lcd216.h>
#include<serial.h>
#include<smartcard.h>
sbit K1 = P2^0;
sbit K2 = P2^1;
sbit K3 = P2^2;
sbit K4 = P2^3;
sbit M1 = P1^0;
sbit M2 = P1^1;
unsigned char arr[25];
www.btechzone.com
Page 30
www.btechzone.com
void Display_Amt(unsigned int);
void Operate(unsigned int,unsigned int);
unsigned int Read_Category(void);
void Serial_INT(void) interrupt 4 using 2
{
unsigned char ch;
if(RI)
{
ch=SBUF; RI=0; Dt[ccount++]=ch;
if(ch=='!')
{
echo=1; Dt[ccount]='\0'; ccount=0;
}
}
}
void main()
{
unsigned char i,V_Cat;
unsigned int Amount,Fare_Amount;
LCD_Init(); Disp_Str("SMARTCARD BASED");
LCD_Cmd(0xC0); Disp_Str("TOLLGATE AUTOMAT");
Delay(200);
SConfig(); IE = 0x90;
while(1)
{
LCD_Cmd(0x80); Disp_Str("***Insert The***");
LCD_Cmd(0xC0); Disp_Str("**Prepaid Card**");
Card_Status();
LCD_Cmd(0x80); Disp_Str(" W E L C O M E ");
LCD_Cmd(0xC0); Disp_Str(" TO TOLLGATE ");
Delay(100);
Card_Devtype();
www.btechzone.com
Page 31
www.btechzone.com
Delay(20);
if(K1==0 && K4==0)
{
Card_Write('A','3',999);
Buz = 0;
while(K1==0 && K4==0);
Buz = 1;
}
Send("#10000802!"); while(!echo); echo=0;
Delay(10); i=9;
if( Dt[i]=='4' && Dt[i+1]=='1' && Dt[i+2]=='4' && Dt[i+3]=='2')
{
LCD_Cmd(0x80); Disp_Str(" Valide Card -1");
Amount=Card_Read('A','3');Delay(10);
LCD_Cmd(0x80); Disp_Str("Amt in Crd=");
Display_Amt(Amount);Disp_Str("Rs");
if(Amount>=2)
{
LCD_Cmd(0xC0); Disp_Str("VEH CAT: ");
LCD_Cmd(0xC8);
Fare_Amount = Read_Category();
Delay(200);
if(Fare_Amount<= Amount && Fare_Amount!=0)
{
LCD_Cmd(0xC0); Disp_Str("Toll Fare:"); Display_Amt(Fare_Amount);Disp_Str(" Rs");
Delay(100);
LCD_Cmd(0x80); Disp_Str(" Processing ");
LCD_Cmd(0xC0); Disp_Str(" Please Wait ");
Operate(Fare_Amount,Amount);
LCD_Cmd(0x80); Disp_Str(" Processing ");
LCD_Cmd(0xC0); Disp_Str(" Completed ");
}else
if(Fare_Amount==0)
{www.btechzone.com
Page 32
www.btechzone.com
LCD_Cmd(0x80); Disp_Str("INVALIDE VEHICLE");
LCD_Cmd(0xC0); Disp_Str(" CATEGORY ");
}else
{
Delay(100);
LCD_Cmd(0x80); Disp_Str("Less Amt in Card");
LCD_Cmd(0xC0); Disp_Str("Please Recharge");
}
}else
{
LCD_Cmd(0x80); Disp_Str("Less Amt in Card");
LCD_Cmd(0xC0); Disp_Str("Please Recharge");
}
}else
{
LCD_Cmd(0x80); Disp_Str(" Invalide Card ");
LCD_Cmd(0xC0); Disp_Str("================");
}
Delay(250);
Buz = 0;
LCD_Cmd(0x80); Disp_Str("***Remove The***");
LCD_Cmd(0xC0); Disp_Str("**Prepaid Card**");
Card_Remove();
Buz = 1;
}
}
unsigned int Read_Category(void)
{
while(1)
{
if(K1==0)
{
Disp_Str("4 WHEELS");
while(!K1);www.btechzone.com
Page 33
www.btechzone.com
return 20;
}
if(K2==0)
{
Disp_Str("4W MINI ");
while(!K2);
return 40;
}
if(K3==0)
{
Disp_Str("4W HEAVY");
while(!K3);
return 60;
}
if(K4==0)
{
Disp_Str("HEAVY VH");
while(!K4);
return 100;
}
if(K1==0 && K2==0)
{
Disp_Str("INVALIDE");
while(!K1 && !K2);
return 0;
}
}
}
void Operate(unsigned int F_Amt,unsigned int C_Amt)
{
C_Amt = C_Amt - F_Amt;
Card_Devtype();
Delay(20);
www.btechzone.com
Page 34
www.btechzone.com
Card_Write('A','3',C_Amt);
Delay(50);
M1 = 0; M2 = 1;
Delay(100);
M1 = 1; M2 = 1;
Delay(100);
M1 = 1; M2 = 0;
Delay(75);
M1 = 1; M2 = 1;
}
void Display_Amt(unsigned int value)
{
unsigned char d1,d2,d3;
unsigned int x;
x = value%100; d1= value/100; d2= x/10; d3= x%10;
LCD_Data(d1+0x30);LCD_Data(d2+0x30);LCD_Data(d3+0x30);
}
4.4Keil Compiler: The program code was written in the c-program in order to execute the c-program code the keil compiler is the good compiler to execute this program code.It has many features to the Editor like Text Templates, Quick Function Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based startup and debugger setup.
Keil compiler that helps you write, compile, and debug
programs. It encapsulates the following components:
A project manager.
A make facility.
Tool configuration.
Editor.
www.btechzone.com
Page 35
www.btechzone.com
A powerful debugger.
Appendix-I
ABREVATIONS:
Microcontroller:
Symbol Name
ACC Accumulator
B B register
PSW Program status word
SP Stack pointer
DPTR Data pointer 2 bytes
DPL Low byte
DPH High byte
P0 Port0
P1 Port1
P2 Port2
P3 Port3
IP Interrupt priority control
IE Interrupt enable control
TMOD Timer/counter mode control
TCON Timer/counter control
T2CON Timer/counter 2 control
T2MOD Timer/counter mode2 control
www.btechzone.com
Page 36
www.btechzone.com
TH0 Timer/counter 0high byte
TL0 Timer/counter 0 low byte
TH1 Timer/counter 1 high byte
TL1 Timer/counter 1 low byte
TH2 Timer/counter 2 high byte
TL2 Timer/counter 2 low byte
SCON Serial control
SBUF Serial data buffer
PCON Power control
Appendix-II
SCHEMATIC:
www.btechzone.com
Page 37
www.btechzone.com
Appendix-IIICOMMAND SET FOR SLE4442– 256 bytes Memory
Steps Command Comd to SR90 Prompt from SR90 Reader
1. Set Device Type #0203! #83! (Positive Ack)#8A!(Invalid Device Type set)
2. Send Card Status #01! #80! (Card Present)#81! (Card Absent)
3. ATR #03! #88A2131091!4. Read Data #10AANN! #87AANNDDD…D!
(DDD = Data)#86! (Invalid Command)#82! (No Device Type set)#8D! (Memory Over Flow)
5. Write Data #11AANNFFFFFF DD..D! #82! (No Device Type set )
#83! (Positive Ack)#89! (Invalid Security Code#86! (Invalid Command)#85! (Invalid Parameters#8D! (Memory over Flow)#90! (Already Protected)
6. Protect Data #12AANNFFFFFF DD! #83! (Positive Ack)
#82! (No Device Type)#89! (Invalid Security Code)#86! (Invalid Command)#85! (Invalid Parameters#8D! (Memory Over Flow)
7. Change Security Code #53FFFFFF555555 #83! (Positive Ack)#89! (Invalid Security Code)
www.btechzone.com
Page 38
www.btechzone.com
#86! (Invalid Command)#85! (Invalid Parameters
8. Locations Which can’t write : 0,1,2,3,6,7
9. Communication Protocol: Baud Rate : 9,600 bpsParity : None Stop Bit : 1Start Bit : 0Data : 8 bits
AA = Address location of the chip in Hex NN = Number of bytes to read or to writeFFFFFF = Security CodeDD = Data to read /write or protect in BCD format
Appendix-IV
TABLE 1: 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
www.btechzone.com
Page 39
www.btechzone.com
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
Appendix-IV
TABLE 2: 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
www.btechzone.com
Page 40
www.btechzone.com
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
Conclusion& Future Enhancements
CONCLUSION
The project “SMART CARD BASED TOLL GATE AUTOMATED
SYSTEM” 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.
Through this project we have conclude that by using smartcard. we can carry out
the different functions with speed and security
FUTURE ASPECTS
1. The Smart Card used in this project is of Contact type. The Contact less
type Smart Cards can be used by which the need to insert the Smart card
can be avoided.
www.btechzone.com
Page 41
www.btechzone.com
2. This project can be implemented in the form of a system by any company
by which it can be made commercial by providing Recharge-coupons etc.
3. The Smart can also be used as an ATM card by which a Single card can be
used for both the financial transactions and toll gate.
4. contactless smartcards will be introduced with this help between the
smartcard reader and smartcard mutually communicates through the RF-
FREQUENCIES .In this case both the smartcard and the reader has
transmitter and the receiver
5. Very soon in the future all the smartcards are made up on the single
protocol which help to use the smartcard for different purposes.
6. Smartcards are going to be use as an unique identity to notice the civilians
status in the country.verysoon these are going to be use.
www.btechzone.com
Page 42
www.btechzone.com
BIBLIOGRAPHY
NAME OF THE SITES
1. WWW.MITEL.DATABOOK.COM
2. WWW.ATMEL.DATABOOK.COM
3. WWW.FRANKLIN.COM
4. WWW.KEIL.COM
REFERENCES
1.Microcontrollers architecure,programming,interfacing and system design
by
Rajkamal,pearsoneducation,2005
2.The 8051 microcontroller and embedded systems
by
mazidi,phi 2005
3.Microcontrollers(theory&applications)
by
www.btechzone.com
Page 43
www.btechzone.com
A.V.,Deshmuk,WTMH,2005
www.btechzone.com
Page 44