Você está na página 1de 68

1.

INTRODUCTION

Radio-frequency Identification (RFID) is an automatic identification method, relying/storing and remotely retrieving data using called RFID tags (Transporters). An RFID tag is an object that can imbibe into a product, animal, or person for the purpose of identification using radio waves. Some tags can be read from several meters and also can be used beyond the line of sight of the reader. The model developed uses an active RFID technology and wireless communicator as it helps to improve data transfer between the tag and the host database over a long distance. The main objective of this module development is to implement an automated check in and checkout in Electronic Toll collection system. Electronic toll collection system (ETC) is one of the means that have been adopted by all developed countries to solve jam problem by parking charge and improve service quality. However the system can also be used in car alarms, warehouse inventory, security access control, personnel access & tracking without the need to swipe each item individually.

OBJECTIVES OF THE STUDY


The main objective of this project is to ELECTRONIC TOLL COLLECTION SYSTEM to ease the collecting toll and reduce traffic and improve service. The RFID card will be given to the user which contains the digital code, which have to the corresponding details stored in the centralized database system which can be accessed in the relevant office as and when required. Radio-frequency Identification (RFID) is an automatic identification method, relying/storing and remotely retrieving data using called RFID tags (Transporters). An RFID tag is an object that can imbibe into a product, animal, or person for the purpose of identification using radio waves. Some tags can be read from several meters and also can be used beyond the line of sight of the reader. The model developed uses an active RFID

technology and wireless communicator as it helps to improve data transfer between the tag and the host database over a long distance. The main objective of this module development is to implement an automated check in and checkout in Electronic Toll collection system. Electronic toll collection system (ETC) is one of the means that have been adopted by all developed countries to solve jam problem by parking charge and improve service quality. However the system can also be used in car alarms, warehouse inventory, security access control, personnel access & tracking without the need to swipe each item individually.

RFID
As an evolutionary automatic identification technology, RFID was considered a niche technology a few years ago. As the costs associated with RFID hardware have decreased, and standards defined for managing data, RFID has gone main stream. It has the potential of powering business systems such that they become the competitive backbone of organizations. Radio-frequency identification (RFID) is an automatic identification method, relying on storing and remotely retrieving data using devices called RFID tags or transponders. An RFID tag is an object that can be applied to or incorporated into a product, animal, or person for the purpose of identification using radio waves. Some tags can be read from several meters away and beyond the line of sight of the reader. Most RFID tags contain at least two parts. One is an integrated circuit for storing and processing information, modulating and demodulating a (RF) signal and can also be used for other specialized functions. The second is an antenna for receiving and transmitting the signal. A technology called chip less RFID allows for discrete identification of tags without an integrated circuit, thereby allowing tags to be printed directly onto assets at lower cost than traditional tags. Today, a significant thrust in RFID use is in enterprise supply chain management, improving the efficiency of inventory tracking and management.

However, a threat is looming that the current growth and adoption in enterprise supply chain market will not be sustainable. A fair cost-sharing mechanism, rational motives and justified returns from RFID technology investments are the key ingredients to achieve long-term and sustainable RFID technology adoption.

EMBEDDEDSYSTEMS
Embedded System is a combination of hardware and software used to achieve a single specific task. An embedded system is a microcontroller-based, software driven, reliable, real-time control system, autonomous, or human or network interactive, operating on diverse physical variables and in diverse environments and sold into a competitive and cost conscious market. An embedded system is not a computer system that is used primarily for processing, not a software system on PC or UNIX, not a traditional business or scientific application. High-end embedded & lower end embedded systems. High-end embedded system - Generally 32, 64 Bit Controllers used with OS. Examples Personal Digital Assistant and Mobile phones etc .Lower end embedded systems - Generally 8,16 Bit Controllers used with an minimal operating systems and hardware layout designed for the specific purpose. Examples Small controllers and devices in our everyday life like Washing Machine, Microwave Ovens, where they are embedded in.

Fig 1.1V Diagram

In this place we need to discuss the role of simulation software, real-time systems and data acquisition in dynamic test applications. Traditional testing is referred to as static testing where functionality of components is tested by providing known inputs and measuring outputs. Today there is more pressure to get products to market faster and reducedesigncycletimes. This has led to a need for dynamic testing where components are tested while in use with the entire system either real or simulated. Because of cost and safety concerns, simulating the rest of the the system with real-time hardware is preferred to testing components in the actual real system. The diagram shown on this slide is the V Diagram that is often used to describe the development cycle. Originally developed to encapsulate the design process of software applications, many different versions of this diagram can be found to describe different product design cycles. Here we have shown one example of such a diagram representing the design cycle of embedded control applications common to automotive, aerospace and defense applications. In this diagram the general progression in time of the development stages is shown from left to right. Note however that this is often an iterative process and the actual

development will not proceed linearly through these steps. The goal of rapid development is to make this cycle as efficient as possible by minimizing the iterations required for a design. If the x-axis of the diagram is thought of as time, the goal is to narrow the V as much as possible and thereby reduce development time The y-axis of this diagram can be thought of as the level at which the system components are considered. Early on in the development, the requirements of the overall system must be considered. As the system is divided into sub-systems and components, the process becomes very low-level down to the point of loading code onto individual processors. Afterwards components are integrated and tested together until such time that the entire system can enter final production testing. Therefore the top of the diagram represents the high-level system view and the bottom of the diagram represents a very low-level view.

Characteristics of Embedded System:


An embedded system is any computer system hidden inside a product other than a computer There will encounter a number of difficulties when writing embedded system software in addition to those we encounter when we write applications 1. Throughput Our system may need to handle a lot of data in a short period of time. 2. ResponseOur system may need to react to events quickly 3. TestabilitySetting up equipment to test embedded software can be difficult 4. DebugabilityWithout a screen or a keyboard, finding out what the software is doing wrong (other than not working) is a troublesome problem

5.

Reliability embedded systems must be able to handle any situation without human intervention

6. Memory space Memory is limited on embedded systems, and you must make the software and the data fit into whatever memory exists 7. Program installation you will need special tools to get your software into embedded systems 8. Power consumption Portable systems must run on battery power, and the software in these systems must conserve power 9. Processor hogs computing that requires large amounts of CPU time can complicate the response problem 10. Cost Reducing the cost of the hardware is a concern in many embedded system projects; software often operates on hardware that is barely adequate for the job. Embedded systems have a microprocessor/ microcontroller and a memory. Some have a serial port or a network connection. They usually do not have keyboards, screens or disk drives.

Applications
1. Military and aerospace embedded software applications 2 . C o mm un ic a ti on A p pl ic at io ns 3. Industrial automation and process control software.

2. BLOCK DIAGRAM

POWER SUPPLY UNIT

RFID READER

AT 8 9 S GATE Control Stepper motor 5 2

LCD DISPLAY

CONTROLLING SYSTEM

Fig 2.1 Electron toll collection toll collection system

DESCRIPTION OF THE BLOCK DIAGRAM


The major components of this project are Microcontrollers, RFID Tag Reader and steeper motor

Power supply
The Entire Project needs power for its operation. However, from the study of this project it comes to know that we supposed to design 5v and 12v dc power supply. So by utilizing the following power supply components, required power has been gained. (230/12v (1A and 500mA) Step down transformers, Bridge rectifier to converter ac to dc, booster capacitor and +5v (7805) and +12v (7812) regulator to maintain constant 5v & 12 supply for the controller circuit and RFID Reader).

