Sei sulla pagina 1di 68

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD


Mini Project Report Submitted By FATHIMA.K.MOITHEEN RESHMA PURUSHAN VANI RAJ VISHNUPRIYA.S

In partial fulfilment of Sixth semester of Bachelor of Technology In ELECTRONICS AND COMMUNICATION OF COCHIN UNIVERSITY OF SCIENCE AND TECHNOLOGY

DEPARTMENT OF ELECTRONICS AND COMMUNICATION COLLEGE OF ENGINEERING,POONJAR KOTTAYAM-686 582 e-mail:-cepihrd@sancharnet.in website:-http://www.cep.ac.in MARCH 2011 COLLEGE OF ENGINEERING,POONJAR DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Dept of electronics

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

CERTIFICATE

This is to certify that the project report entitled RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Submitted by FATHIMA K MOITHEEN RESHMA PURUSHAN VANI RAJ VISHNUPRIYA S

For the partial fulfillment of completion of the Eighth Semester of B.Tech in Electronics and Communication of Cochin University of Science and Technology is a bona-fide record of the work done by her during the period July-2010 to March-2011under our guidance

GUIDE

HEAD OF THE DEPARTMENT

Dept of electronics

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

ACKNOWLEDGEMENT

First and foremost of all we thank god almighty for all the blessing bestowed upon us without which this project would not have been a reality. We take this opportunity to express our heartfelt gratitude and thanks to our principal Prof. SHIJI T.P, for giving us permission and necessary facilities. We are also extremely great full to Mr. RASHID M.E, Head of the Department, Electronics and Communication Engineering and class tutor and Mr. DEEPAK JOSE, our project co-ordinators for their valuable suggestions, timely guidance and constant encouragements. We also extend our sincere thanks to our guide Ms. REENU MATHEW, for the benefited co-operation and encouragement during the project.

Dept of electronics

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

ABSTRACT

Our project is based on automating the access control and security operations involved in a college campus. It can carried using non-contact devices, with the help of radio frequency identification (RFID).RFID cards are provided to students and lectures, these cards carry their own identification number in a coded format, which can be retrieved by the reader. By means of this the authentication of this student can be verified. Then is the access control at various points inside the organisation.

In this project we are mainly focussing on computer library in the college. Each students, who has RFID card can access the computer for a fixed of time duration. Student while showing his or her ID card to the reader module(associated with each computer monitor),the Embedded system verified the card.It can be implemented by using RFID reader, microcontroller board, RFID lags,LCD display and relays.

Dept of electronics

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

CONTENTS

1. INTRODUCTION 2. REQUIREMENTS FOR THE PROJECT HARDWARE REQUIREMENTS.. SOFTWARE REQUIREMENTS.. 3. BLOCK DIAGRAM... BLOCK LEVEL DESCRIPTION. 4. HARDWARE SECTION CIRCUIT DIAGRAM.6 CIRCUIT EXPLANATION... EMBEDDED SYSTEM PIC MICROCONTROLLER. MAX 232... RFID READER. PRINTED CIRCUIT BOARD PCB LAYOUT. SOLDERING 5. SOFTWARE REQUIREMENTS FLOW CHART. PROGRAM CODE.. 6. RESULTS AND DISCUSSION.. 7. CONCLUTION AND FUTURE SCOPE. 8. BIBLIOGRAPHY 9. APPENDIX

1 2 2 2 3 4 5 7 8 9 18 19 22 25 26 27 28 30 45 46 47 48

Dept of electronics

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

INTRODUCTION

Here we are presenting RFID Based Access Control System for College ID Card. Our system includes power supply, LCD display, RFID reader, microcontroller, relay to switch the computer. LCD display consists of one LCD and a potentiometer. RFID reader consists of a RFID reader and a resistor.PIC16F877Ais used us a microcontroller. Relay to switch consists of MAX232, CONN-D9F, capacitors, resistor, BC547, and OMIH-SH-105L. Initially power supply is provided to the system. When the student shows the ID card, the RFID reader reads the data from the card and it is transferred to the microcontroller. It decodes the data from the reader and checks whether the card is valid or not. If the card is valid, LCD displays it.The microcontroller will transfer the control to the PC through relay.

Dept of electronics

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

REQUIREMENTS FOR THE PROJECT


Both hardware and software requirements are needed for successful completion of project.

1. HARDWARE REQUIREMENTS Hardware requirements includes PIC16F877A: It is a 40 pin microcontroller chip MAX232 : Logic level translation from RS232 to TTL Cristal oscillator: 11.0592MHZ for clock signal generation Resistors: Various ranges of carbon resistors are required Capacitors: Various paper & electrolytic capacitors are used Switches: To provide ON & OFF conditions Transistor: To control the RELAY circuit RFID Reader: To access the code from the RFID tag Potentiometer: To control the intensity of LCD display LCD Display: To show the details RELAY : Connecting devices

2. SOFTWARE REQUIREMENTS Orcad layout design tools MP lab IDE

Dept of electronics

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

BLOCK DIAGRAM

LCD DISPLAY

POWER

MICROCONTROLLER

RELAY to switch the computer monitor

RFID READER

Dept of electronics

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

BLOCK LEVEL DISCREPTION


