Sie sind auf Seite 1von 39

Anurag Engineering College

1. INTRODUCTION
Introduction to Embedded System:
An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, sometimes with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts. In contrast, a generalpurpose computer, such as a personal computer, can do many different tasks depending on programming. Embedded systems have become very important today as they control many of the common devices we use. Since the embedded system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product, or increasing the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. In general, "embedded system" is not an exactly defined term, as many systems have some element of programmability. For example, handheld computers share some elements with embedded systems such as the operating systems and microprocessors which power them but are not truly embedded systems, because they allow different applications to be loaded and peripherals to be connected. An embedded system is some combination of computer hardware and software, either fixed in capability or programmable, that is specifically designed for a particular kind of application device. Industrial machines, automobiles, medical equipment, cameras, household appliances, airplanes, vending machines, and toys (as well as the more obvious cellular phone and PDA) are among the myriad possible hosts of an embedded system. Embedded systems that are programmable are provided with a programming interface, and embedded systems programming is a specialized occupation. Certain operating systems or language platforms are tailored for the embedded market, such as Embedded Java and Windows XP Embedded. However, some low-end consumer 1 Department Of ECE

Anurag Engineering College

products use very inexpensive microprocessors and limited storage, with the application and operating system both part of a single program. The program is written permanently into the system's memory in this case, rather than being loaded into RAM (random access memory), as programs on a personal computer are. A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM, ROM, I/O ports, and a timer all on a single chip. In other words, the processor, the RAM, ROM, I/O ports and the timer are all embedded together on one chip; therefore, the designer cannot add any external memory, I/O ports, or timer to it. The fixed amount of on-chip ROM, RAM, and number of I/O ports in Microcontrollers makes them ideal for many applications in which cost and space are critical. In many applications, for example a TV remote control, there is no need for the computing power of a 486 or even an 8086 microprocessor. These applications most often require some I/O operations to read signals and turn on and off certain bits.

Advantages of Embedded Systems:


1. They are designed to do a specific task and have real time performance constraints which must be met. 2. They allow the system hardware to be simplified so costs are reduced 3. They are usually in the form of small computerized parts in larger devices which serve a general purpose. 4. The program instructions for embedded systems run with limited computer hardware resources, little memory and small or even non-existent keyboard or screen.

2 Department Of ECE

Anurag Engineering College

2. LITERATURE SURVEY
2.1. Introduction
In our daily life we see toll gates. We 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. We pay the taxes in the form of direct cash in the present days. A person has to continuously monitor the traffic and collect cash. Also after the payment, the driver has to wait until the gate way is opened manually.

Disadvantages:
This is a time consuming process. This cannot provide proper security as the person has to carry direct cash. Sometimes the person may not have the exact amount to be paid.

3 Department Of ECE

Anurag Engineering College

3. TOLLGATE PASSES USING SMART CARD


3.1 BLOCK DIAGRAM

Fig 3.1. Block Diagram for Tollgate Passes Using Smart Card.

3.2. WORKING FLOW


This section gives an overview of the whole circuitry and hardware involved in the project. The aim of the project is to use the Smart card for implementation of Toll gate. During Stand-by mode, the insertion for the card is prompted on the LCD. Whenever the card is inserted, the card is read by the smart card reader which got interfaced through a serial driver to Microcontroller. The information like validity of the card, username etc are read by the card reader and the same information is taken by the Microcontroller using Serial communication. Here in this system user need to entire the amount of TAX to be deducted from the smart card reader. After pressing OK, user entered amount is deducted from smart card and balance is kept in smart card itself. So, for entering amount we have interfaced a keypad to microcontroller.

4 Department Of ECE

Anurag Engineering College

Schematic for tollgate passes using smart card technology:

Fig 3.2. Schematic for Tollgate Passes Using Smart Card Technology

5 Department Of ECE

Anurag Engineering College

4. DESCRIPTION OF THE PROJECT


4.1. MICROCONTROLLER
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. Intel has introduced a family of Micro controllers called the MCS-51.

Fig. 4.1: Micro controller

Features:
Compatible with MCS-51 Products 4K 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 6 Department Of ECE

Anurag Engineering College

