Вы находитесь на странице: 1из 41

RFID Based Toll System

1. INTRODUCTION

Presently in India, at toll plazas there are long queues and congestions. These problems are due to increasing traffic and the lack of a toll system capable of handling heavy traffic load. The growing traffic volume plying on national highways causes additional congestions at the toll plazas which result in loss of time and fuel. Environment pollution and noise generation are other side effects of these problems. As a solution, an Electronic Toll Collection system is proposed that involves non-stop tax collection. This system is based on technologies such as radio frequency identification. A tag and a road side unit called reader are required. The tag has a unique identification number to identify the vehicle. While driving through the lane, the reader installed by the lane detects the id and deducts the toll amount from the users account. Usually, the commuter is not required to stop and the toll is collected while the vehicle passes through the plaza. For demonstration purposes, we assume that the motorist slows down while approaching the reader and the tag is flashed at the reading area of the reader. After sensing the tag, the amount is deducted and the barrier is opened. If the balance is zero the barrier will not open and the motorist will be asked to recharge his card at that very moment. The motorist can recharge using the keypad. The barrier is controlled by the motor which can rotate in both directions. The LCD display will show the appropriate messages. Some of the key features of this system are listed below. This system is user friendly and easy to mount. It also provides a convenient and quick service to the vehicle owners. Traffic flow at toll gates will be smooth and fast as the user will not wait to give the money. The driver will just have to show the card in front of the reader. The driver will not have to carry money at all, just the rfid card. Standalone operation is possible. Moreover this system reduces man power. The system can also be interfaced with the PC.

VJCET, Vazhakulam 1

RFID Based Toll System

2. BLOCK DIAGRAM

RFI D Car d

RFID Read er PIC Microcontroll er

LCD Displa y

Motor

Keypad

VJCET, Vazhakulam 2

RFID Based Toll System

3. SCHEMATIC DIAGRAM

VJCET, Vazhakulam 3

RFID Based Toll System

VJCET, Vazhakulam 4

RFID Based Toll System

VJCET, Vazhakulam 5

RFID Based Toll System

VJCET, Vazhakulam 6

RFID Based Toll System

VJCET, Vazhakulam 7

RFID Based Toll System

4. SCHEMATIC DIAGRAM DESCRIPTION

4.1 RFID Reader and tag Radio Frequency Identification (RFID) is a term for non-contacting technologies that use radio waves to automatically identify people or objects. An RFID system consists of a reader and one or more tags. There are several methods of identification, but the most common is to store a unique serial number that identifies a person or object on a microchip that is attached to an antenna. The combined antenna and microchip are called an "RFID transponder" or "RFID tag" and work in combination with an "RFID reader" (sometimes called an "RFID interrogator"). The antenna is used to transmit the identification information through radio frequency (RF) energy to a reader. Depending on the tag type, the energy is "harvested" by the tag's antenna and used to power up the internal circuitry of the tag. The tag will then modulate the electromagnetic waves generated by the reader in order to transmit its data back to the reader. The reader receives the modulated radio waves and converts them into digital data. There are two major types of tag technologies. "Passive tags" are tags that do not contain their own power source. When radio waves from the reader reach the chips antenna, the energy is converted by the antenna into electricity that can power up the microchip in the tag (known as "parasitic power"). The tag is then able to send back any information stored on the tag by reflecting the electromagnetic waves as described above. "Active tags" have their own power source and transmitter. The power source, usually a battery, is used to run the microchip's circuitry and to broadcast a signal to a reader. They also transmit at higher powers. Due to the fact that passive tags do not have their own transmitter and must reflect their signal to the reader, the reading distance is much shorter than with active tags.
VJCET, Vazhakulam 8

RFID Based Toll System

Semi passive tags are also available. They have their own power source, but the