MICROCONTROLLER (PIC16F877A) The heart or core which controls the entire operation is a PIC microcontroller.PIC is a family of Harvard architecture microcontrollers made by Microchip Technology derived from the PIC1640.The name PIC initially referred to PROGRAMMAABLE INTERFACE CONTROLLER later renamed as PROGRAMMABLE INTELLIGENT COMPUTER.Microcontrollers have features like a CPU, memory addressing circuits and interrupt handling circuits as well as timers, parallel and serial I/O and internal RAM and ROM.Microcontrollers can function as a computer with addition of no external digital parts. POWER SUPPLY The PIC microcontroller required a +5 voltage supply. RELAY When the value coming from port d which is connected to the relay is zero, then the transistor remains off. So the relay is in the normally closed state. When the value coming from port d is one, then the transistor will be on. So current begins to flow through the inductor and is grounded through the transistor. This produces an induction in the coil that induces the moving contact to make a connection with the normally opened pin of the relay. Itcompletes the circuit to which the monitor of PC will connect and makes it on. LCD The major use of liquid crystal display (LCD) is the data output display for user friendliness. We use 16*2 LCD to enable two row displays. It has two registerscommand register and data register. The three control pins decide the command /data flow, read/write and enable/disable. MAX 232 MAX 232 is used to translate the TTL logic to RS 232 logic levels and vice versa. The logic at the cable is RS 232 while the PIC operates in TTL logic. Serial RS 232 works with voltages -15 to -3 for high and +3 to +15 for low while TTL operates between 0 to +0.8 for low and +2 to +5 for high. Hence a translation is necessary.

This translation is done by MAX 232 from maxim, the first

Dept of electronics

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

HARDWARE SECTION

CIRCUIT DIAGRAM
Dept of electronics 10 College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

CIRCUIT EXPLANATION

Dept of electronics 11

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

WORKING

RFID reader is used to power up the tag. It established bidirectional data link. It can communicate with network server. Inventory tags and filter results. It can read 100 to 300 tags per tag. These readers can be fixed or mobile type. LCD is connected to pics PORTB. It is connected in 8 bit mode. 8 data lines, D0-D7 to RB0-RB7. RS and EN pins connected to RC0 and RC1 respectively. The system is connected to PCs serial port via MAX232. It is RS232/TTL converter. PC side is based on RS232 and PIC side is based on TTL/CMOS. SOUT of RFID reader is connected to PICs UART receiver Pin (RC7). Enable pin is connected to RC5. RFID reader outputs RFID codes whenever ID card is swipe on it with a baud rate of 2400. The relay is switched on and OFF by changing the value in RD7. The transistor here used to drive the relay.

EMBEDDED SYSTEM

Dept of electronics 12

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Embedded system has already improved our lives in numerous ways. The embedded system is a combination of hardware and perhaps additional mechanical parts designed to perform a specific function. Such a system is in direct contrast to personal computers, which is not designed to do a specific task within a given time frame, repeatedly, endlessly, with or without human intervention. Unlike a PC, embedded system does not require a complete operating system, which may make the system bulky, but only the functionality of an operating system is needed. ADVANTAGES OF EMBEDDED SYSTEMS High performance The interaction of various ICs shortens the travelling route and time of data to be transmitted resulting in higher performance. Low power consumption The integration of various ICs eliminates buffers and other interface circuits. As the number of components is reduced less power will be consumed. Similar and more compacts Housed in a single separate package, the chip is smaller in size and therefore occupies less space on the PCB. Hence producing using embedded system is slimmer and more compact. Reduced design and development system The systems on a chip provide all the functionality required by the system. System designers need not worry about basic functions of the system-right from the beginning of the design phase, they can focus on development is reduced and this in turn reduces the time to market their products. Low system costs In the past several chips in separate packages were required to configure a system. Now, just one system- on chip can replace all of these, dramatically reducing the package costs.

PIC MICROCONTROLLER

Dept of electronics 13

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

The heart or the core which controls the entire operation is a PIC microcontroller. PIC is a family of Harvard architecture microcontrollers made by Microchip Technology derived from the PIC1640 originally developed by General Instruments Microelectronics Division.. The name PIC initially referred to PROGRAMMABLE INTERFACE CONTROLLER later renamed as PROGRAMMABLE INTELLIGENT COMPUTER.

Dept of electronics 14

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

ADVANTAGES OF MICROCONTROLLER OVER MICROPROCESSORS The contrast between a microcontroller and a microprocessor is best exemplified by the fact that most microprocessors have many op codes for moving data from external memory to the CPU; microcontroller have one or two. Microprocessor may have one or two types of bit handling instructions; microcontrollers will have many. Microprocessor is concerned with rapid movement of code and data from external address to the chip. Microprocessor must have additional parts to be optional; the microcontrollers can function as a computer with addition of no external digital parts. Microprocessors are intended to be general purpose digital computer where as microcontrollers are intended to be special purpose digital controllers.

Microprocessors contain a CPU, memory addressing circuits and interrupt handling circuits. Microcontrollers have these features as well as timers, parallel and serial I/O and internal RAM and ROM. WHY WE SELECTED PIC? We selected PIC for our project in view of its advanced features which are listed below. 1. SPEED When operated at its maximum clock rate, a PIC executes most of its instructions in 0.2 microseconds or 5 instructions per microseconds.