128 x 8-bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes

Description:
The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of insystem programmable Flash memory. The device is manufactured using Atmels high -density nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction set and pin out. 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.

Pin Configuration of AT89S51:

Fig4.2. Pin Diagram for AT89S51 micro controller. 7 Department Of ECE

Anurag Engineering College

Pin Description:
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.

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. Port Pin P1.0 P1.1 P1.5 P1.6 P1.7 Alternate Functions T2 (external count input to Timer/ Counter 2), clock-out T2EX (Timer/Counter 2 capture/reload trigger and direction control) MOSI (used for In-system Programming) MISO (used for In-system Programming) SCK (used for In-system Programming)

Table: 4.1. Port 1 Pin Description 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

8 Department Of ECE

Anurag Engineering College

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. 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. Port Pin P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 Alternate Functions RXD (Serial Port) TXD (Serial Output Port) INT0 (external interrupt 0) INT1(external interrupt 1 ) T0 (timer 0 external input) T1 (timer 1 external input) WR (external data memory write strobe) Rd (external data memory read strobe) Table: 4.2. Port 3 Pin Description 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 9 Department Of ECE

Anurag Engineering College

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: 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.

Oscillator Characteristics: XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figs 6.2.3. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 6.2.4.There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

10 Department Of ECE

Anurag Engineering College

Fig 4.3 Oscillator Connections

Fig 4.4 External Clock Drive Configuration

4.2. SMART CARD


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. Smart 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.

Smart Card Reader Working: 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

11 Department Of ECE

Anurag Engineering College

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. Communicating 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. Some of them are shown below. 12 Department Of ECE

Anurag Engineering College

Fig 4.5. Types of SIM Structures These Contact type Smart cards have a contact area, comprising several gold-plated contact pads, that is about 1cm square. When inserted into a reader, the chip makes contact with electrical connectors that can read information from the chip and write information back. Electrical signals description:

Fig 4.6. Smart Card pin-out 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). 13 Department Of ECE

Anurag Engineering College

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.

Pin configuration:

Card Contact Symbol


C1 C2 C3 C4 C5 C6 C7 C8 VCC RST CLK N.C GND N.C I/O N.C

Function
Supply Voltage Reset Clock input Not Connected Ground Not Connected Bidirectional data line(open drain) Not Connected

Table: 4.3. Pin Description of Smart Card

4.3 LINEAR KEYPAD


This section basically consists of a Linear Keypad. Basically a Keypad can be classified into 2 categories. One is Linear Keypad and the other is Matrix keypad. 1. Matrix Keypad. 2. Linear Keypad.

14 Department Of ECE

Anurag Engineering College

Matrix Keypad: This Keypad got keys arranged in the form of Rows and Columns. That is why the name Matrix Keypad. According to this keypad, In order to find the key being pressed the keypad need to be scanned by making rows as i/p and columns as output or vice versa. This Keypad is used in places where one needs to connect more no. of keys with less no. of data lines.

Linear 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 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.

Fig: 4.7. Linear keypad

15 Department Of ECE

Anurag Engineering College

4.4. H-BRIDGE

Fig: 4.8. H-Bridge DC motors are typically controlled by using a transistor configuration called an "Hbridge". This consists of a minimum of four mechanical or solid-state switches, such as two NPN and two PNP transistors. One NPN and one PNP transistor are activated at a time. Both NPN and PNP transistors can be activated to cause a short across the motor terminals, which can be useful for slowing down the motor from the back EMF it creates. Basic Theory: H-bridge, sometimes called a "full bridge", the H-bridge is so named because it has four switching elements at the "corners" of the H and the motor forms the cross bar. The key fact to note is that there are, in theory, four switching elements within the bridge. These four elements are often called, high side left, high side right, low side right, and low side left (when traversing in clockwise order). The switches are turned on in pairs, either high left and lower right, or lower left and high right, but never both switches on the same "side" of the bridge. If both switches on one side of a bridge are turned on it creates a short circuit between the battery plus and battery minus terminals. If the bridge is sufficiently powerful it will absorb that load and your batteries will simply drain quickly. Usually however the switches in question melt.

16 Department Of ECE

Anurag Engineering College