Microcontroller AT89S52
The major heart of this project is at89s52 microcontroller, the reasons why we selected this in our project?,. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-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 operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. RFID Reader Details The DLP-RFID1 is a low-cost, USB-powered module for reading from and writing to ISO 15693, ISO 18000-3, and Tag-it intelligent RFID transponder tags. It has the ability to both read and write up to 256 bytes of data in addition to reading the unique identifier (UID/SID). All of the DLP-RFID1s electronics and antenna reside within the compact unit, and all operational power is taken from the host PC via the USB interface.

The range of the internal antenna is up to 4 inches depending upon the size of the tag being read. RFID stands for Radio Frequency Identification. It is an electronic technology whereby digital data encoded in an RFID Tag (or transponder) is retrieved utilizing a reader. In contrast to bar code technology, RFID systems do not require line-of-sight access to the tag in order to retrieve the tags data, and they are well suited to harsh environments. An RFID tag consists of an integrated circuit attached to an antenna. In the case of the tags used with the DLP-RFID1, the antenna is in the form of conductive ink printed on a material that allows for connection to the integrated circuit. This type of passive (battery-free) tag is commonly referred to as an inlay. The RFID reader (or interrogator) is typically a microcontroller-based radio transceiver that powers the tag with a time-varying electromagnetic radio frequency (RF) field. When the RF field passes through the tags antenna, AC voltage is generated in the antenna and rectified to supply power to the tag. Once powered, the tag can receive commands from the reader. The information stored in the tag can then be read by the reader and sent back to the host PC for processing. The data in the tag consists of a hard-coded, permanent serial number (or UID) and user memory that can be written to, read from and locked if desired. Once locked, user data can still be read but not changed.

LCD MODULE
A liquid crystal is a material (normally organic for LCDs) that will flow like a liquid but whose molecular structure has some properties normally associated with solids. The Liquid Crystal Display (LCD) is a low power device. The power requirement is typically in the order of microwatts for the LCD. However, an LCD requires an external or internal light source. It is limited to a temperature range of about 0C to 60C and lifetime is an area of concern, because LCDs can chemically degrade

There are two major types of LCDs which are: 1. Dynamic-scattering LCDs 2. Field-effect LCDs

Field-effect LCDs are normally used in such applications where source of energy is a prime factor (e.g., watches, portable instrumentation etc.).They absorb considerably less power than the light-scattering type. However, the cost for field-effect units is typically higher, and their hoight is limited to 2 inches. On the other hand, light-scattering units are available up to 8 inches in height. Field-effect LCD is used in the project for displaying the appropriate information. The turn-on and turn-off time is an important consideration in all displays. The response time of LCDs is in the range of 100 to 300ms.The lifetime of LCDs is steadily increasing beyond 10,000+hours limit. Since the color generated by LCD units is dependent on the source of illumination, there is a wide range of color choice.

STEPPER MOTORS
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.

10

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

11

CIRCUIT DIAGRAM

+5V

-5V

Gate control (steeper motor)


16 15 14 uln 13 2003 12 11 10 9 1 2 3 4 5 6 7 8 G

+5V

16x2 char LCD


4 5 6 07 08 09 10 11 12 13 14

G +5V +5V G G

1 28 2 27 3 26 4REID 25 5 24 6 reader 23 7 22 8 21 9 20 10 19 11 18 12 17 13 16 14 15

Fig.circuit diagram for electronic toll collection system based on rfid

12

3. OPERATION
Presently toll collection system is mainly depend on the men. that means it is depending on human effort so in this proposal to reduce human effort and the security is improved and avoiding jam at toll center. This system working like shown figure, here we are using AT89S52 microcontroller it is interfaced with lcd, steeper motor, RFID. Here microcontroller is totally 40 pins .here display purpose microcontroller is interred faced with LCD. In LCD 8 pins are a data pin that is 7 to 14 are connected to port0 of microcontroller. These 8 pins are data pins. These are used to send information to lcd or read contents what data in register that display on the LCD. Pin 4 in lcd to port 3.5 pin of micro controller pin 4 LCD is called register select pin. This is used to select the internal register of LCD, this pin made low then the instruction command code reregister is selected. if this pin is made high then the data register is selected. Pin 5is connected to pin 3.6 in micro controller. Pin5 of LCD is called read/write pin. If this pin is made high then the user is allowed to read information from it. If this pin is made low then the user is allowed to write the information to it. Pin 6 is connected to port3.7 pin of micro controller. This is used by the LCD to latch information presented to its data pins. In the system is another important section is there that is UART serial communication. microcontroller interfaced with MAX232.this is inner facing micro controller is inter faced with MAX 232 because it is modifying version of RS232.we need line driver to convert the RS232 signals to TTL voltage levels that will be acceptable to micro controller .in micro controller is inter facing pins TXD,RXD pins. One example of such a convert is MAX 232 from maximum crop. The MAX232 converts from rs232 voltage level to TTL levels, and vice versa. One advantage of MAX232 chip is that is uses a 5v

13

power supply, we need dual power supplies that are common in many older system. MAX232 requires 4 capacitors ranging from 1 to 22 micro farad. After MAX 232 inter faced is communicated with serial communication process that with help of modem it can link with RFID reader .in this system is main module is RFID. System having tags given thats having small micro chip thats working when it face before of the reader. RFID reads information of tag detects and display on the controller side. If any invalid tag that time display.RFID is mainly reads data from tag and send information controller it is main part of etc. In the system another module is mechanical part is there that steeper motor is inter facing with micro controller with help of ULN 2003. Here 16 pin chip. Pin 3 and pins 4 are linked with micro controller. ULN chip pin 12 to pin 16 are out put pins that are link with steeper motor.remainig are connected with resistors.

Working System of ETC

14

FIG 3.1 system of ETC Electron toll collection system working like shown in figure. In the system is mainly depending on microcontroller and RFID. Vehicle owner contain tag when ever vehicle coming into toll center .in toll center RFID reader is road side I center. Here we used low frequency RFID so that frequency is 125 KHz, when vehicle man his tag before on reader it immediately working the tag information and content of data and every thing is display on controller side. Tag have correct information that time we can pay money and alternately gate is working and gate opened or closed with in time . time is depending on code. Tag if any defaults we can reset the system. and tag is invalid that time toll center having some toll center personalities and enquiry the every thing and any defaults thy can take immediately action.In the system everything on control of toll center.

15

4. HARDWARE REQUIREMENTS

4.1. MICROCONTROLLER AT89S52

PIN CONFIGURATION

16

fig 4.1 pin diagram

ARCHITECTURE

17

Fig 4.2 architecture at89s52

PERIPHERAL FEATURES
18

Timer0: 8-bit timer/counter with 8-bit prescaler. Timer1: 16-bit timer/counter with prescaler, can be incremented during sleep via external crystal/clock. Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler. Two Capture, Compare, PWM modules. Capture is 16-bit, max. Resolution is 12.5 ns. Compare is 16-bit, max. Resolution is 200 ns. PWM max. Resolution is 10-bit. 10-bit multi-channel Analog-to-Digital converter. Synchronous Serial Port (SSP) with SPI (Master Mode) and I2C (Master/Slave). Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address detection. Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS controls (40/44-pin only). Brown-out detection circuitry for Brown-out Reset (BOR).

CMOS TECHNOLOGY
Low-power, high-speed Flash/EEPROM technology. Fully static design. Wide operating voltage range (2.0V to 5.5V). Commercial and Industrial temperature ranges. Low-power consumption.

PIN DESCRIPTION

19