2. HIGH PERFORMANCE RISC CPU 3. INSTRUCION SET SIMPLICITY The instruction set consists of just 35 instructions. 4. INTEGRATION OF OPERATIONAL FEATURES Power on reset and brown protection ensure that the chip operates only when the supply voltage is within specification. A watchdog timer resets the PIC if the chip ever malfunctions and deviates from its normal operations. Any one of four clock

Dept of electronics 15

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

option can be supported, including a low cost RC oscillator and a high accuracy crystal oscillator. 5. PROGRAMMABLE TIMER OPTIONS Three versatile timers can characterize inputs; control outputs and provides internal timing for program executions. 6. INTERRUPT CONTORL Up to 12 independent interrupt sources which can provide useful interrupting as and when needed. 7. EEPROM/ ROM OPTIONS Development is supported by ultra violet erasable programmable parts. Both small and large production runs are supported by lower cost one time programmable parts 8. INBUILT MODULES The PIC microcontroller has a number of inbuilt modules like ADC, USART which increases the versatility of the microcontroller 9. LOW POWER CONSUMPTION 10 WIDE OPERATING VOLTAGE RANGE 2.5V to 5V 11. PROGRAMMABLE CODE PROTECTION MODE 12. POWER SAVING SLEEP MODE MEMORY ORGANIZATION There are three memory blocks in each of these PIC micro MCUs. The Program Memory and Data Memory have separate buses so that concurrent access can occur. The third block is EEPROM. Program Memory Organization The PIC16F87X devices have a 13-bit program counter capable of addressing an 8K x 14 program memory space. The PIC16F877/876 devices have 8K x 14words of FLASH

Dept of electronics 16

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

program memory. Accessing a location above the physically implemented address will cause a wrap around. The reset vector is at 0000h and the interrupt vector is at 0004h. Data Memory Organization The data memory is partitioned into multiple banks which contain the General Purpose Registers and the Special Function Registers. Bits RP1 (STATUS<6>) andRP0 (STATUS<5>) are the bank select bits. Each bank extends up to 7Fh (128bytes). The lower locations of each bank are reserved for the Special Function Registers. Above the Special Function Registers are General Purpose Registers, implemented as Static RAM. All implemented banks contain Special Function Registers. Some high use Special Function Registers from one bank may be mirrored in another bank for code reduction and quicker access.

DATA EEPROM AND FLASH PROGRAM MEMORY The Data EEPROM and FLASH Program Memory are readable and writable during normal operation over the entire VDD range. A bulk erase operation may not be issued from user code (which includes removing code protection). The data memory is not directly mapped in the register file space. Instead it is indirectly addressed through the Special Function Registers (SFR). There are six SFRs used to read and write the program and data EEPROM memory. EECON1, EECON2, EEDATA, EEDATH, EEADR EEADRH. The EEPROM data memory allows byte read and writes. When interfacing to the data memory block, EEDATA holds the 8-bit data for read/write and EEADR holds the address of the EEPROM location being accessed. The registers EEDATH and EEADRH are not used for data EEPROM access. These devices have up to 256 bytes of data EEPROM with an address range from 0h to FFh. The program memory allows word reads and writes. Program memory access allows for checksum calculation and calibration table storage. A byte or word write automatically erases the location and writes the new data (erase before write). Writing to program memory will cease operation until the write is complete.

Dept of electronics 17

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Reading the Data EEPROM Memory To read a data memory location, the user must write the address to the EEADR register, clear the EEPGD control bit (EECON1<7>) and then set control bit RD (EECON1<0>). The data is available in the very next instruction cycle of the EEDATA register; therefore it can be read by the next instruction. EEDATA will hold this value until another read operation or until it is written to by the user (during a write operation). Writing to the Data EEPROM Memory To write an EEPROM data location, the address must first be written to the EEADR register and the data written to the EEDATA register. The write will not initiate if the above sequence is not exactly followed. It is strongly recommended that interrupts be disabled during this code segment. Additionally, the WREN bit in EECON1 must be set to enable writes. This mechanism prevents accidental writes to data EEPROM due to unexpected code execution (i.e., runaway programs). The WREN bit should be kept clear at all times, except when updating the EEPROM. The WREN bit is not cleared by hardware.

I/O PORTS Some pins for these I/O ports are multiplexed with an alternate function for the peripheral features on the device. In general, when a peripheral is enabled, that pin may not be used as a general purpose I/O pin. PORTA and the TRISA Register PORTA is a 6-bit wide bi-directional port. The corresponding data direction register is TRISA. Setting a TRISA bit (=1) will make the corresponding PORTA pin an input (i.e., put the corresponding output driver in a hi-impedance mode). Clearing a TRISA

Dept of electronics 18

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

bit (=0) will make the corresponding PORTA pin an output (i.e., put the contents of the output latch on the selected pin). Reading the PORTA register reads the status of the pins, whereas writing to it will write to the port latch. All write operations are read-modify-write operations. Therefore, a write to a port implies that the port pins are read; the value is modified and then written to the port data latch. Pin RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open drain output. All other PORTA pins have TTL input levels and full CMOS output drivers. Other PORTA pins are multiplexed with analog inputs and analog VREF input. Theoperation of each pin is selected by clearing/setting the control bits in the ADCON1 register (A/D Control Register1). The TRISA register controls the direction of the RA pins, even when they are being used as analog inputs. The user must ensure the bits in the TRISA register are maintained set when using them as analog inputs.