To power the motor, you turn on two switches that are diagonally opposed. In the picture to the right, imagine that the high side left and low side right switches are turned on. The current flows and the motor begins to turn in a "positive" direction. Turn on the high side right and low side left switches, then Current flows the other direction through the motor and the motor turns in the opposite direction. Actually it is just that simple, the tricky part comes in when you decide what to use for switches. Anything that can carry a current will work, from four SPST switches, one DPDT switch, relays, transistors, to enhancement mode power MOSFETs. One more topic in the basic theory section, quadrants. If each switch can be controlled independently then you can do some interesting things with the bridge, some folks call such a bridge a "four quadrant device" (4QD get it?). If you built it out of a single DPDT relay, you can really only control forward or reverse. You can build a small truth table that tells you for each of the switch's states, what the bridge will do. As each switch has one of two states, and there are four switches, there are 16 possible states. However, since any state that turns both switches on one side on is "bad" (smoke issues forth: P), there are in fact only four useful states (the four quadrants) where the transistors are turned on. High Side Left High Side Right Low Side Left Low Side Right Quadrant Description On Off On Off Off On On Off Off On Off On On Off Off On Forward Running Backward Running Braking Braking

Table 4.4. H Bridge Operation. The last two rows describe a maneuver where you "short circuit" the motor which causes the motors generator effect to work against itself. The turning motor generates a voltage which tries to force the motor to turn the opposite direction. This causes the motor to rapidly stop spinning and is called "braking" on a lot of H-bridge designs. Of course there is also the state where all the transistors are turned off. In this case the motor coasts freely if it was spinning and does nothing if it was doing nothing. 17 Department Of ECE

Anurag Engineering College

Implementation: Using Relays: A simple implementation of an H Bridge using four SPST relays is shown. Terminal A is High Side Left, Terminal B is High Side Right, Terminal C is Low Side Left and Terminal D is Low Side Right. The logic followed is according to the table above. Warning: Never turn on A and C or B and D at the same time. This will lead to a short circuit of the battery and will lead to failure of the relays due to the large current.

Fig: 4.9. H-bridge implementation using Relays Using Transistors: We can better control our motor by using transistors or Field Effect Transistors (FETs). Most of what we have discussed about the relays H-Bridge is true of these circuits. See the diagram showing how they are connected. You should add diodes across the transistors to catch the back voltage that is generated by the motor's coil when the power is switched on and off. This fly back voltage can be many times higher than the supply voltage! 18 Department Of ECE

Anurag Engineering College

For information on building an H-Bridge using Transistors, have a look here. Warning: If you don't use diodes, you could burn out your transistors. Also the same warning as in the diode case. Don't turn on A and C or B and D at the same time.

Fig: 4.10. H-bridge implementation using Transistors Transistors, being a semiconductor device, will have some resistance, which causes them to get hot when conducting much current. This is called not being able to sink or source very much power, i.e.: Not able to provide much current from ground or from plus voltage. Mosfets are much more efficient, they can provide much more current and not get as hot. They usually have the fly back diodes built in so you don't need the diodes anymore. This helps guard against fly back voltage frying your ICs. To use Mosfets in an H-Bridge, you need P-Channel Mosfets on top because they can "source" power, and N-Channel Mosfets on the bottom because then can "sink" power. It is important that the four quadrants of the H-Bridge circuits be turned on and off properly. When there is a path between the positive and ground side of the H-Bridge, other than through the motor, a condition exists called "shoot through". This is basically a direct short of the power supply and can cause semiconductors to become ballistic, in

19 Department Of ECE

Anurag Engineering College

circuits with large currents flowing. There are H-bridge chips available that are much easier, and safer, to use than designing your own H-Bridge circuit. 1. Using H-Bridge Devices The L293 has 2 H-Bridges (actually 4 Half H-Bridges), can provide about 1 amp to each and occasional peak loads to 2 amps. The L298 has 2 h-bridges on board, can handle 1amp and peak current draws to about 3amps. The LMD18200 has one h-bridge on board, can handle about 2 or 3 amps and can handle a peak of about 6 amps. There are several more commercially designed H-Bridge chips as well. Once a Half H-bridge is enabled, it truth table is as follows: INPUT OUTPUT A L H Y L H So you just give a High level when you want to turn the Half H-Bridge on and Low level when you want to turn it off. When the Half H-Bridge is on, the voltage at the output is equal to Vcc2.If you want to make a Full H-Bridge, you connect the motor (or the load) between the outputs of two Half H-Bridges and the inputs will be the two inputs of the Half H-Bridges.