VCC Supply voltage. GND Port 0 ground 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 highimpedance 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 dur-ing 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 inter-nal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the follow-ing table. Port 1 also receives the low-order address bytes during Flash programming and verification.

20

Tab 4.1 port1 description Port 2: With no external memory connection, P2 are used as simple I/O. With external memory connections, port 2 must be used along with P0 to provide the 16-bit address for the external memory. Port 2 is designated as A8-A15 indicating its dual function. While P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of the address. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3: Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are 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 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 AT89S8252, as shown in the following table.

21

Tab 4.2 Port 3 Alternate functions

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 dur-ing 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 AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to exter-nal 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

22

Memory Organization
MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed. Program Memory If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory. Data Memory The AT89S52 implements 256 bytes of on-chip RAM. The upper 128

bytes occupy a parallel address space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions which use direct addressing access the SFR space.

Watchdog Timer (One-time Enabled with Reset-out)


The WDT is intended as a recovery method in situations where the CPU may be subjected to software upsets. The WDT consists of a 14-bit counter and the Watchdog Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, it will increment every machine cycle while the oscillator is running. The WDT timeout period is dependent on the external clock frequency. There is no way to disable the WDT except through reset (either hardware reset or WDT overflow reset). When WDT over-flows, it will drive an output RESET HIGH pulse at the RST pin. Using the WDT To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, the

23

user needs to service it by writing 01EH and 0E1H to WDTRST to avoid a WDT overflow. The 14-bit counter overflows when it reaches 16383 (3FFFH), and this will reset the device. When the WDT is enabled, it will increment every machine cycle while the oscillator is running. This means the user must reset the WDT at least every 16383 machine cycles. To reset the WDT the user must write 01EH and 0E1H to WDTRST. WDTRST is a write-only register. The WDT counter cannot be read or written.

UART

The UART in the AT89S52 operates the same way as the UART in the

AT89C51 and AT89C52. Timer 0 and 1 Timer 0 and Timer 1 in the AT89S52 operate the same way as Timer 0 and Timer 1 in the AT89C51 and AT89C52. Timer 2 Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event

counter. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 5-2). Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by bits in T2CON, as shown in Table 10-1. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscil-lator frequency. Interrupts The AT89S52 has a total of six interrupt vectors: two external interrupts

(INT0 and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These interrupts are all shown in Figure . Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. Note that Table shows that bit position IE.6 is unimplemented. User software should not write a 1 to this bit position, since it may be used in future AT89 products. Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON. Neither of these flags is cleared by hardware when the service routine is vectored to. In fact, the service routine may have to determine whether it was TF2 or EXF2 that generated the interrupt, and that bit will have to be cleared in software. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled

24

by the circuitry in the next cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer overflows.

FEATURES
Compatible with MCS-51 Products.

8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 10,000 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 Lines. Three 16-bit Timer/Counters . Eight Interrupt Sources . Full Duplex UART Serial Channel. Low-power Idle and Power-down Modes. Interrupt Recovery from Power-down Mode. Watchdog Timer . Dual Data Pointer.

25

4.2 RFID MODULE


Radio-frequency identification (RFID) is an automatic identification method, relying on storing and remotely retrieving data using devices called RFID tags or transponders. The technology requires some extent of cooperation of an RFID reader and an RFID tag. An RFID tag is an object that can be applied to or incorporated into a product, animal, or person for the purpose of identification and tracking using radio waves. Some tags can be read from several meters away and beyond the line of sight of the reader. Most RFID tags contain at least two parts. One is an integrated circuit for storing and processing information, modulating and demodulating a radio-frequency (RF) signal, and other specialized functions. The second is an antenna for receiving and transmitting the signal. There are generally two types of RFID tags: Active RFID tags, which contain a battery, and Passive RFID tags, which have no battery. Future Chip less RFID allows for discrete identification of tags without an integrated circuit, thereby allowing tags to be printed directly onto assets at a lower cost than traditional tags. VARIETIES OF RFID TAGS RFID tags come in three general varieties passive, active, or semi-passive (also known as battery-assisted or semi-active) and beacon types. Passive tags require no internal power source, thus being pure passive devices (they are only active when a reader is nearby to power them by wireless illumination), whereas semi-passive and active tags require a power source, usually a small battery. Beacon tags transmit autonomously with a certain blink pattern and do not respond to interrogation.

26

Passive
Passive RFID tags have no internal power supply. The minute electrical current induced in the antenna by the incoming radio frequency signal provides just enough power for the CMOS integrated circuit in the tag to power up and transmit a response. Most passive tags signal by backscattering the carrier wave from the reader. This means that the antenna has to be designed both to collect power from the incoming signal and also to transmit the outbound backscatter signal. The response of a passive RFID tag is not necessarily just an ID number; the tag chip can contain non-volatile data, possibly writable EEPROM for storing data.

Active
Unlike passive RFID tags, active RFID tags have their own internal power source, which is used to power the integrated circuits and to broadcast the response signal to the reader. Communications from active tags to readers is typically much more reliable (i.e. fewer errors) than those from passive tags due to the ability for active tags to conduct a "session" with a reader. Active tags, due to their onboard power supply, also may transmit at higher power levels than passive tags, allowing them to be more robust in "RF challenged" environments with humidity and spray or with RF-dampening targets (including humans and cattle, which contain mostly water), reflective targets from metal (shipping containers, vehicles), or at longer distances. In turn, active tags can be larger (due to battery size) and more expensive to manufacture (due to price of the battery). However, the potential shelf life of an active tag can be many years. Many active tags today have operational ranges of hundreds of meters, and a battery life from several months to 10 years. Active tags may include larger memories than passive tags, and may include the ability to store additional information received from the reader.

27

Special active RFID tags may include specialized sensors. For example, a temperature sensor can be used to record the temperature profile during the transportation and storage of perishable goods. Other sensor types used include humidity, shock/vibration, light, nuclear radiation, pressure and concentrations of gases such as ethylene. Increasingly, active tags on the market today are internationally standardized according to the ISO 18000-7 air interface standard, which operates at the 433 MHz frequency. In addition, active tags that are sold in the form of an electronic seal are standardized according to the ISO 18185 standard. Beacon tags Beacon tags blink the coded identity signal at a regular pattern. This may be a constant blink rate or a blink rate with stochastic shift or some triggered blinking. Not to activate the responder function in a tag first prevents from limiting the speed capabilities and improves the availability of the identification information under noisy conditions. Therefore the beacon concept appliers to very robust processes: The regular availability of the coded signal reduces latency and allows for low power levels, as with active tags. However, the permanent talk of many tags may pollute the frequency channel and therefore prevent from operating in denser populations. The design of the blinking scheme must take the battery life cycle into account. Currently (2008) none of the offered products follows any known line of international standardization. However, all blinking must obey the national wireless communications regulations concerning power level and channel occupation. Antenna Types The antenna used for an RFID tag is affected by the intended application and the frequency of operation. Low-frequency is 30300 kHz. LFID or Low FID passive tags are normally inductively coupled, and because the voltage induced is proportional to frequency, many coil turns are needed to produce enough voltage to operate an integrated circuit. Compact Low FID tags, like glass-encapsulated tags used in animal and human

28

identification, use a multilayer coil (3 layers of 100150 turns each) wrapped around a ferrite core. High frequency is 3-30 MHz At 13.56 MHz, a HFID or High FID tag, using a planar spiral with 57 turns over a credit-card-sized form factor can be used to provide ranges of tens of centimeters. These coils are less costly to produce than LF coils, since they can be made using lithographic techniques rather than by wire winding, but two metal layers and an insulator layer are needed to allow for the crossover connection from the outermost layer to the inside of the spiral where the integrated circuit and resonance capacitor are located. Ultrahigh-frequency or UHF is 300 MHz-3 GHz. UHFID and microwave passive tags are usually radiatively-coupled to the reader antenna and can employ conventional dipole-like antennas. Only one metal layer is required, reducing cost of manufacturing. Dipole antennas, however, are a poor match to the high and slightly capacitive input impedance of a typical integrated circuit. Folded dipoles, or short loops acting as inductive matching structures, are often employed to improve power delivery to the IC. Half-wave dipoles (16 cm at 900 MHz) are too big for many applications; for example, tags embedded in labels must be less than 10 cm (4 inches) in extent. To reduce the length of the antenna, antennas can be bent or meandered, and capacitive tip-loading or bowtie-like broadband structures are also used. Compact antennas usually have gain less than that of a dipole that is, less than 2 dB and can be regarded as isotropic in the plane perpendicular to their axis. Dipoles couple to radiation polarized along their axes, so the visibility of a tag with a simple dipole-like antenna is orientation-dependent. Tags with two orthogonal or nearlyorthogonal antennas, often known as dual-dipole tags, are much less dependent on orientation and polarization of the reader antenna, but are larger and more expensive than single-dipole tags. Patch antennas are used to provide service in close proximity to metal surfaces, but a structure with good bandwidth is 36 mm thick, and the need to provide a ground layer and ground connection increases cost relative to simpler single-layer structures.

29

HFID and UHFID tag antennas are usually fabricated from copper or aluminum. Conductive inks have seen some use in tag antennas but have encountered problems with IC adhesion and environmental stability.

Tag attachment
There are three different kinds of RFID tags based on their attachment with identified objects, i.e. attachable, implantable and insertion tags monitoring ingestion of medicine based on a digestible RFID tag.
[10]

. In addition to these

conventional RFID tags, Eastman Kodak Company has filed two patent applications for

RFID Backscatter
To communicate, tags respond to queries generating signals that must not create interference with the readers, as arriving signals can be very weak and must be differentiated. Besides backscattering, load modulation techniques can be used to manipulate the reader's field. Typically, backscatter is used in the far field, whereas load modulation applies in the near field, within a few wavelengths from the reader.

30

4.3 POWER SUPPLY UNIT


The input to the circuit is applied from the regulated power supply. The a.c. 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 d.c voltage. So in order to get a pure d.c 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. BLOCK DIAGRAM

230 AC 50Hz

DC OUT PUT

S tep down transformer

Bridge rectifier

filter

Regulator

Fig 4.3 power supply Power supply unit consists of following units i) Step down transformer ii) Rectifier unit iii) Input filter iv).Regulator unit v) Output filter