PORTB and the TRISB Register PORTB is an 8-bit wide, bi-directional port. The corresponding data direction register is TRISB. Setting a TRISB bit (=1) will make the corresponding PORTB pin an input (i.e., put the corresponding output driver in a hi-impedance mode). Clearing a TRISB bit (=0) will make the corresponding PORTB pin an output (i.e., put the contents of the output latch on the selected pin). Three pins of PORTB are multiplexed with the Low Voltage Programming function; RB3/PGM, RB6/PGC and RB7/PGD. The alternate functions of these pins are described in the Special Features Section. Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pullups. This is performed by clearing bit RBPU (OPTION_REG<7>). The weak pull-up is automatically turned off when the port pin is configured as an output. The pull-ups are disabled on a Power-on Reset of PORTBs pins, RB7:RB4, have an interrupt on change feature. Only pins configured as inputs can cause this interrupt to occur (i.e. any RB7:RB4 pin configured as an output is excluded from the interrupt on change

Dept of electronics 19

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

comparison).The input pins (of RB7:RB4) are compared with the old value latched .On the last read of PORTB. The mismatch outputs of RB7:RB4 are ORed together to generate the RB Port Change Interrupt with flag bit RBIF (INTCON<0>). PORTC and the TRISC Register PORTC is an 8-bit wide, bi-directional port. The corresponding data direction register is TRISC. Setting a TRISC bit (=1) will make the corresponding PORTC pin an input (i.e., put the corresponding output driver in a hi-impedance mode). Clearing a TRISC bit (=0) will make the corresponding PORTC pin an output (i.e., put the contents of the output latch on the selected pin). PORTC is multiplexed with several peripheral functions (Table 3-5).PORTC pins have Schmitt Trigger input buffers.When the I2C module is enabled, the PORTC (3:4) pins can be configured with normal I2C levels or with SMBUS levels by using the CKE bit (SSPSTAT <6>). When enabling peripheral functions, care should be taken in defining TRIS bits for each PORTC pin. Some peripherals override the TRIS bit to make a pin an output, while other peripherals override the TRIS bit to make a pin an input. Since the TRIS bit override is in effect while the peripheral is enabled, read-modify write instructions (BSF, BCF, XORWF) with TRISC as destination should be avoided.

PORTD and TRISD Registers PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is individually configurable as an input or output. PORTE and TRISE Register This section is not applicable to the PIC16F873 or PIC16F876. PORTE has three pins, RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7, which are individually configurable as inputs or outputs. These pins have Schmitt Trigger input buffers. I/O PORTE becomes control inputs for the microprocessor port when bit PSPMODE (TRISE<4>) is set. In this mode, the user must make sure that the TRISE<2:0> bits are set (pins are

Dept of electronics 20

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

configured as digital inputs). Ensure ADCON1 is configured for digital I/O. In this mode, the input buffers are TTL. Register 3-1 shows the TRISE register, which also controls the parallel slave port operation. PORTE pins are multiplexed with analog inputs. When selected as an analog input, these pins will read as 0s. TRISE controls the direction of the RE pins, even when they are being used as analog inputs. The user must make sure to keep the pins configured as inputs when using them as analog inputs TIMER0 MODULE The Timer0 module timer/counter has the following features: 8-bit timer/counter, Readable and writable, 8-bit software programmable prescaler, Internal or external clock select, Interrupt on overflow from FFh to 00h, Edge select forexternal clock. Timer mode is selected by clearing bit T0CS (OPTION_REG<5>). Counter mode is selected by setting bit T0CS (OPTION_REG<5>). In counter mode, Timer0 will increment either on every rising or falling edge of pin RA4/T0CKI. The incrementing edge is determined by the Timer0 Source Edge Select bit T0SE (OPTION_REG<4>). Clearing bit T0SE selects the rising edge. The TMR0 interrupt is generated when the TMR0 register overflows from FFh to 00h. This overflow sets bit T0IF (INTCON<2>). The interrupt can be masked by clearing bit T0IE (INTCON<5>). Bit T0IF must be cleared in software by the Timer0 module interrupt service routine before re-enabling this interrupt. The TMR0 interrupt cannot awaken the processor from SLEEP since the timer is shut off during SLEEP. Using Timer0 with an External Clock When no prescaler is used, the external clock input is the same as the prescaler output. The synchronization of T0CKI with the internal phase clocks is accomplished by sampling the prescaler output on the Q2 and Q4 cycles of the internal phase clocks. Therefore, it is necessary for T0CKI to be high for at least 2Tosc (and a small RC delay of 20 ns) and low for at least 2Tosc (and a small RC delay of 20 ns). TIMER1 MODULE

Dept of electronics 21

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

The Timer1 module is a 16-bit timer/counter consisting of two 8-bit registers (TMR1H and TMR1L), which are readable and writable. The TMR1 Register pair (TMR1H:TMR1L) increments from 0000h to FFFFh and rolls over to 0000h. The TMR1 Interrupt, if enabled, is generated on overflow, which is latched in interrupt flag bit TMR1IF (PIR1<0>). This interrupt can be enabled/disabled by setting/clearing TMR1 interrupt enable bit TMR1IE (PIE1<0>).Timer1 can operate in one of two modes: As a timer and as a counter.