battery only powers the microchip and does not broadcast a signal. The RF energy is to store energy from the reader like a passive tag. An alternative use for the battery is to store energy from the reader to emit a response in the future, usually by means of backscattering. Since RFID tags do not require barcodes, they last longer. The RFID Reader Module is designed specifically for low-frequency (125 kHz) passive tags. Frequency refers to the size of the radio waves used to communicate between the RFID system components. RFID tags and readers have to be tuned to the same frequency in order to communicate effectively. RFID readers are composed of a radio frequency module, a control unit and an antenna to interrogate electronic tags via radio frequency (RF) communication. The reader has three main functions: energizing, demodulating and decoding. It is generally safe to assume that a higher frequency equates to a faster data transfer rate and longer read ranges, but also more sensitivity to environmental factors such as liquid and metal that can interfere with radio waves. The read range of a tag ultimately depends on many factors: the frequency of RFID system operation, the power of the reader, and interference from other RF devices. The reader receives the code and converts it into RS232 standard and transmits to the microcontroller. The controller is programmed in interrupted mode to r e c e i v e t h e d a t a t h r o u g h i t s s e r i a l p o r t . T h e c o d e r e c e i v e d t o b y t h e s e r i a l p o r t i s compared with the database in the program. If the code received by the controller match with the pre existing data base then the system grant an access to the card holder. 4.2 Interfacing devices 4.2.1 Data transmission through RS-232 Serial Port

VJCET, Vazhakulam 9

RFID Based Toll System

Fig 4.2.1

The RFID module is interfaced with the PIC microcontroller using an RS-232 serial port this in this case is a connector DB9. RS-232 communication is dependent on a set timing speed at which both pieces of hardware communicate. In other words, the hardware knows how long a bit should high or low be. RS-232 also specifies the use of start and stop bits. Every time a character is sent, the same communication occurs. 1. Start bit sent. 2. Seven data bits sent. 3. Stop bit sent. This communication is dependent on the fact that both devices are sampling the bits at the same rate. Only 3 pins are being used here, i.e. 2, 3 and 5. Pins 2 and 3 are used to receive and transmit data and they are connected to MAX232.

VJCET, Vazhakulam 10

RFID Based Toll System

4.2.2 MAX 232:

Fig 4.2.2

VJCET, Vazhakulam 11

RFID Based Toll System

RS-232 Features: RS-232 -15V.-3V +3V..+15V TTL +2V.+5V 0V+0.8V Logic High Low

Thus the RS-232 signal levels are far too high for TTL electronics, and the negative RS-232 voltage for high cant be handled at all by computer logic. To receive serial data from an RS-232 interface, the voltage has to be reduced. Also the low and high voltage level has to be inverted. This level converter uses a Max232 and five capacitors. The max232 is quite cheap. MAX-232 is also known as Level Converter. The MAX232 was the first IC which in one package contains the necessary drivers and receivers to adapt the RS-232 signal voltage levels to TTL logic. It became popular, because it just needs one voltage (+5V or +3.3V) and generates the necessary RS232 voltage levels. MAX232 is connected to the PIC microcontroller using pins 11 and 12 pins of MAX232 to 25 and 26 of PIC microcontroller. 4.3 LCD Display

Fig 4.3
VJCET, Vazhakulam 12

RFID Based Toll System

Pin 1 and 2 are the power supply pins. They need to be connected to the negative rail and the positive rail of a +5v power supply respectively. Pin 3 is the contrast setting pin. It is said that it must be connected to a potentiometer to control the contrast or just connect a variable resistor in series with it to GND. The lower the resistance, the greater the contrast. Pins 7 to 14: are the Data pins of the LCD. In this project the LCD is connected in 4 bit mode, wherein the higher nibbles are connected to the Pic microcontroller. Pin 7 is the least significant bit and pin 14 is the most significant bit of the data inputs. If you want to display some number or letter on the display, you have to input the appropriate codes for that character on these pins. These pins are also used for giving certain commands to the display like clearing the display or moving the cursor to a different location. Upon giving the correct signals to the 3 control pins, the character codes or the commands that you have given to the Data pins will be written to the display or executed by the LCD respectively. Pins 15 and 16: Most LCDs have a backlight. A backlight is a light within the LCD panel which makes seeing the characters on screen easier. The Backlight is nothing but an LED. So, a resistor must be connected in series with it to limit the current. The 3 control pins: R/S, R/W and E. They are pins 4, 5 and 6 respectively. The RS Pin: The LCD has basically two operating modes: Instruction mode and Character Mode. Depending on the status of this pin, the data on the 8 data pins (D0-D7) is treated as either an instruction or as character data. You have to activate the command mode if you want to give an Instruction to the LCD. Example Clear the display, Move cursor to home etc. You have to activate the character mode if you want to tell the LCD to display some character. To set the LCD in Instruction mode, you set the 4th pin of the LCD (R/S) to GND. To put it in character mode , you connect it to Vcc. The Enable Pin: It is just the clock input for the LCD. The instruction or the character data at the data pins (D0-D7) is processed by the LCD on the falling edge of this pin. The Enable pin should be normally held at Vcc by a pull up resistor. Your instruction or character will be executed on the falling edge of the pulse. (ie. The moment the switch closes).
VJCET, Vazhakulam 13