31

STEPDOWN TRANSFORMER

The Step down Transformer is used to step down the main supply voltage from 230V AC to lower value. This 230 AC voltage cannot be used directly, thus it is stepped down. The Transformer consists of primary and secondary coils. To reduce or step down the voltage, the transformer is designed to contain less number of turns in its secondary core. The output from the secondary coil is also AC waveform. Thus the conversion from AC to DC is essential. This conversion is achieved by using the Rectifier Circuit/Unit. Step down transformers can step down incoming voltage, which enables you to have the correct voltage input for your electrical needs. For example, if our equipment has been specified for input voltage of 12 volts, and the main power supply is 230 volts, we will need a step down transformer, which decreases the incoming electrical voltage to be compatible with your 12 volt equipment. RECTIFIER UNIT The Rectifier circuit is used to convert the AC voltage into its corresponding DC voltage. The most important and simple device used in Rectifier circuit is the diode. The simple function of the diode is to conduct when forward biased and not to conduct in reverse bias. Now we are using three types of rectifiers. They are 1. Half-wave rectifier 2. Full-wave rectifier 3. Bridge rectifier Half-Wave Rectifier: In half wave rectification, either the positive or negative half of the AC wave is passed, while the other half is blocked. Because only one half of the input waveform reaches the output, it is very inefficient if used for power transfer. Half-wave rectification can be achieved with a single diode in a one phase supply, or with three diodes in a threephase supply
32

Bridge Rectifier A bridge rectifier makes use of four diodes in a bridge arrangement to achieve fullwave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge configuration that provides the same polarity of output voltage for either polarity of input voltage. When used in its most common application, for conversion of alternating current (AC) input into direct current (DC) output, it is known as a bridge rectifier. A bridge rectifier provides full-wave rectification from a two-wire AC input, resulting in lower cost and weight as compared to a center-tapped transformer design. The Forward Bias is achieved by connecting the diodes positive with positive of the battery and negative with batterys negative. The efficient circuit used is the Full wave Bridge rectifier circuit. The output voltage of the rectifier is in rippled form, the ripples from the obtained DC voltage are removed using other circuits available. The circuit used for removing the ripples is called Filter circuit. INPUT FILTER Capacitors are used as filter. The ripples from the DC voltage are removed and pure DC voltage is obtained. And also these capacitors are used to reduce the harmonics of the input voltage. The primary action performed by capacitor is charging and discharging. It charges in positive half cycle of the AC voltage and it will discharge in negative half cycle. So it allows only AC voltage and does not allow the DC voltage. This filter is fixed before the regulator. Thus the output is free from ripples. REGULATOR UNIT Regulator regulates the output voltage to be always constant. The output voltage is maintained irrespective of the fluctuations in the input AC voltage. As and then the AC

33

voltage changes, the DC voltage also changes. Thus to avoid this Regulators are used. Also when the internal resistance of the power supply is greater than 30 ohms, the output gets affected. Thus this can be successfully reduced here. The regulators are mainly classified for low voltage and for high voltage. Further they can also be classified as i) Positive regulator 1. input pin 2. ground pin 3. output pin It regulates the positive voltage. ii) Negative regulator 1. ground pin 2. input pin 3. output pin It regulates the negative voltage. FIXED REGULATORS

Fig 4.4 An assortment of 78xx series ICs "Fixed" three-terminal linear regulators are commonly available to generate fixed voltages of plus 3 V, and plus or minus 5 V, 9 V, 12 V, or 15 V when the load is less than about 7 amperes.

34

7805 VOLTAGE REGULATOR The 7805 provides circuit designers with an easy way to regulate DC voltages to 5v. Encapsulated in a single chip/package (IC), the 7805 is a positive voltage DC regulator that has only 3 terminals. They are: Input voltage, Ground, Output Voltage. General Features: Output Current up to 1A Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V Thermal Overload Protection Short Circuit Protection Output Transistor Safe Operating Area Protection

Output Filter The Filter circuit is often fixed after the Regulator circuit. Capacitor is most often used as filter. The principle of the capacitor is to charge and discharge. It charges during the positive half cycle of the AC voltage and discharges during the negative half cycle. So it allows only AC voltage and does not allow the DC voltage. This filter is fixed after the Regulator circuit to filter any of the possibly found ripples in the output received finally. Here we used 0.1F capacitor. The output at this stage is 5V and is given to the Microcontroller. The output voltage overshoots when the load is removed or a short clears. When the load is removing from a switching mode power supply with a LC low-pass output filter, the only thing the control loop can do is stop the switching action so no more energy is taken from the source. The energy that is stored in the output filter inductor is dumped into the output capacitor causing a voltage overshoot. The magnitude of the overshoot is the vector sum of two orthogonal voltages, the output voltage before the load is removed and the current through the inductor times the