MAX232

Dept of electronics 22

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

VDD

C1

10 uF

16

R2IN TX C2 10 uF

13 8 11 10 1 3 4 5 6

R1IN R2IN T1IN T2IN C+ C1C2+ C2V-

R1OUT R2OUT T1OUT T2OUT MAX232 U1


GND

12 9 14 7

VCC

V+

RX T2OUT

C3 10 uF

C4 10 uF

The MAX232 from maxim was the first IC which in one package contains the necessary drivers (two) and receivers (two), to adapt the RS232 to TTL logic levels. It just needs one voltage +5V and generates the necessary RS232 signal voltage levels. The MAX232 requires external capacitors for the internal voltage pump. The necessary MAX232 needs external capacitors of 1/10th capacity of what the original MAX232 needs but MAX232 has these capacitors built internally. Typically a pair of a driver /receiver of the MAX232 is used for TX and RX and the second one for CTS and RTS. RELAY OPERATION When the value coming from port B which is connected to the relay is 0, then the transistor remains OFF .So the relay is in the normally closed state. Then the appliances connected to the relay also remains in the OFF state. When the value coming from port B is 1, then the transistor will be ON. So current begins to flow through the inductor and is grounded through the transistor. This produces an induction in the coil that induces the moving contact to make a connection with the normally open pin of the relay. This completes the circuit to which the devices are connected and make it ON RFID READER

Dept of electronics 23

College Of Engineering Poonjar

15

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

1. Readers are devices which continuously emits radio frequency up to certain range depending upon the type of reader used. 2. It is a trans-receiver which can transmit as receive an information using radio frequency. 3. These devices can be hand-held or portable depending upon the application.

4. The typical reader has an antenna to communicate with the tag. The size and the form of the antenna depend on the application and frequency used. 5. (a) (b) There are two main classes of RFID readers: Read only Reader. Read/write type of reader.

A. Read only reader: These readers are capable of only reading the information on the tag. We cannot change the information on the tag. B. Read/write type of reader: These readers can read the information on the tag as well as these have capability of change the information present on the tag. REDAER FUNCTIONING: It is used to power up the tag. It established bidirectional data link. It can communicate with network server. Inventory tags and filter results. It can read 100 to 300 tags per tag. These readers can be fixed or mobile type. READERs GENERAL ANATOMY: A typical reader generally has following parts 1. 2. 3. a. b. c. Digital Signal Processor. Network Processor. Following Radio modules 915MHz 13.56MHz 125 KHz

BLOCK DIAGRAM OF TYPICAL RFID READER WITH FSK

Dept of electronics 24

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Probable PCB mounted diagram for RFID reader with RS232 Interface

The above shown is the probable PCB mounted diagram of typical RFID reader for understanding purpose. There are two processors These are DSP and N/W processors. DSP deals with the radio frequency signals. The other circuitry is also shown in the diagram.

Dept of electronics 25

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

There is a coil antenna which is quit big in size with other components. This antenna is used for radio wave transmission. There are also four pin outs as follows: 1. 2. 3. 4. VCC: This is for providing required voltage to circuit. GND: For grounding purpose. Sout: Signal out pin to interface with RS232. En : This is kept at ground level

PRINTED CIRCUIT BOARDS

Dept of electronics 26

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Printed circuit boards are used to route electrical currents and signals through copper, which are firmly bonded to an insulating base. Single sided PCBs are used in consumer electronics such as TV, Radio receivers etc. Double sided PCBs are used for sophisticated instruments such as CRO; microphones etc. large component density is possible with double sided and higher PCBs. Mother Boardsemploy PCBs of 7 layers. DESIGN OF PCB PCB designing is the final step of designing of any electronic circuit, which is also the first major step in production of PCBs, the assembly and the serviceability of the PCB. It forms an important aspect in the durability and reliability of the electronic circuits. The reducibility of the PCB also depends on the design. The design of PCB consists of the lay out and then the preparation of the art work. The lay out should include all the relevant aspects of the PCB design and the art work preparation bring it to the form required for the production process. Depending on the accuracy required the art work is prerequisite to the actual lay out, it is prepared in the scale 1:1, 2:1 and 4:1 scale. Most commonly it is prepared in the scale of 1:1 LAYOUT APPROACH First the board out lines and the connectors are marked in a sheet of paper, followed by sketching of the component ratlines with connecting points and the conductor patterns. The lay out is prepared as viewed from the component side first so as to avoid any confusion. The lay out is developed in the direction of the signal flows as far as possible. This minimizes the number of inter connections. Among the components the largest one are placed first and the space in between is filled with the smaller components. Generation of PCB art work may be approached in several ways. The most versatile among them is black taping. The layout drawn on the paper is first laterally inverted. It is the transferred to the board using carbon papers. The process of the black is then begun. BLACK TAPING METHOD

Dept of electronics 27

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