RFID Based Toll System

The RW Pin: Generally , we always use the LCD to show things on the screen. However , in some rare cases , we may need to read from the LCD what it is displaying. In such cases, the R/W pin is used. For all practical purposes , the R/W pin has to be permanently connected to GND. 4.4 L293D IC

Fig 4.4 L293D is a dual H-Bridge motor driver, So with one IC we can interface two DC motors which can be controlled in both clockwise and counter clockwise direction. L293D has output current of 600mA and peak output current of 1.2A per channel. Moreover for protection of circuit from back EMF ouput diodes are included within the IC. The output supply (VCC2) has a wide range from 4.5V to 36V, which has made L293D a best choice for DC motor . Three pins are needed for interfacing a DC motor (Motor1,Motor2, Motor3). If you want the o/p to be enabled completely then you can connect Enable(Motor1) to VCC and only The Motor2 0 0 1 2 pins Motor3 0 1 0 Motor stops or breaks Motor moves in anticlockwise direction Motor moves in clockwise direction
VJCET, Vazhakulam 14

are truth

needed

from table

controller is

to

make

the as

motor

work. shown:

RFID Based Toll System

Motor stops or breaks

4.5 Power Supply: The voltage regulator 7805, has three legs and converts varying input voltage and produces a constant regulated output voltage. The 78XX series of voltage regulators are designed for positive input. And the 79XX series is designed for negative input. The LM78XX series typically has the ability to drive current up to 1A. As mentioned above, the component has three legs: Input leg which can hold up to 36VDC Common leg (GND) and an output leg with the regulator's voltage. The 7805 takes in a voltage between 7 and 30 volts and regulates it down to exactly 5 volts. The first capacitor takes out any ripple coming from the transformer so that the 7805 is receiving a smooth input voltage, and the second capacitor acts as a load balancer to ensure consistent output from the 7805. 4.6 PIC Microcontroller Between pins 13 and 14 a 20Mhz crystal is connected which provides the external clock. There are 5 ports namely A,B,C,D and E. The pins 2,3 and 4 of port A are connected to the motor. Port B is a bidirectional input/output port. All the 7 pins of this port are connected to the to the LCD. Pins 25 and 26 of Port B are connected to the UART. Port D is a bidirectional input/output port. Pins 19,20,21 and 22 of Port Dare connected to the LCD.Pins 12 and 31 are connected to the Ground and Pins 32 and 11 are connected to the Vcc. This microcontroller has 33 input/output (I/O) pins, (8K*14words) of Enhanced FLASH program memory,(368*8bytes) of RAM, (256*8bytes) of data EEPROM. The PIC does not have an operating system and simply runs the program in its memory when it is turned on keypad. Port C is also a bidirectional input/output port. Pins 15,16,17 of Port B are connected

VJCET, Vazhakulam 15

RFID Based Toll System