35

characteristic impedance of the output filter, Zo = (L/C)^1/2. This can be derived from conservation of energy considerations. The two energies are equal when the load is removed, since the load is no longer taking energy from the system. Equating the two energies, substituting zero current for the final inductor current, then the solution for the final voltage Vf is: This is the orthogonal vector sum of the output voltage and the load current times the characteristic impedance and is illustrated in Figure .The problem becomes worse if the current in the inductor is established by a short circuit on the output and the short circuit clears. In this case, the initial voltage is zero (short circuit) and the overshoot is I*Zo, where I can be very large, resulting in a ruinous overshoot.

36

4.4 UART
SERIAL COMMUNICATION A serial port sends and receives data one bit at a time over one wire. While it takes eight times as long as to transfer each byte of data this way, only a few wires are required. In fact, two-way (full duplex) communications is possible with only three separate wiresone to send, one to receive, and a common signal ground wire. Bi-directional communications Communicating by wires The Parity Bit Cable lengths MAX-232C DCE And DTE devices Synchronous and Asynchronous Communications

Bi-directional Communications The serial port on your PC is a full-duplex device meaning that it can send and receive data at the same time. In order to be able to do this, it uses separate lines for transmitting and receiving data. Some types of serial devices support only one-way communications and therefore use only two-wires in the cable the transmit line and the signal ground. Communicating by bits Once the start bit has been sent, the transmitter sends the actual data bits. There may either be 5,6,7, or 8 data bits, depending on the number you have selected. Both receiver and the transmitter must agree on the number of data bits, as well as the baud rate. Almost all devices transmit data using either 7 or 8 data bits. Notice that when only 7 data bits are employed, you cannot send ASCII values greater than 127. Likewise, using 5 bits limits the highest possible value to 31. After the data has been transmitted, a stop bit is sent. A stop
37

bit has a value of 1- or a mark state- and it can be detected correctly even if the previous data bit also had a value of 1. This is accomplished by the stop bits duration. The Parity Bit Besides the synchronization provided by the use of start and stop bits, an additional bit called a parity bit may optionally be transmitted along with the data. A parity bit affords a small amount of error checking, to help detect data corruption that might occur during transmission. Cable Lengths The MAX-232 standard imposes a cable length limit of 50 feet. You can usually ignore this standard, since a cable can be as long as 10000 feet at baud rates up to 19200 if you use a high quality, well shielded cable. The external environment has a large effect on lengths for unshielded cables. MAX232 (Voltage Converter) Since the RS232 is not compatible with today microprocessors and micro controller, we need line driver to convert the RS232 signals to TTL voltage levels that will be acceptable to the 8051s TXD and RXD pins. One example of such a converter is MAX 232 from maxim corp. The MAX 232 converts from RS232 voltage levels to TTL voltage levels, and vice versa. One advantage of MAX232 chip is that it uses a +5V power source, which is the same as the source voltage for the at89s52 micro controller. In other words, with a single +5v power supply we can power both the PIC and MAX 232, with no need of for the dual power supplies that are common in many older systems. The MAX 232 requires four capacitors ranging from 1 to 22 microfarad. The most widely used value for this capacitor is 22microfarad. The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to supply TIA/EIA-232-Fvoltage levels from a single 5-V supply. Each receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V, a typical hysterias is of 0.5 V, and can accept 30-V inputs. Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels.
38

PIN DIAGRAM OF MAX232

Fig 4.5 max232 pin diagram

DCE and DTE devices Two terms you should be familiar with are DTE and DCE. DTE stands for Data Terminal Equipment, and DCE stands for Data Communication Equipment. These terms are used to indicate the pin-out for the connectors on a device and the direction of the signals on the pins. Your computer is a DTE device, while most other devices are usually DCE devices. If you have trouble keeping the two straight then replace the term DTE device with your PC and the term DCE device with remote Device in the following discussion. The RS-232 standard states that DTE devices use a 25-pin male connector, and DCE devices use a 25-pin female connector. You can therefore connect a DTE device to a DCE using a straight pin-for-pin connection. However, to connect two like devices, you must instead use a null modem cable. Null modem cables cross the transmit and receive lines in the cable. The DTE device puts this line in a mark condition to tell the remote device that it is ready and able to receive data. If the DTE device is not able to receive data (typically because its receive buffer is almost full), it will put this line in the space condition as a

39

signal to the DCE to stop sending data. When the DTE device is ready to receive more data it will place this line back in the mark condition. The complement of the RTS wire is CTS, which stands for Clear to Send. The DCE device puts this line in a mark condition to tell the DTE device that it is ready to receive the data. Likewise, if the DCE device is unable to receive data, it will place this line in the space condition. Together, these two lines make up what is called RTS/CTS or hardware flow control. The software wedge supports this type of flow control as well as Xon/Xoff or software flow control. Software flow control uses special control characters transmitted from one device to another to tell the other device to stop or start sending data. With software flow control the RTS and CTS lines are not used. DTR stands for Data Terminal Ready. Its intended function is very similar to the RTS line. DSR (Data Set Ready) is the companion to DTR in the same way that CTS is to RTS. Some serial devices use DTR and DSR as signals to simplify confirm that a device is connected and turned on. The software wedge sets DTR to the mark state when the serial port is opened and leaves it in that state until the port is closed. The DTR and DSR lines were originally designed to provide an alternate method of hardware handshaking. It would be pointless to use both RTS/CTS and DTR/DSR for flow control signals at the same time. Because of this DTR and DSR are rarely used for flow control.

Synchronous and Asynchronous Communications


There are two basic types of serial communications, synchronous and asynchronous. With synchronous communications, the two devices initially synchronize themselves to each other, and then continually send characters to stay in sync. Even when the data is not really being sent, a constant flow of bits allows each device to know where the other is at any given time. That is, each character that is sent is either actual data or an idle character. Synchronous communications allows faster data transfer rates than asynchronous methods, because additional bits to mark the beginning and end of each data byte are not required. The serial ports on IBM style PCs are asynchronous devices and therefore only support asynchronous serial communications. Asynchronous means no synchronization, and thus does not require sending and receiving idle characters. However, the beginning and end of each byte of data must be identified by start and stop

40

bits. The start bit indicates when the data byte is about to begin and the stop bit signals when it ends.

4.5 LCD DISPLAY


Liquid crystal display (LCD) has material which combines the properties of both liquid and crystals. They have a temperature range within which the molecules are almost as mobile as they would be in a liquid, but are grouped together in an order form similar to a crystal. LCD DISPLAY

Fig 4.6 lcd module More microcontroller devices are using 'smart LCD' displays to output visual information. The following discussion covers the connection of a Hitachi LCD display to a PIC microcontroller. LCD displays designed around Hitachi's LCD HD44780 module, are inexpensive, easy to use, and it is even possible to produce a readout using the 8 x 80 pixels of the display. Hitachi LCD displays have a standard ASCII set of characters plus Japanese, Greek and mathematical symbols.

41

HARDWARE DIAGRAM

16 x 2 Char LCD
A K D7 D0 EN RW RS Vf GND

ACK Vcc D0 D7 R1

R2