With availability of self-adhesive path and tapes, the artwork is produced in a fast and precise manner. The self-adhesive pads are supplied sticking on a backing paper. The backing paper is removed and the pad is carefully pressed over the required portion. If the pad position has to be shifted the pad can easily peeled of and replaced correctly. Self-adhesive precision tapes are also available in a wide range of widths. They are supplied in rolls and have a width tolerance of 0.05 to 0.1mm. The flexible non transparent materials permits artwork with round bent corners. The self-adhesive pads and tops have a limited shelf time, which may be up to three years. The storage has to be done under appropriate conditions. Temperature must be in the range of 5 to 25 degree Celsius and humidity below 75%. ETCHING The final copper pattern is formed by selective removal of unwanted copper, which is not protected by a photo resist. Care should be taken to prevent under etching and overhand. Under etching is the sidewise etching due to the prolonged etching process. Overhanging is caused when a metal etch resist grows sidewise .Etching PCBS as required in the modern electronic equipment production is done in spray type etching machines. SPRAY ETCHING In spray etching the etchant is pumped under pressure from a sump via pipe network to the nozzle and from their nozzle gets splashed on the boats. Spray etching machines can offer very high etching uniformity and fast etching rate. The high etching uniformity is achieved by spraying through a number of equally distributed nozzles in a ring supply. High etching rate is the result of continuous flow of fresh etchant over the board and the oxygen absorbed in the etchant through spraying. ETCHANT Many factors have to be considered to choose the most suitable etchant system for PCB production process. The etch resist should be compatible with the etchant.

Dept of electronics 28

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Some commonly used etchant are ferric chloride, cupric chloride, chromic acid and alkaline ammonia. Among various etchants, Ferric chloride was the earliest one used on a mass scale. With the availability of etchants which can generated and which are compatible with common metal resists, ferric chloride has lost its importance. After the etching is completed, ferric chloride is washed of from the ball and it is cleaned dry. The black tapes and pads are peeled off. The board is then cleaned with hypo, which removes the last traces of ferric chloride on this board. Then warmish is applied lightly over the board, to render the copper conductors corrosion resistant.

DRILLING Holes are now positioned using high speed drilling, with specifically designed bits of correct diameters having to depend upon the component lead drilled into appropriate places. This machine is used for handlings PCBs. Drill can be chosen of each different diameter.

PCB LAYOUT

Dept of electronics 29

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

SOLDERING
Soldering is the process of joining two or more dissimilar or similar metals by melting another metal having low melting point.

Dept of electronics 30

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

SOLDERING FLUXES In order to make the surfaces accept the solder readily, the component terminals should be free from oxides and other obstructing films. Soldering fluxes cleans oxide from the surface of the metal. This process is called tinning. Zinc chloride, Ammonium chlorides and rosin are the most commonly used fluxes. These are available in petroleum jelly as paste flux. The residues which remain after the soldering may be washed out with more water accompanies by brushing SOLDER Solder is used for joining two or more metals at temperatures below their melting point. The popularly used solders are the alloy of tin (60%) and lead (40%) that melts at 375 degree F (190 degree C) and solidifies when it cools. Most of the solder wires are flux cored type. When such solder wires are used extra soldering flux is not required. SOLDERING TOOLS Soldering iron: It is the tool used to melt the solder and apply atr the joins in the circuits. It operates in 230v mains supply. The normal power rating of the soldering iron is 10W, 25W, 35W, 65W & 125W. The iron bit at the top of it gets heated up within a few minutes.10W & 25W soldering irons are sufficient for light duty works. Soldering gun. : It is gun shaped soldering tool used to especially when more heat is required. Its trigger is \switch that controls AC power. Soldering station is equipment which provides an iron and a control console threat controls the temperature. The tip temperature is maintained by a feedback control loop.

Dept of electronics 31

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

SOFTWARE DESCRIPTION

Dept of electronics 32

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

FLOW CHART

START

Initialise all data of students and teachers in the college

Initialise LCD, RTC, UART and all IO ports

Display current time on LCD

Wait for response from RFID reader

Search data base for the received RFID C B A

Dept of electronics 33

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

PROGRAM CODE
Dept of electronics 34 College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

RFID-TEST
#include <pic.h> #include "lcd.h" #include "i2c.h" #include "string.h" #define RFID_EN RD0 #define POWER RD1 #define uart_tx_data(data); {while(!TRMT);TXREG=data;} __EEPROM_DATA('N','A','M','E','1',' ',0,' '); __EEPROM_DATA(0,0,0,0,0,0,0,0); //from 0x00 to 0x07 //from 0x08 to 0x0F

__EEPROM_DATA('N','A','M','E','2',' ',0,' '); __EEPROM_DATA(0,0,0,0,0,0,0,0);

//from 0x10 to 0x17 //from 0x18 to 0x1F

__EEPROM_DATA('N','A','M','E','3',' ',0,' '); __EEPROM_DATA(0,0,0,0,0,0,0,0);

//from 0x20 to 0x27 //from 0x28 to 0x2F

__EEPROM_DATA('N','A','M','E','5',' ',0,' '); __EEPROM_DATA(0,0,0,0,0,0,0,0); __EEPROM_DATA(0,0,0,0,0,0,0,0); __EEPROM_DATA(0,0,0,0,0,0,0,0);

//from 0x30 to 0x37 //from 0x38 to 0x3F //from 0x38 to 0x3F //from 0x38 to 0x3F

unsigned char sec; unsigned char min; unsigned char hr;

Dept of electronics 35

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

unsigned char date; unsigned char month,year;