2) L293D Motor Driver IC: Since two motors are used to drive the back wheels of the robot independently, there is a need for Two H-bridges. Instead of implementing the above H-bridge control Circuit twice, an alternative is to use an integrated circuit, which provides more than one H-bridges. One such IC is L293D, which has 2 H-Bridges in it. It is suitable for switching applications up to 5 kHz. These features make it ideal for our application. 20 Department Of ECE

Anurag Engineering College

Fig: 4.11. L293D 3) Motor Driver Connections: The motor driver requires 2 control inputs for each motor. Since we drive 2 motors, we need 4 controls

Fig: 4.12. Motor Driver Connections Inputs from the microcontroller. Since it has many pins which can be configured as outputs, there are many options for implementation.For example, in our robot the last 4 bits of Port B (RB4, RB5, RB6,RB7 - Pins 37 to 40) are used to control the rotation direction of the motors . The enable pins of the motor driver are connected to the PWM outputs of the microcontroller (Pins 16and 17). This is because, as was mentioned above, by changing the width of the pulse (implying changing the enable time of the driver) one can change the speed of the motor. The truth table for motor driver is as shown in Table II, where H = high, L = low, and Z =high output impedance state. Since the motors are reverse aligned, in order to have the robot Move forward they must be configured such that one of them turns forward and the other one turns backward. In case of any requirement for the robot to move backward, it is sufficient to just reverse the table 2.

21 Department Of ECE

Anurag Engineering College

Input H L H L

Enable H H L L

Output H L Z Z

Table: 4.5. The truth table of the motor driver

Direction Forward Backward

Input 1 H L

Input 2 L H

Input 3 L H

Input 4 H L

Table: 4.6. Driver control inputs

Outputs of the control pins. For example, in our robot while moving forward, inputs of the motor driver have states shown in the first row Of Table III, whereas for backward movement, the states shown in the second row of Table III is applied.

4.5. BUZZER
The "Piezoelectric sound components" introduced herein operate on an innovative principle utilizing natural oscillation of piezoelectric ceramics. These buzzers are offered in lightweight compact sizes from the smallest diameter of 12mm to large Piezo electric sounders. Today, piezoelectric sound components are used in many ways such as home appliances, OA equipment, audio equipment telephones, etc. And they are applied widely, for example, in alarms, speakers, telephone ringers, receivers, transmitters, beep sounds, etc.

Oscillating System: Basically, the sound source of a piezoelectric sound component is a piezoelectric diaphragm. A piezoelectric diaphragm consists of a piezoelectric ceramic plate which has 22 Department Of ECE

Anurag Engineering College

electrodes on both sides and a metal plate (brass or stainless steel, etc.). A piezoelectric ceramic plate is attached to a metal plate with adhesives. Applying D.C. voltage between electrodes of a piezoelectric diaphragm causes mechanical distortion due to the piezoelectric effect. For a misshaped piezoelectric element, the distortion of the piezoelectric element expands in a radial direction. The metal plate bonded to the piezoelectric element does not expand. Conversely, when the piezoelectric element shrinks, the piezoelectric diaphragm bends. Thus, when AC voltage is applied across electrodes, the bending is repeated, producing sound waves in the air.

4.6. POWER SUPPLY CIRCUIT

Description:
The input to the circuit is applied from the regulated power supply. The AC input i.e., 230V from the mains supply is step down by the transformer to 12V and is fed to a rectifier. The output obtained from the rectifier is a pulsating DC voltage. So in order to get a pure DC voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components present even after rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc voltage.

Fig 4.13. Block Diagram for Power supply

23 Department Of ECE

Anurag Engineering College

Transformer:

Fig.4.14. Transformer

Usually, DC voltages are required to operate various electronic equipment and these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the AC input available at the mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a transformer. Thus, a step down transformer is employed to decrease the voltage to a required level.