Fig 4.7 lcd pin configuration For an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4bit data bus it only requires the supply lines plus seven extra lines. When the LCD display is not enabled, data lines are tri-state which means they are in a state of high impedance (as though they are disconnected) and this means they do not interfere with the operation of the microcontroller when the display is not being addressed. The LCD also requires 3 "control" lines from the microcontroller. When the LCD is initialized, it is ready to continue receiving data or instructions. If it receives a character, it will write it on the display and move the cursor one space to the right. The Cursor marks the next location where a character will be written. When we want to write a string of characters, first we need to set up the starting address, and then send one character at a time.

42

Pins description

Table 4.3 pins for lcd


Logic status on control lines RS (Command / Data): This bit is to specify weather received byte is command or data. So that LCD can recognize the operation to be performed based on the bit status. RS RS RW (Read / Write) RW bit is to specify weather controller wants READ from LCD or WRITE to LCD. The READ operation here is just ACK bit to know weather LCD is free or not. RW RW = 0 = 1 => => Write Read = 0 = 1 => => Command Data

43

EN (Enable LCD) EN bit is to ENABLE or DISABLE the LCD. When ever controller wants to write some thing into LCD or READ acknowledgment from LCD it needs to enable the LCD. EN EN ACK (LCD Ready) ACK bit is to acknowledge the MCU that LCD is free so that it can send new command or data to be stored in its internal Ram locations. ACK = 1 => => Not ACK ACK = 0 = 1 => => High Impedance Low Impedance

ACK = 0

Reading data from the LCD is done in the same way, but control line R/W has to be high. When we send a high to the LCD, it will reset and wait for instructions. Typical instructions sent to LCD display after a reset are: turning on a display, turning on a cursor and writing characters from left to right. Characters that can be shown on the display are stored in data display (DD) RAM. The size of DDRAM is 80 bytes. Before we access DD RAM after defining a special character, the program must set the DD RAM address. Writing and reading data from any LCD memory is done from the last address which was set up using set-address instruction. Once the address of DD RAM is set, a new written character will be displayed at the appropriate place on the screen. Until now we discussed the operation of writing and reading to an LCD as if it were an ordinary memory. But this is not so. The LCD controller needs 40 to 120 microseconds (uS) for writing and reading. Other operations can take up to 5 mS. During that time, the microcontroller can not access the LCD, so a program needs to know when the LCD is busy. We can solve this in two ways.One way is to check the BUSY bit found on data line D7. This is not the best method because LCD's can get stuck, and program will then stay forever in a loop checking the BUSY bit. The other way is to introduce a delay in the program. The delay has to be long enough for the LCD to finish the operation in process.

44

At the beginning we mentioned that we needed 11 I/O lines to communicate with an LCD. However, we can communicate with an LCD through a 4-bit data bus. Thus we can reduce the total number of communication lines to seven.

4.6 Stepper Motor


A stepper motor is an electromechanical evince which converts electrical pulses into discrete mechanical movements. The shaft or spindle of a stepper motor rotates indiscrete step increments when electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied. Stepper motors operate differently from DC brush motors, which rotate when voltage applied to their terminals. Stepper motors, on the other hand, effectively have multiple "toothed" electromagnets arranged around a central gear-shaped piece of iron. The electromagnets are energized by an external control circuit, such as a microcontroller. To make the motor shaft turn, first one electromagnet is given power, which makes the gear's teeth magnetically attracted to the electromagnet's teeth. When the gear's teeth are thus aligned to the first electromagnet, they are slightly offset from the next electromagnet. So when the next electromagnet is turned on and the first is turned off, the gear rotates slightly to align with the next one, and from there the process is repeated. Each of those slight rotations is called a "step," with an integer number of steps making a full rotation. In that way, the motor can be turned by a precise angle. Stepper motors nameplates typically give only the winding current and occasionally the voltage and winding resistance. The rated voltage will produce the rated winding current at DC: but this is mostly a meaningless rating, as all modern drivers are current limiting and the drive voltages greatly exceed the motor rated voltage.

45

A stepper's low speed torque will vary directly with current. How quickly the torque falls off at faster speeds depends on the winding inductance and the drive circuitry it is attached to, especially the driving voltage. Steppers should be sized according to published torque curve, which is specified by the manufacturer at particular drive voltages and/or using their own drive circuitry. It is not guaranteed that you will achieve the same performance given different drive circuitry, so the pair should be chosen with great care.

Stepper Motor Controller by ULN2003

Fig 4.8 stepper motor interfacing chip There are three main types of stepper motors 1. Permanent Magnet Stepper (can be subdivided in to 'tin-can' and 'hybrid', tin-can being a cheaper product, and hybrid with higher quality bearings, smaller step angle, higher power density) 2. Hybrid Synchronous Stepper 3. Variable Reluctance Stepper Stepper Motor Advantages 1. The rotation angle of the motor is proportional to the input pulse. 2. The motor has full torque at standstill (if the windings are energized)

46

3. Precise positioning and repeatability of movement since good stepper motors have an accuracy of3 5% of a step and this error isnon cumulative from one step to the next. 4. Excellent response to starting/stopping/reversing. 5. Very reliable since there are no contact brushes in the motor. Therefore the life of the motor is simply dependant on the life of the bearing. 6. The motors response to digital input pulses provides open-loop control, making the motor simpler and less costly to control. 7. It is possible to achieve very low speed synchronous rotation with a load that is directly coupled to the shaft. 8. A wide range of rotational speeds can be realized as the speed is proportional to the frequency of the input pulses.

Applications
Computer-controlled stepper motors are one of the most versatile forms of positioning systems. They are typically digitally controlled as part of an open loop system, and are simpler and more rugged than closed loop servo systems. Industrial applications are in high speed pick and place equipment and multi-axis machine CNC machines often directly driving lead screws or ballscrews. In the field of lasers and optics they are frequently used in precision positioning equipment such as linear actuators, linear stages, rotation stages, goniometers, and mirror mounts. Other uses are in packaging machinery, and positioning of valve pilot stages for fluid control systems. Commercially, stepper motors are used in floppy disk drives, flatbed scanners, computer printers, plotters, slot machines, and many more devices.Some people looking for generators for homemade Wind Turbines found success in using stepper motors for generating power

47

5. SOFT WARE REQUIREMENTS


Keil an ARM Company makes C compilers, macro assemblers, real-time kernels, debuggers, simulators, integrated environments, evaluation boards, and emulators for ARM7/ARM9/Cortex-M3, XC16x/C16x/ST10, 251, and 8051 MCU families. The Keil 8051 Development Tools are designed to solve the complex problems facing embedded software developers Keil development tools for the 8051 Microcontroller Architecture support every level of software developer from the professional applications engineer to the student just learning about embedded software development. When starting a new project, simply select the microcontroller you use from 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 8051 devices. The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN, UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051 device. Simulation helps you understand hardware configurations and avoids time wasted on setup problems. Additionally, with simulation, you can write and test applications before target hardware is available

EMBEDDED C:
Ex: Hitec c, Keil c

HI-TECH Software makes industrial-strength software development tools and C compilers that help software developers write compact, efficient embedded processor code.

48

For over two decades HI-TECH Software has delivered the industry's most reliable embedded software development tools and compilers for writing efficient and compact code to run on the most popular embedded processors. Used by tens of thousands of customers including General Motors, Whirlpool, Qualcomm, John Deere and many others, HI-TECH's reliable development tools and C compilers, combined with world-class support have helped serious embedded software programmers to create hundreds of breakthrough new solutions. Which ever embedded processor family you are targeting with your software, whether it is the ARM, PICC or 8051 series, HI-TECH tools and C compilers can help you write better code and bring it to market faster. HI-TECH PICC is a high-performance C compiler for the Microchip PIC micro 10/12/14/16/17 series of microcontrollers. HI-TECH PICC is an industrial-strength ANSI C compiler - not a subset implementation like some other PIC compilers. The PICC compiler implements full ISO/ANSI C, with the exception of recursion. All data types are supported including 24 and 32 bit IEEE standard floating point. HI-TECH PICC makes full use of specific features and using an intelligent optimizer, can generate high-quality code easily rivaling hand-written assembler. Automatic handling of page and bank selection frees the programmer from the trivial details of assembler code.