typedef struct { unsigned char data[11]; unsigned char status; }rfid_pack; typedef struct { const unsigned char *id; const unsigned char address; }data; data data_base[4]={"16004C7A26",0x00, "16004CDD44",0x10, "16004C61",0x20, "09543",0x30}; rfid_pack rfid; unsigned char *ptr=rfid.data; unsigned char i,add; bit valid=0;

unsigned char bcd2dec(unsigned char bcd) { return (((bcd>>4)*10)+bcd%16); }

void uart_tx_decimal(char buf)

Dept of electronics 36

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

{ uart_tx_data((buf/10)%10 + 48); uart_tx_data((buf)%10 + 48); } void lcd_decimal(char buf) { lcd_data((buf/10)%10 + 48); lcd_data((buf)%10 + 48); } unsigned char j,buf,rtc_cnt=0; void interrupt isr() { unsigned char j,add,buf; if(RCIF==1) { if(RCREG=='\n') ptr=rfid.data; GIE=0; RCIF=0; for(i=0;i<10;i++) { while(RCIF==0); *ptr=RCREG; ptr++; } *ptr='\0'; rfid.status=1; {

Dept of electronics 37

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

GIE=1; } } if(TMR1IF) { TMR1IF=0; if(rtc_cnt>10) rtc_cnt=0; get_time(&hr,&min,&sec); hr=bcd2dec(hr);min=bcd2dec(min);sec=bcd2dec(sec); lcd_cmd(0x88); lcd_decimal(hr); lcd_data(':'); lcd_decimal(min); lcd_data(':'); lcd_decimal(sec); } rtc_cnt++; // // // } } } if(valid){ if(min) {

void main() { unsigned char min1,min2,sec1,sec2,hr1,hr2;

Dept of electronics 38

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

hr2=0;min2=1; TRISC=0x80;TRISB=0x00;TRISD=0;//TRISD1=0;TRISD6=0;TRISD5=0; SPEN=1;CREN=1;TXEN=1;BRGH=0;SPBRG=129; RCIF=0;RCIE=1;PEIE=1;GIE=1; T1CON=0b00111001;TMR1IE=1;TMR1IF=0;TMR1L=0;TMR1H=0; i2c_init(); __delay_ms(50); // // set_time(0x10,0x05,0x00); set_date(0x12,0x03,0x11); lcd_init(); RFID_EN=0; valid=0; lcd_word(0,"CampsCrd"); while(1) {

__delay_ms(2000); lcd_cmd(1); lcd_word(16,"campusCard"); lcd_cmd(0xC0); hr1=eeprom_read(0x4a); min1=eeprom_read(0x4b); sec2=sec1=eeprom_read(0x4c); while(rfid.status==0) if(valid==1) { POWER=1; if(sec1!=sec) { sec1=sec; sec2--; {

Dept of electronics 39

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

} lcd_cmd(0xC8); lcd_decimal(hr2); lcd_data(':'); lcd_decimal(min2); lcd_data(':'); lcd_decimal(sec2); if((sec2==0)&&(min2!=0)&&(hr2!=0)) sec2=59; if(min2==0) { min2=60; if(hr2!=0) hr2--; } } min2--; } if((min2==0)&&(hr2==0)&&(sec2==0)) valid=0; } else if(valid==0) {POWER=0;RFID_EN=0;} } RFID_EN=1; rfid.status=0; // get_time(&hr,&min,&sec); get_date(&year,&month,&date); { {

Dept of electronics 40

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

//

hr=bcd2dec(hr);min=bcd2dec(min);sec=bcd2dec(sec); year=bcd2dec(year);month=bcd2dec(month);date=bcd2dec(date); for(i=0;i<4;i++) { if(strcmp(rfid.data,data_base[i].id)==0) { lcd_cmd(0x01); lcd_word(0,"valid user"); lcd_cmd(0xc0); add=i*0x10; eeprom_write((0x4a),hr); eeprom_write((0x4b),min); eeprom_write((0x4c),sec); eeprom_write((0x4d),date); eeprom_write((0x4e),month); eeprom_write((0x4f),year); buf=0xff; for(j=0;buf!='\0';j++) {

buf=eeprom_read(add++); lcd_data(buf); } valid=1;POWER=1; break; } } if(valid==0) {

Dept of electronics 41

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

lcd_cmd(0x01); lcd_word(0,"invalid user"); // // // // // // // // for(i=0;i<=10;i++) eeprom_write(0x40+i,rfid.data[i]); eeprom_write((0x4a),hr); eeprom_write((0x4b),min); eeprom_write((0x4c),sec); eeprom_write((0x4d),date); eeprom_write((0x4e),month); eeprom_write((0x4f),year); }

} } I2C #define _XTAL_FREQ 20000000 void i2c_init( void ) { TRISC3 = 1; TRISC4 = 1; SSPADD = 6; // SLC // SDmA // (Fosc / 4*CLK) - 1

SSPSTAT = 0b10000000; // Disable slew rate control for 100kHz speed SSPCON2 = 0b00010000; // Clear flags SSPCON SSPIF=0; } = 0b00101000; // Master mode, enable I2C

Dept of electronics 42

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

void i2c_idle( void ) { while(RW); }

void i2c_start( void ) { SEN = 1; while( SSPIF==0 ); } // Enable Start condition // Wait for condition to be sent