Rectifier:
The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full wave rectification.

Filter:
Capacitive filter is used in this project. It removes the ripples from the output of rectifier and smoothens the D.C. Output received from this filter is constant until the mains voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage received at this point changes. Therefore a regulator is applied at the output stage.

Voltage regulator:
As the name itself implies, it regulates the input applied to it. A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. In this project, power supply of 5V and 12V are required. In order to obtain these voltage levels, 7805 and 7812 24 Department Of ECE

Anurag Engineering College

voltage regulators are to be used. The first number 78 represents positive supply and the numbers 05, 12 represent the required output voltage levels.

4.7. LIQUID CRYSTAL DISPLAY


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.

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.

LCD Pin diagram:

Fig 4.15. LCD 25 Department Of ECE

Anurag Engineering College

LCD pin description:


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

Pin
1 2 3

Symbol
Vss Vcc VEE

I/O
----

Description
Ground +5V power supply Power supply to control contrast

RS

RS=0 to select command register RS=1 to select data register

R/W

R/W=0 for write R/W=1 for read

6 7 8 9 10 11 12 13 14

E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7

I/O I/O I/O I/O I/O I/O I/O I/O I/O

Enable The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus

Table 4.7: Pin Description of LCD

26 Department Of ECE

Anurag Engineering College

LCD interfacing with micro controller:


To connect the LCD to the controller it contains four data pins for getting data from the micro controller and to display data on LCD. We connect four data pins to port0 as shown below which is used to transfer the data and to display it on the LCD.

Fig 4.16. LCD Interfacing with micro controller

27 Department Of ECE

Anurag Engineering College

5. APPLICATIONS AND ADVANTAGES

Applications :
Industries, Highways etc.

Advantages:
Low cost Automated operation Low Power consumption Security Less hardware components are required.

28 Department Of ECE

Anurag Engineering College

6. CONCLUSION
This technology is specifically designed to avoid the payment of direct cash at the toll gates. This uses a smart card for the payment. 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 smart card technology there is no need to carry the amount in form of cash and so we can have security as well.

29 Department Of ECE

Anurag Engineering College

7. FUTURE SCOPE
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. 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. 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.

30 Department Of ECE

Anurag Engineering College

8. REFERENCES
1. Muhammad Ali Mazidi, Janice Gillispie Mazidi, The 8051 Micro controller and Embedded Systems. 2. Kenneth J.Ayala, The 8051 Micro controller Architecture Programming & Applications 3. B.Ram, Fundamentals Of Micro processors and Micro computers 4. Ramesh S.Gaonkar, Micro processor Architecture, Programming & Applications

5. D.V.Prasad, Electronic Components. 6. Theodore S. Rappaport, Wireless Communications 7. William C.Y. Lee, Mobile Tele Communications

31 Department Of ECE

Anurag Engineering College

APPENDIX
A. Source code
Tollgate Passes Using Smart Card Technology Program :

#include<reg52.h> #include<lcd216.h> #include<serial.h> sbit Buz = P2^4; 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 echo=0,ccount=0; idata unsigned char Dt[25],arr[25]; void Card_Status(); void Card_Remove(); unsigned char Chk_ACK(unsigned char *,unsigned char *); void Card_Write(unsigned char,unsigned char,unsigned int ); unsigned int Card_Read(unsigned char ,unsigned char); void Display_Amt(unsigned int); void Ticket_Issue(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=='#') 32 Department Of ECE

Anurag Engineering College