4.7 Keypad The metrics key pad use a matrix with the rows and columns made up of 16 push button switches. When a key is pressed, a one column line makes contact with a row line and completes a circuit. Thus matrix method was used in order to identify a key through pin coordination. In the 4x4matrix keypad, every key is a open push button switch. Thus when any of the switches pressed, the input is read as digital signal into the PIC micro controller. Each key is assigned to the micro controller inputs. Then keypad controller program detects this closed circuit and identifies it as a key press and then responds according to the key press. Consider the Metrics key pad consist of (44) 16 keys. Each key has a unique grid location, much like points on a graph. The Keys in the Metrics key pad and their corresponding pins of the PIC16F877A microcontroller are shown below Key In Keypad Column 1 Column 2 Column 3 Column4 Row1 Row2 Row3 Row4 Pins in microcontroller PortB,3 PortB,2 PortB,1 PortB,0 PortB,4 PortB,5 PortB,6 PortB,7

The purpose is to allow the PIC micro controller to read a definite value as input. Each key is a simple push button with each number having unique paths from the PIC through the keypad and back into the PIC micro controller. A continuous unique path is created when the key is pressed. Each key pressing has a unique value corresponds to the key press. The microcontrollers ports connected to the columns set as inputs and kept in high impedance. When no key connected to it is being pressed, all the row pins of that row are
VJCET, Vazhakulam 16

RFID Based Toll System

kept in the low state . When a key is pressed, the column pin is connected to the row pin and if, in that moment, that column is in high impedance, it is instead driven high by the microcontroller. The row is driven at the high state. To read the state of the keys of a row, it is needed to drive high one column and to wait a few milliseconds for the columns signal settling and to avoid the keys rebound; at this moment the rows state can be read on ports connected to columns. In order to detect whether a key has been pressed, the controller will scan all columns. When a column is activated, the controller will search for which row is activated.

VJCET, Vazhakulam 17

RFID Based Toll System

5. FLOWCHART start

display default statement

Swipe the card

no
If the card is detected

yes
If the card is entered in the data base

yes

no

If balance is less than 10

no

display not in database

yes
Motor activated Deduct Rs 10

recharge

stop

VJCET, Vazhakulam 18

RFID Based Toll System

6. SOFTWARE #include <pic.h> #define NO_MATCH 0x01 #define TRUE #define FALSE 1 0

unsigned char CARDDETECT = FALSE; const unsigned char ID[5][11] = { {0x00 ,0x00 ,0x00 ,0x31 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,0x00 ,0x00 }, {0x31 ,0x37 ,0x30 ,0x31 ,0x34 ,0x39 ,0x39 ,0x32 ,0x33,0x0D ,0x0A }, {0x31 ,0x37 ,0x30 ,0x34 ,0x31 ,0x32 ,0x30 ,0x39 ,0x55,0x0D ,0x0A }, {0x31 ,0x37 ,0x30 ,0x31 ,0x36 ,0x33 ,0x35 ,0x34 ,0x79,0x0D ,0x0A }, {0x31 ,0x37 ,0x30 ,0x33 ,0x31 ,0x31 ,0x33 ,0x32 ,0x31,0x0D ,0x0A } }; unsigned char ID_BAL[5]; unsigned char IDS[8]; #include "lcd.h" #include "usart.h" #include "matrixkey.h" #include "MEM.h" #include "function.h" CONFIG(FOSC_XT & WDTE_OFF & PWRTE_OFF & BOREN_OFF & LVP_OFF & CPD_OFF & WRT_OFF & DEBUG_OFF & CP_OFF); #define LCD_L1() writecmd(0x80) // * Begin at Line 1 // #define LCD_L2() writecmd(0xC0) interrupt isr(void) { char buf,count; GIE = 0; count=0; buf = RCREG; while(buf != 0x0A) {
VJCET, Vazhakulam 19

// * Begin at Line 2 //

RFID Based Toll System