EMBEDDED C COMPILER
ANSI C - full featured and portable. Reliable - mature, field-proven technology. Multiple C optimization levels . An optimizing assembler. Full linker, with overlaying of local variables to minimize RAM usage. Comprehensive C library with all source code provided. Includes support for 24-bit and 32-bit IEEE floating point and 32-bit long data types. Mixed C and assembler programming. Unlimited number of source files.
49

Listings showing generated assembler. Compatible - integrates into the MPLAB IDE, MPLAB ICD . Runs on multiple platforms: Windows, Linux, UNIX, Mac OS X, Solaris.

EMBEDDED SYSTEM TOOLS


ASSEMBLER An assembler is a computer program for translating assembly language essentially, a mnemonic representation of machine language into object code. A cross assembler (see cross compiler) produces code for one type of processor, but runs on another. The computational step where an assembler is run is known as assembly time. Translating assembly instruction mnemonics into opcodes, assemblers provide the ability to use symbolic names for memory locations (saving tedious calculations and manually updating addresses when a program is slightly modified), and macro facilities for performing textual substitution typically used to encode common short sequences of instructions to run inline instead of in a subroutine. Assemblers are far simpler to write than compilers for high-level languages. ASSEMBLY LANGUAGE HAS SEVERAL BENEFITS Speed: Assembly language programs are generally the fastest programs around. Space: Assembly language programs are often the smallest. Capability: You can do things in assembly which are difficult or impossible in High level languages.

Knowledge: Your knowledge of assembly language will help you write better programs, even when using High level languages. An example of an assembler we use in our project is RAD 51. SIMULATOR

50

Simulator is a machine that simulates an environment for the purpose of training or research. We use a UMPS simulator for this purpose in our project.

UMPS
Universal microprocessor program simulator simulates a microcontroller with its external environment. UMPS is able to simulate external components connected to the microcontroller. Then, debug step is dramatically reduced. UMPS is not dedicated to only one microcontroller family, it can simulate all kind of microcontrollers. The main limitation is to have less than 64K-Bytes of RAM and ROM space and the good microcontroller library. UMPS provide all the facilities other low-cost simulator does not have. It offers the user to see the "real effect" of a program and a way to change the microcontroller family without changing IDE. UMPS provide a low-cost solution to the problems. UMPS is really the best solution to your evaluation. UMPS KEY FEATURES The speed, UMPS can run as fast as 1/5 the real microcontroller speed. No need to wait 2 days to see the result of a LCD routine access. All the microcontroller parts are simulated, interrupts, communication protocol, parallel handshake, timer and so on. UMPS have an integrated assembler/disassembler and debugger. It is able to accept an external assembler or compiler. It has a text editor which is not limited to 64K-bytes and shows keyword with color. It can also communicate with an external compiler to integrate all the debug facilities you need. UMPS is universal, it can easily be extended to other microcontroller with a library. Ask us for toolkit development. External resource simulation is not limited. It can be extended to your proper needs by writing your own DLL. UMPS allows you to evaluate at the lowest cost the possibility to build a microcontroller project without any cable. - UMPS include a complete documentation on each microcontroller which describe special registers and each instruction.

USER INTERFACES

51

User interfaces for embedded systems vary widely, and thus deserve some special comment. User interface is the ultimate aim for an embedded module as to the user to check the output with complete convenience. One standard interface, widely used in embedded systems, uses two buttons (the absolute minimum) to control a menu system (just to be clear, one button should be "next menu entry" the other button should be "select this menu entry"). Another basic trick is to minimize and simplify the type of output. Designs sometimes use a status light for each interface plug, or failure condition, to tell what failed. A cheap variation is to have two light bars with a printed matrix of errors that they selectthe user can glue on the labels for the language that he speaks. For example, most small computer printers use lights labeled with stick-on labels that can be printed in any language. In some markets, these are delivered with several sets of labels, so customers can pick the most comfortable language. In many organizations, one person approves the user interface. Often this is a customer, the major distributor or someone directly responsible for selling the system. PLATFORM There are many different CPU architectures used in embedded designs such as ARM, MIPS, Coldfire/68k, PowerPC, X86, PIC, 8051, Atmel AVR, H8, SH, V850, FR-V, M32R etc. This in contrast to the desktop computer market, which as of this writing (2003) is limited to just a few competing architectures, mainly the Intel/AMD x86, and the Apple/Motorola/IBM PowerPC, used in the Apple Macintosh. With the growing acceptance of Java in this field, there is a tendency to even further eliminate the dependency on specific CPU/hardware (and OS) requirements. Standard PC/104 is a typical base for small, low-volume embedded and ruggedized system design. These often use DOS, Linux or an embedded real-time operating system such as QNX or Inferno. A common configuration for very-high-volume embedded systems is the system on a chip, an application-specific integrated circuit, for which the CPU was purchased as
52

intellectual property to add to the IC's design. A related common scheme is to use a fieldprogrammable gate array, and program it with all the logic, including the CPU. Most modern FPGAs are designed for this purpose.

TOOLS
Like typical computer programmers, embedded system designers use compilers, assemblers, and debuggers to develop embedded system software. However, they also use a few tools that are unfamiliar to most programmers. Software companies that specialize in the embedded market Ported from the GNU software development tools. Sometimes, development tools for a personal computer can be used if the embedded processor is a close relative to a common PC processor. Embedded system designers also use a few software tools rarely used by typical computer programmers. One common tool is an "in-circuit emulator" (ICE) or, in more modern designs, an embedded debugger. This debugging tool is the fundamental trick used to develop embedded code. It replaces or plugs into the microprocessor, and provides facilities to quickly load and debug experimental code in the system. A small pod usually provides the special electronics to plug into the system. Often a personal computer with special software attaches to the pod to provide the debugging interface. Another common tool is a utility program (often home-grown) to add a checksum or CRC to a program, so it can check its program data before executing it. An embedded programmer that develops software for digital signal processing often has a math workbench such as MathCad or Mathematical to simulate the mathematics. Less common are utility programs to turn data files into code, so one can include any kind of data in a program. A few projects use Synchronous programming languages for extra reliability or digital signal processing.

DEBUGGING
Debugging is usually performed with an in-circuit emulator, or some type of debugger that can interrupt the microcontroller's internal microcode. The microcode
53

interrupt lets the debugger operate in hardware in which only the CPU works. The CPUbased debugger can be used to test and debug the electronics of the computer from the viewpoint of the CPU. This feature was pioneered on the PDP-11. As the complexity of embedded systems grows, higher level tools and operating systems are migrating into machinery where it makes sense. For example, cell phones, personal digital assistants and other consumer computers often need significant software that is purchased or provided by a person other than the manufacturer of the electronics. In these systems, an open programming environment such as Linux, OSGi or Embedded Java is required so that the third-party software provider can sell to a large market.

OPERATING SYSTEM
Embedded systems often have no operating system, or a specialized embedded operating system (often a real-time operating system), or the programmer is assigned to port one of these to the new system.

BUILT- IN SELF- TEST