{ echo=1; } } } void main() { unsigned char i; unsigned int Amount,Fare_Amount; LCD_Init(); Disp_Str("SMARTCARD BASED"); LCD_Cmd(0xC0); Disp_Str("TOLLGATE AUTOMAT"); SConfig(); IE = 0x90; if(K4==0) { LCD_Cmd(0x80); Disp_Str(" Insert Card "); LCD_Cmd(0xC0); Disp_Str(" For Recharging "); Card_Status(); LCD_Cmd(0x80); Disp_Str(" LCD_Cmd(0xC0); Disp_Str(" Card Inserted "); "); Dt[ccount]='\0'; ccount=0;

Send("*W0802FFFFFF4142#"); while(!echo); echo=0; Delay(50); Card_Write('A','3',999); LCD_Cmd(0x80); Disp_Str("Recharge Complet"); LCD_Cmd(0xC0); Disp_Str("Pls Remove Card "); Buz = 0; Card_Remove(); Buz = 1; } Delay(200); while(1) { 33 Department Of ECE

Anurag Engineering College

LCD_Cmd(0x80); Disp_Str("***Insert The***"); LCD_Cmd(0xC0); Disp_Str("**Prepaid Card**"); Card_Status(); LCD_Cmd(0xC0); Disp_Str("Card Inserted..."); Send("*R0802#"); while(!echo); echo=0; Delay(20); i=7; 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("TollFare:"); Display_Amt(Fare_Amount); Disp_Str(" Rs"); Delay(100); LCD_Cmd(0x80); Disp_Str(" Processing "); LCD_Cmd(0xC0); Disp_Str(" Please Wait "); Ticket_Issue(Fare_Amount,Amount); LCD_Cmd(0x80); Disp_Str(" Processing "); LCD_Cmd(0xC0); Disp_Str(" Completed "); ");

} 34 Department Of ECE

Anurag Engineering College

else if(Fare_Amount==0) { LCD_Cmd(0x80); Disp_Str("INVALIDE VEHICLE"); LCD_Cmd(0xC0); Disp_Str(" } 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; } } CATEGORY ");

35 Department Of ECE

Anurag Engineering College

unsigned int Read_Category(void) { while(1) { if(K1==0) { Disp_Str("4 WHEELS"); while(!K1); return 10; } if(K2==0) { Disp_Str("4W MINI "); while(!K2); return 20; } if(K3==0) { Disp_Str("4W HEAVY"); while(!K3); return 30; } if(K4==0) { Disp_Str("HEAVY VH"); while(!K4); return 40; } if(K1==0 && K2==0) { Disp_Str("INVALIDE"); 36 Department Of ECE

Anurag Engineering College

while(!K1 && !K2); return 0; }

} } void Ticket_Issue(unsigned int F_Amt,unsigned int C_Amt) { C_Amt = C_Amt - F_Amt; Delay(20); 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; } unsigned int Card_Read(unsigned char loc,unsigned char nob) { unsigned int num; echo=0; arr[0]='*'; arr[1]='R'; arr[2]='0'; arr[3]=loc; arr[4]='0'; arr[5]=nob; arr[6]='#'; arr[7]='\0'; Send(&arr[0]);while(!echo);echo=0; num = (Dt[8]-0x30)*100 + (Dt[10]-0x30)*10 + (Dt[12]-0x30); return num; } 37 Department Of ECE

Anurag Engineering College

void Card_Write(unsigned char loc,unsigned char nob,unsigned int num) { unsigned char x,d1,d2,d3; echo=0; x = num%100; d1= num/100; d2= x/10; d3= x%10; arr[0]='*'; arr[1]='W'; arr[2]='0'; arr[3]=loc; arr[4]='0'; arr[5]=nob; arr[6]='F'; arr[7]='F'; arr[8]='F'; arr[9]='F'; arr[10]='F'; arr[11]='F'; arr[12]='3'; arr[13]=d1+0x30; arr[14]='3'; arr[15]=d2+0x30; arr[16]='3'; arr[17]=d3+0x30; arr[18]='#'; arr[19]='\0'; Send(&arr[0]); while(!echo);echo=0; while(!Chk_ACK(Dt,"*OK")); } 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); } void Card_Remove() { do { Send("*STS#"); while(!echo);echo=0;

}while(!Chk_ACK(Dt,"*CR")); } void Card_Status() { 38 Department Of ECE

Anurag Engineering College

do { Send("*STS#"); while(!echo);echo=0;

}while(!Chk_ACK(Dt,"*CP")); //card_insert = 1; } unsigned char Chk_ACK(unsigned char *str1,unsigned char *str2) { unsigned char Flag=1; while(*str1 && *str2) { if(*str1!=*str2) { Flag=0; break; } str1++; str2++; } return Flag; }

39 Department Of ECE