IDS[count] = buf; count++; while(!RCIF); buf = RCREG; } CARDDETECT = TRUE; GIE = 1; } void main() { unsigned char x,y,c_bal; lcdinit(); uart_init(); TRISB = 0xF0; for(x=1;x<=4;x++) ID_BAL[x] = ID[x][8]; STARTOVER: if(OERR == 1) { CREN = 0; x = RCREG; x = RCREG; CREN = 1; } GIE = 1; writecmd(0x01); writestr(" LCD_L2(); writestr("Please swipe "); while(CARDDETECT == FALSE);
VJCET, Vazhakulam 20

// DIABLE RECEVER MODULE`

x = RCREG; // READ TWICE

// RE-ENABLE RECEVER MODULE`

Welcome

");

RFID Based Toll System

GIE = 0; writecmd(0x01); writestr("CARD DETECTED"); delayms(500); CARDDETECT = FALSE; c_bal = compare(); CHK_LO: if(c_bal == NO_MATCH) { LCD_L2(); writestr("NO DATABASE"); delayms(500); goto STARTOVER; } if(ID_BAL[c_bal] < 10) { recharge(c_bal); goto STARTOVER; } x= ID_BAL[c_bal]; x= x - 10; ID_BAL[c_bal] = x; y = x; writecmd(1); writestr("BAL: Rs"); echo(y/100);y=y%100; echo(y/10);y=y%10; echo(y); writestr("/-"); delayms(2000); motor(); goto STARTOVER; } }
VJCET, Vazhakulam 21

RFID Based Toll System

lcd.h #define LCDEN #define LCDRW #define LCDRS #define LCDD4 #define LCDD5 #define LCDD6 #define LCDD7 #define COMM #define DATA void delayms(int d) { int x; for(;d!=0;d--) { for(x=100;x!=0;x--); } } void lcdinit(void) { TRISC2=0; // LCD TRISC1=0; // LCD TRISC0=0; // LCD TRISD =0; // LCD LCDEN=1;//enable lcd LCDEN=0;//disable lcd LCDD4 = 0; LCDD5 = 1; LCDD6 = 0; LCDD7 = 0; LCDRS = COMM; LCDRW = 0; LCDEN=1;//enable lcd
VJCET, Vazhakulam 22

RC2 RC1 RC0 RD0 RD1 RD2 RD3 0 1

// CHANGE

RFID Based Toll System

LCDEN=0;//disable lcd delayms(6); LCDD4 = 0; LCDD5 = 1; LCDD6 = 0; LCDD7 = 0; LCDRS = COMM; LCDRW = 0; LCDEN=1; LCDEN=0; delayms(6); LCDD7 = 1; LCDD6 = LCDD5 = LCDD4 = 0; LCDEN=1; LCDEN=0; delayms(6); LCDD7 = LCDD6 = LCDD5 = LCDD4 = 0; LCDEN=1; LCDEN=0; delayms(6); LCDD7 = LCDD6 = LCDD5 = LCDD4 = 1; LCDEN=1; LCDEN=0; delayms(6); LCDD7 = LCDD6 = LCDD5 = LCDD4 = 0; LCDEN=1;\ LCDEN=0; delayms(6); LCDD5 = LCDD6 = 1; LCDD7 = LCDD4 = 0; LCDEN=1; LCDEN=0; delayms(6);
VJCET, Vazhakulam 23

RFID Based Toll System

} void writec(unsigned char w) { if((w & 0x10)==0) LCDD4 = 0; else LCDD4 = 1; if((w & 0x20)==0) else if((w & 0x40)==0) else if((w & 0x80)==0) else LCDRS=DATA; LCDRW=0; LCDEN=1; LCDEN=0; delayms(6); if((w & 0x01)==0) else if((w & 0x02)==0) else if((w & 0x04)==0) else if((w & 0x08)==0) else LCDRS=DATA; LCDRW=0; LCDEN=1; LCDEN=0; delayms(6); } void writecmd(unsigned char c)
VJCET, Vazhakulam 24

LCDD5 = 0; LCDD5 = 1; LCDD6 = 0; LCDD6 = 1; LCDD7 = 0; LCDD7 = 1;

LCDD4 = 0; LCDD4 = 1; LCDD5 = 0; LCDD5 = 1; LCDD6 = 0; LCDD6 = 1; LCDD7 = 0; LCDD7 = 1;

RFID Based Toll System