Most embedded systems have some degree or amount of built-in self-test. There are several basic types. 1. Testing the computer. 2. Test of peripherals. 3. Tests of power. 4. Communication tests. 5. Cabling tests. 6. Rigging tests. 7. Consumables test. 8. Operational test.

54

9. Safety test.

START UP
All embedded systems have start-up code. Usually it disables interrupts, sets up the electronics, tests the computer (RAM, CPU and software), and then starts the application code. Many embedded systems recover from short-term power failures by restarting (without recent self-tests). Restart times under a tenth of a second are common. Many designers have found a few LEDs useful to indicate errors (they help troubleshooting). A common scheme is to have the electronics turn on all of the LED(s) at reset (thereby proving that power is applied and the LEDs themselves work), whereupon the software changes the LED pattern as the Power-On Self Test executes. After that, the software may blink the LED(s) or set up light patterns during normal operation to indicate program execution progress or errors. This serves to reassure most technicians/engineers and some users. An interesting exception is that on electric power meters and other items on the street, blinking lights are known to attract attention and vandalism.

55

6. CODE

#INCLUDE<AT89X51.H> #INCLUDE<STRING.H> VOID DELAY_1MS(VOID); VOID DELAY_30MS(VOID); VOID DELAY(UNSIGNED INT); VOID MSDELAY(UNSIGNED CHAR); VOID LCD_CMD(UNSIGNED CHAR); VOID LCD_POS(UNSIGNED CHAR);//SETHE LCDADDRESS VOID LCD_CHAR(UNSIGNED CHAR); //CONVERTTHEINTEGER VALUE TO WRITING FORMAT VOID LCD_PRINT(UNSIGNED CHAR *); VOID LCD_INIT(VOID); VOID LCD_CLEAR(VOID); VOID UART_INIT(VOID); SBIT RS=P2^7;//RESET SBIT RW=P2^6;//READ/WRITE SBIT EN=P2^5;//ENABLE SFRLCD=0X80; //DATA0-DATA7 TO P0 //WRITE THE STRING TO LCD

56

VOID MAIN() { UNSIGNED CHAR K,RF[13],I; LCD_INIT(); LCD_PRINT("LCD IS READY"); DELAY(500); LCD_CLEAR(); UART_INIT(); LCD_PRINT("UART IS READY"); DELAY(500); LCD_CLEAR(); LCD_CMD(0X81); LCD_PRINT("AUTOMATIC TOLL"); LCD_CMD(0XC2); LCD_PRINT("GATE SYSTEM"); DELAY(500); P1=0X00; WHILE(1) { LCD_CLEAR(); LCD_CMD(0X82); LCD_PRINT("PLACE THE TAG"); LCD_CMD(0XC2); LCD_PRINT("BEFORE READER"); DELAY(500);

57

FOR(K=0;K<12;K++) { WHILE(!RI); RF[K] = SBUF; RI=0;} RF[12]='\0'; LCD_CLEAR(); LCD_PRINT(RF); DELAY(1000); IF(!STRCMP(RF,"26006FCA6FEC")) { //LCD_CLEAR(); //LCD_PRINT(RF); DELAY(1000); //SM RIGHT FOR(I=0;I<100;I++) {P1=0X11; DELAY(5); P1=0X22; DELAY(5); P1=0X44; DELAY(5); P1=0X88; DELAY(5);} LCD_CLEAR();

58

LCD_PRINT("GATE CLOSED"); FOR(I=0;I<10;I++) DELAY(500); FOR(I=0;I<100;I++) { P1=0X88; DELAY(5); P1=0X44; DELAY(5); P1=0X22; DELAY(5); P1=0X11; DELAY(5); } LCD_CLEAR(); LCD_PRINT("GATE OPENED"); DELAY(2000); } ELSE { DELAY(500); LCD_CLEAR(); LCD_PRINT("INVALID CARD"); DELAY(500);

59

DELAY(500); } } } VOID UART_INIT(VOID) { SCON=0X50;//MODE 1..8 BIT DATA,..1 STOP BIT,..1 START BIT TMOD=0X20;//TIMER 1....MODE 2...8 BIT AUTO RELOAD TL1 = 0XFD; TH1=0XFD;//BAUD RATE 9600 TR1 = 1; } VOID LCD_INIT() {

DELAY(1);//ONLY FOR AVOIDING WARNING DELAY_30MS() LCD_CMD(0X38); DELAY_30MS(); LCD_CMD(0X01); DELAY_30MS(); LCD_CMD(0X0C); DELAY_30MS(); LCD_CMD(0X06); DELAY_30MS(); LCD_CMD(0X80); DELAY_30MS(); }

60

//=============================================== VOID LCD_CLEAR(VOID) { LCD_CMD(0X01); LCD_CMD(0X80); } //THIS IS THE FUNCTION FOR SETTING THE STARTING ADDRESS OF DATA DISPLAY VOID LCD_ POS(UNSIGNED CHAR POS) { UNSIGNED CHAR I; LCD=POS; RS=0; RW=0; EN=1; FOR(I=0;I<50;I++); EN=0; FOR(I=0;I<50;I++); } //=============================================== VOID LCD_CHAR(UNSIGNED CHAR DAT) //DISPLAY_DATA { UNSIGNED CHAR I; LCD=DAT; RS=1; RW=0; EN=1; FOR (I=0;I<50;I++);

61

EN=0; FOR (I=0;I<50;I++);

7. ADVANTAGES

The entire project idea is to develop with help of RFID. 1. Easily collecting toll. 2. Avoiding traffic at toll center. 3. In the system total information of vehicles. 4. We can recognize un register vehicles.

62

8. CONCLUSION
In order to implement contemporary system of ELECTRONIC TOLL
COLLECTION SYSTEM BASED ON RFID the Embedded systems plat form has utilized.

For this purpose, a new RFID technology based on micro-controller was implemented and tested in this study. The verification system presented has the following advantages: The verification system consists of data base about the user of RFID multipurpose card. The state of art of microcontroller AT89S52 used as a mediator in between PC and RFID; it act as user interface whenever user shows RFID card it will read out by MCU using RFID card reader then it transfer those thing to PC interfacing/ front end software. The RFID security system is major role of this project. A kind of radio frequency chip was adopted to design electronic toll collection system of expressway. Structural and process designs were made, in addition, a new RFID authentication and authorization protocol model was used to guarantee system security.

63

9. FUTURE SCOPE
In this project we are using RFID module. This project is good and easy process of collecting toll from vehicles. Compare to normal manually system is better and in this we can further to implementing to every vehicle owner having the one tag that tag is contain total information of vehicle. Tag is near kept on RFID reader its detect the tag and it display on the control system. in tag in future we can add all details of car .so its helpful to car security when the vehicle is thief ted. In future vehicle toll collection easy without jam at centers and it will be good to government authority.

64

BIBLIOGRAPHY

www.rfid.com/reader/tag www.at89s52.com/pdf/ www.microchips.com www.uln2003apg.com/stepermotor www.max232n.com/texas www.mikroelektronika.co.yu/english/product/books/PICbook/0_Uvod.

BOOKS
Customizing and programming microcontroller-Myke Predcko-TMH publication2000 Complete guide to microcontroller -e-book C programming for embedded systems- Kirk Zurell Teach yourself electronics and electricity- Stan Giblisco Embedded Microcomputer system- onathan w.Valvano PHI publication2000 microcontroller inter facingDouglas v.hall TMH publication-2000

65

66

67

68

Você também pode gostar