/* Sends the Repeated Start condition */ void i2c_repstart( void ) { RSEN = 1; while( SSPIF==0 ); } // Enable Repeated Start condition // Wait for condition to be sent

/* Sends the Stop condition */ void i2c_stop( void ) { PEN = 1; while( SSPIF==0 ); } // Enable Stop condition // Wait for condition to be sent

Dept of electronics 43

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

void i2c_write( unsigned char data ) { i2c_idle(); SSPBUF = data; // Loads the buffer with provided data

while( BF ); // Wait until the buffer is empty }

/* Reads a byte from the I2C bus, set ack to send acknowledgement */ unsigned char i2c_read() { unsigned char data;

i2c_idle(); RCEN = 1; while(!BF); data = SSPBUF; return data; } // Enable Recieve mode // Wait until byte recieved // Save data from buffer // Return data read from bus

void i2c_rtc_write( unsigned char address, unsigned char data ) { i2c_idle(); i2c_start(); i2c_write( 0xd0 ); i2c_write( address );

Dept of electronics 44

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

i2c_write( data ); i2c_stop(); }

unsigned char i2c_rtc_read( unsigned char address ) { unsigned char data;

i2c_idle(); i2c_start(); i2c_write( 0xd0 ); i2c_write( address ); i2c_repstart(); i2c_write( 0xd1 ); data = i2c_read(); i2c_stop(); return data; } voidset_time( char hh,charmm,charss ) { i2c_rtc_write( 0x00, 0x80 ); i2c_rtc_write( 0x01, mm ); __delay_ms(200); i2c_rtc_write( 0x02, hh ); __delay_ms(200); i2c_rtc_write( 0x00, ss );

Dept of electronics 45

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

__delay_ms(200); } voidset_date(char dd,charmm,charyy) { i2c_rtc_write( 0x03, 0x01 );__delay_ms(200); i2c_rtc_write( 0x04, dd );__delay_ms(200); i2c_rtc_write( 0x05, mm );__delay_ms(200); i2c_rtc_write( 0x06, yy );__delay_ms(200); } voidget_time(char *hr,char *min,char *sec) { *hr = i2c_rtc_read( 2 )&0x3f; *min = i2c_rtc_read( 1 ); *sec=i2c_rtc_read( 0 ); } voidget_date(char *dd,char *mm,char *yy) { *dd = i2c_rtc_read( 4 ); *mm = i2c_rtc_read( 5 ); *yy = i2c_rtc_read( 6 ); }

LCD #include <pic.h> #ifndef _XTAL_FREQ

Dept of electronics 46

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

#define _XTAL_FREQ 20000000 #endif #include "lcd.h" voidlcd_cmd (unsigned char a) { LCD_DATA=a; LCD_RS=0; LCD_EN=1; __delay_ms(1); LCD_EN=0; __delay_ms(9); }

voidlcd_data (unsigned char a) { LCD_DATA=a; LCD_RS=1; LCD_EN=1; __delay_ms(1); LCD_EN=0; __delay_ms(9); }

voidlcd_init() { __delay_ms(100);

Dept of electronics 47

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

lcd_cmd(0x38); __delay_ms(50); lcd_cmd(0x0F); __delay_ms(20); lcd_cmd(0x06); __delay_ms(20); lcd_cmd(0x01); __delay_ms(20); lcd_cmd(0x80); __delay_ms(20); }

voidlcd_word(char pos,const char *word) { if((pos<16) && (pos>=0)) lcd_cmd(0x80+pos); else if((pos<32) && (pos>=16)) lcd_cmd(0xc0 + (pos-16)); for(;*word!='\0';word++){ lcd_data(*word); } }

#define LCD_RS RD6 #define LCD_EN RD5 #define LCD_DATA PORTB

Dept of electronics 48

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

voidlcd_cmd (unsigned char); voidlcd_data (unsigned char); voidlcd_init(); voidlcd_word(char ,const char *);

RESULTS AND DISCUSSIONS


Dept of electronics 49 College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Our project, RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD is implemented as per the design. It is an extremely valuable project. This project introduces a new way to automate the collage. We take this opportunity to express our sincere gratitude to all those who have helped us for the successful completion of our project.

CONCLUSIONS AND FUTURE SCOPE

Dept of electronics 50

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

This project is a PIC based one. During the course of carrying out the project, many unforeseen obstacles and minor mistakes forced us to thoroughly analyse the circuit and design. This made us to acquire more knowledge in PIC. Now our system has been designed and constructed successfully. Through this project we get courage and confidence to undertake this kind of work in future also. It enriches our knowledge regarding designing, construction, fabrication and other aspect of many devices. The system can be used to automate the college campus.

BIBLIOGRAPHY

Dept of electronics 51

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

DESIGN WITH PIC MICRO CONTROLLERS:JOHN.B.PEATMAN THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEM: MAZIDI & MAZIDI

WEBSITES www.microchip.com www.electronicsforu.com

Dept of electronics 52

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

APPENDIX

Dept of electronics 53

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 54

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 55

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 56

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 57

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 58

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 59

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 60

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 61

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 62

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 63

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 64

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 65

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 66

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 67

College Of Engineering Poonjar

RFID BASED ACCESS CONTROL FOR COLLEGE ID CARD

Dept of electronics 68

College Of Engineering Poonjar