{ if((c & 0x10)==0) LCDD4 = 0; else if((c & 0x20)==0) else else else LCDRS=COMM; LCDRW=0; LCDEN=1; LCDEN=0; delayms(6); if((c & 0x01)==0) LCDD4 = 0; else else else else LCDRW=0; LCDEN=1; LCDEN=0; delayms(6); } void writestr(char *s) { while(*s != 0x00) { writec(*s);
VJCET, Vazhakulam 25

LCDD4 = 1; LCDD5 = 0; LCDD5 = 1; LCDD6 = 1; LCDD7 = 1;

if((c & 0x40)==0) LCDD6 = 0; if((c & 0x80)==0) LCDD7 = 0;

LCDD4 = 1; LCDD5 = 1; LCDD6 = 1; LCDD7 = 1;

if((c & 0x02)==0) LCDD5 = 0; if((c & 0x04)==0) LCDD6 = 0; if((c & 0x08)==0) LCDD7 = 0; LCDRS=COMM;

RFID Based Toll System

s++; } } void clrscr (void) { writecmd(1); delayms(6); } usart.h void uart_init(void) { // Configure UART serial transmit // Configured for: // 9600 Baud // 8N1 // SPBRG - Baud Rate Generator Register INTCON PIE1 SPBRG BRGH SYNC TRISC7 TRISC6 SPEN = 0x00; //[GIE PEIE tmr0ie inte rbie = 25; // 4MHz => 9600 baud (BRGH = 1) = 1; // (0 = low speed) = 0; // (0 = asynchronous) = 1; // (1 = pin set as input) RX of USART = 0; // (0 = pin set as output)TX of USART = 1; // (1 = serial port enabled) tmr0if intf rbif] = 0x00; //[PSPIE ADIE RCIE TXIE SSPIE CCP1IE TMR2IE TMR1IE]

// BRGH - High Baud Rate Select Bit // SYNC - USART Mode select Bit

// SPEN - Serial Port Enable Bit // TXIE - USART Transmit Interupt Enable Bit // TX9 - 9-bit Transmit Enable Bit TX9 = 0; // (0 = 8-bit transmit) // RX9 - 9-bit Receive Enable Bit RX9 = 0; // (0 = 8-bit reception) // TXEN - Trasmit Enable Bit
VJCET, Vazhakulam 26

RFID Based Toll System

TXEN

= 1; // (1 = transmit enabled)

RCIE = 1; // (1 = enabled) // CREN - Continuous Receive Enable Bit CREN = 1; // (1 = Enables receiver) // GIE - Global Interrupt Enable Bit GIE = 0; // (1 = Enable all unmasked interrupts) // PEIE - Peripheral Interrupt Enable Bit PEIE = 1; // (1 = Enable all unmasked peripheral interrupts) } matrixkey.h // matrix key /* COL1 COL2 COL3 COL4 (INPUT-IDEAL.HI) ROW1 ROW2 ROW3 ROW4 1 4 7 * 2 5 8 0 3 6 9 # A B C D

(OP.LOW)*/ #define #define #define #define #define COL2 #define #define { delayms(10); if(!COL1) { // COL1 colomn pressed delayms(15);
VJCET, Vazhakulam 27

ROW1 ROW2 RB2 ROW4 COL1 RB5 COL3 COL4

RB0 RB1 RB3 RB4 RB6 RB7

#define ROW3

unsigned char matrixscan(void)

RFID Based Toll System

if(COL1) goto exit1; ROW1=ROW2=ROW3=ROW4=1; // putt all high ROW1=0; if(!COL1) return 1; ROW1=1; ROW2=0; if(!COL1) return 4; ROW2=1; ROW3=0; if(!COL1) return 7; ROW3=1; ROW4=0; if(!COL1) return '*'; ROW4=1; } exit1: if(!COL2) { // COL2 colomn pressed delayms(15); if(COL2) goto exit2; ROW1=ROW2=ROW3=ROW4=1; // putt all high ROW1=0; if(!COL2) return 2; ROW1=1; ROW2=0;
VJCET, Vazhakulam 28

RFID Based Toll System

if(!COL2) return 5; ROW2=1; ROW3=0; if(!COL2) return 8; ROW3=1; ROW4=0; if(!COL2) return 0x00; ROW4=1; } exit2: if(!COL3) { // COL3 colomn pressed delayms(15); if(COL3) goto exit3; ROW1=ROW2=ROW3=ROW4=1; // putt all high ROW1=0; if(!COL3) return 3; ROW1=1; ROW2=0; if(!COL3) return 6; ROW2=1; ROW3=0; if(!COL3) return 9; ROW3=1;
VJCET, Vazhakulam 29

RFID Based Toll System

ROW4=0; if(!COL3) return '#'; ROW4=1; } exit3: if(!COL4) { // COL1 clomn pressed delayms(15); if(COL4) goto exit4; ROW1=ROW2=ROW3=ROW4=1;// putt all high ROW1=0; if(!COL4) return 0x0A; ROW1=1; ROW2=0; if(!COL4) return 0x0B; ROW2=1; ROW3=0; if(!COL4) return 0x0C; ROW3=1; ROW4=0; if(!COL4) return 0x0D; ROW4=1; } exit4: return 0xFF; }
VJCET, Vazhakulam 30

RFID Based Toll System

function.h #define MOTOR_EN RA0; #define PIN_MOTOR RA1; #define PIN_MOTOR1 RA2; echo(unsigned char x) { if(x <= 9 && x >= 0) { x += 0x30; writec(x); } else { switch(x) { case '*': writec('*');break; case '#': writec('#');break; case 0x0A: writec('A');break; case 0x0B: writec('B');break; case 0x0C: writec('C');break; case 0x0D: writec('D');break; } } } unsigned char compare() { unsigned char crd; unsigned char x; crd = 0; nextcrd: crd++;
VJCET, Vazhakulam 31

RFID Based Toll System

for(x = 0; x <= 7 ; x++) { if(ID[crd][x] != IDS[x]) { if(crd < 5) { goto nextcrd; } else return NO_MATCH; } } return crd; } recharge(unsigned char card__) { unsigned char key,s = 0,amts = 0; writecmd(1); writestr("EXIT #"); writecmd(0xC0); writestr("RECHARGE D"); again: ROW1=ROW2=ROW3=ROW4=0; nRBPU = 0; delayms(10); key = matrixscan(); if(key== '#') goto EXTHIS; else if(key == 0x0D) goto tats; else goto again; tats: writecmd(1);
VJCET, Vazhakulam 32

RFID Based Toll System

writestr("ENTER AMOUNT+* :"); writecmd(0xC0) ; do { ROW1=ROW2=ROW3=ROW4=0; nRBPU = 0; delayms(10); echo(key = matrixscan()); if(key >= 0 && key <= 9) { amts *= 10; amts += key; } if(key == 0x0c) { writecmd(0x10); writec(' '); writecmd(0x10); amts /= 10; } delayms(100); }while(key != '*'); ID_BAL[card__] += amts; writecmd(1); writestr("RECHARGE SUCCESS"); delayms(500); EXTHIS: writecmd(1); }void motor(void) { MOTOR_EN=1; // rotate motor CW direction
VJCET, Vazhakulam 33

RFID Based Toll System

// delay // rotate motor ACW direction PIN_MOTOR = 1; PIN_MOTOR1=0; delay(5000); // rotate for 5 sec PIN_MOTOR = 0; PIN_MOTOR1=1; }

VJCET, Vazhakulam 34

RFID Based Toll System

7. PCB LAYOUT

VJCET, Vazhakulam 35

RFID Based Toll System

8. FABRICATION OF PCB

The printed circuit board(PCB) provides the electrical interconnections between various components and as well as provides mechanical support to the components. The components are soldered to the PCB. The quality of soldering directly affects the reliability of the circuit. The procedure for fabricating the PCB for any general project is described below. PCB MAKING The making of PCB essentially involves two steps. 1.Preparing PCBdrawing 2.Fabricating PCB from the drawing. PCB Drawing Making of PCB drawing involves placement of components , locating holes ,optimum area each componenet, should occupy, shape and size of pads for the componenets , track size and spacing and prevention of overcrowding of components at a particular area. With these details the sketch of the PCB is made. 8.1 PCB FABRICATION The fabrication of the PCB starts by transferring the PCB drawing onto a copper clad sheet. For a small number of PCBs a direct photographic transfer of the PCB drawing from a negative image of the drawing to a photo sensitised copper clad sheet is carried out. The copper from the unexposed area is later etched away. For large quantity production, screen printing method is used to transfer the PCB drawing image to the copper clad sheet. For etching the copper clad sheet 20-30grms of ferric chloride in 75ml of water heated to about 60degree celsius may be used . The copper clad sheet is placed in the solution with its copper side upwards in a plastic tray. Stirring the solution

VJCET, Vazhakulam 36

RFID Based Toll System

helps in speedy etching. The dissolution of unwanted copper would take about 45min. If etching takes longer, the solution may be heated again andthe process is repeated. The paint on the pattern can be removed by rubbing with a rag soaked in thinner, turpentine or acetone. The PCB can then be washed and dried. The pads are drilled with proper drill sizes of0.9mm,1mm,3mm etc for the leads and mounting holes. 8.2 ASSEMBLY AND TESTING Assembly consists of soldering of components and wires on to the PCB and mechanical fitting of wired PCB and other assemblies. Testing is carried out even at design phase itself in breadboard level to verify the design, so that little or no circuit changes are required after designing the PCB. 8.2.1 Soldering Before soldering, all the discrete components are tested. The leads of the components are cleaned with a fine abrasive paper. The PCB also thoroughly cleaned by scratching the areas to be soldered. The leads of the components are bend properly, inserted into the holes and placed correctly. A small quantity of flux is applied to the component leads and pads to remove the oxide coating. The leads are soldered with good quality solder with sufficient heat from the soldering iron. Excess heat will result in improper soldering and may damage the component. All the joints are checked after the soldering. 8.2.2 Testing After soldering the components on to the PCB, the board is thoroughly cleaned for any residual flux and wire leads. All the components are checked for their value and for the proper orientation if applicable. Before ICs are inserted into the sockets, power applied to the board and voltages are measured at the IC power point. Power is switched off before the ICs are inserted Press the required switch and check whether the corresponding code is available at various stages (decoder and demultiplexer). If all these requirements are satisfied connect the required appliance in the circuit.

VJCET, Vazhakulam 37

RFID Based Toll System

8.2.3 Assembly The tested PCB is placed inside a plastic box in a compact manner. Four holes are drilled on the box and bulb holders are fitted in it. A small hole is made in the box to connect the necessary wires to the AC supply.

VJCET, Vazhakulam 38

RFID Based Toll System

9. CONCLUSION
The project implements a toll system that allows only authorised people to pass through by verifying the password of the RFID card with that stored in the PIC. The system has a rfid module, PIC microcontroller based embedded system connected to a LCD module, Keyboard, and interfacing circuitry. This project has been successfully implemented. It was implemented on a small scale. The main objective of this project was to ensure a smooth flow of traffic at toll gates and to avoid congestions at toll gates. Also the use of cash has been eliminated totally. The whole system is simply controlled by this embedded system because of which man power is not required. This system is cost effective and motorists do not have to waste their valuable time on highways awaiting human assistance to make toll payments. This system is also user friendly.

VJCET, Vazhakulam 39

RFID Based Toll System

10. FUTURE ENHANCEMENTS


In the present situation vehicles will have to stop at the toll gate to make toll payments by swiping the cards. We can change the scenario by letting the vehicles pass through the toll gates wherein, their cards are pasted on the windshields. Thus saving time and free flow of traffic is also ensured. If the card does not have enough balance, vehicle owners will receive a message(sms) notifying them to recharge their cards. These cards can be recharged either by top up cards or by credit card transactions through the internet.

VJCET, Vazhakulam 40

RFID Based Toll System

11. BIBLIOGRAPHY
BOOKS REFERRED Rfid: Applications And Cases Krishna S Jaya

SITES REFERRED www.engineersgarage.com www.microchip.com

VJCET, Vazhakulam 41

Вам также может понравиться