Sunteți pe pagina 1din 62

Project 2011 Based Attendance System

RFID

ACKNOWLEDGEMENT

We should like to express our heartfelt gratitude to Mrs. C.G. Anitha, Principal of our polytechnic for providing the best facility and atmosphere for this Project work. We greatly thankful to Mrs. Suhara .K.M, Head of Department of Electronics for all necessary help extended by her in the fulfillment of this Project. We acknowledge our Project guide Mr.Devarajan.M.K, Mr. Sureshkumar.K.B, Mrs.sussamma Mathew, Mrs. Padmaja Detha, Lucturers in Electronics Engineering for the guidance and help they have always given us. Finally we thank all our colleagues for their heartfelt co-operation and tremendous support they have given to us during the collection of materials and also during our Project.

Department of Electronics

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

CONTENTS

1.INTRODUCTION 2.BLOCK DIAGRAM DESCRIPTION 3.EXPLANATION 4.CIRCUIT DIAGRAM 5.FLOW CHART 6.PROGRAM 7.PCB LAYOUT 8.PCB FABRICTION 9. MERITS AND DEMERITS 10.FUTURE ENHANCEMENT 11.CONCLUSION 12REFERENCE

Department of Electronics

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

CHAPTER 1 INTRODUCTION

Traditionally the attendance at an establishment is usually done in a book register. It is time consuming. It is very difficult to verify the attendance over long periods. This method is very time consuming and very difficult to verify the attendance over a week or above. Keeping attendance registers is space consuming. Here chances of doing malpractice in marking attendance are high. RFID based attendance system uses RFID tags for each person. A person marks the attendance by swiping the tag near RFID reader module. The attendance is temporarily saved in the EEPROM. At any time the circuit can be connected to a computer and the attendance is moved from EEPROM to a text file in computer. It has following advantages. (1) Simplicity and reliability, (2) Saving attendance in a computer allows easy verification and longer record keeping. It works on radio frequency transmitters and receivers. Each person is given a RF ID card which is having a unique code. When it is swiped on a RF ID card reader, it reads the code and is stored. The attendance is temporarily saved in the EEPROM. At any time the circuit can be connected to a computer and the attendance is moved from EEPROM to a text file in computer. The advantage of this system is simplicity and reliability. Saving attendance in a computer allows easy verification and longer record keeping.

Department of Electronics

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

CHAPTER 2 BLOCK DIAGRAM AND EXPLANATION

2.1 Block Diagram

Figure 2.1 Basic block diagram

2.2 EXPLANATION RFID READER The DT125R series RFID Proximity OEM Reader Module has a builtin antenna in minimized form factor. It is designed to work on the industry standard carrier frequency of 125 kHz. This LF reader module with an internal or an external antenna facilitates communication with Read-Only
Department of Electronics

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

transponders type UNIQUE or TK5530 via the air interface. The tag data is sent to the host systems via the wired communication interface with a protocol selected from the module pinout. The LF DT125R module is best suited for applications in Access Control, Time and Attendance, Asset Management, Handheld Readers, Immobilizers, and other RFID enabled applications.The AUTOMATIC DATA COLLECTION Technology used in th RFID reader. Features Selectable UART or Wigand26. Plug-and-Play, needs +5V to become a reader. No repeat reads. LED/Beeper indicates tag reading operation. Excellent read performance without an external circuit. Compact size and cost-effective very efficient module for portable readers. Data Transmission is in ASCII Standard. Data read from the tag is Manchester encoded. The Manchester encoded data is decoded to ASCII standard. Decoded data is sent to the UART serial interface for wired communication with the host systems. ASCII data format is shown below:

2.2.2 Power supply


Department of Electronics

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Block diagram of Power Supply

TRANSFORMER

BRIDGE RECTIFIER FILTER

TRANSFORMER
Regulated output VOLTAGE REGULATOR

Figuer 2.2 Block diagram of power supply Almost all electronic devices used in electronic circuits need a dc source of power supply to operate .The source of dc power is used to establish the dc operating points for the passive and active electronic devices incorporated in the system. The combination of a transformer, a rectifier, and a filter constitutes an ordinary dc supply, also called an unregulated power supply. For many applications in electronics unregulated power supply is not good because of the following reasons. Poor regulation. Variations in the ac supply main. Variations in temperature.

(1) Transformer Transformers are devices which are designed to transfer electrical energy from one electrical circuit to another. They do so utilizing the principle of electromagnetic induction. In addition to performing such energy transfer they are also capable of delivering a different value of ac current or voltage at their output terminals than the value applied to other input terminal. Transformer can provide isolation. In this circuit step down transformer is used.
Department of Electronics

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

(2) Bridge rectifier In the bridge circuit 4 diodes are connected I the form of a Wheatstone bridge. When the upper end of the transformer secondary winding is positive, say during first half cycle of the input supply, diodes D1 and D3 are forward biased and current flows through the arm AB, enters the load at positive terminal leaves the load at negative terminal. During the negative half cycle, the diodes D2 and D4 are forward biased so the current is not allowed to flow in arms AD and BC. In both cases the direction of flow of current through load resistance is same. (3) Voltage Regulator (7805) Fixed three-terminal linear regulators are commonly available to generate fixed voltage of plus 3V, and plus or minus 5V, 9V, 12V or 15V when the load is less than about 7 amperes. The 78 series (7805, 7812, etc) regulate positive voltages. Often, the last two digits of the device numbers are the output voltages, e.g. a 7805 is a +5V regulator. These regulators eliminate the distribution problems associated with single point regulation.

Figure 2.3 Power supply circuit

2.2.3 MICROCONTROLLER AT89C52


Department of Electronics

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

It has 8K Bytes of In-System Programmable (ISP) Flash Memory. It has an endurance of 1000 write and erase cycles. It has a 256 x 8-bit Internal RAM. It is having 32 programmable I/O lines. There are three 16bit Timers or Counters. There are eight interrupt sources. It consists of a full duplex UART serial channel. The 8KB internal flash type ROM is used for storing user program. It has low-power Idle and Power-down modes. The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmels highdensity nonvolatile memory technology and is compatible with the industry-standard 80C51 and 80C52 instruction set and pinout. The onchip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C52 is a powerful microcomputer which provides a highly-flexible and costeffective solution to many embedded control applications. The AT89C52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, 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 AT89C52 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.

Department of Electronics

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

ARCHITECTURE OF AT89C52

Figure 2.4 89C52 Architecture The Accumulator

The Accumulator, as its name suggests, is used as a general register to accumulate the results of a large number of instructions. It can hold an
Department of Electronics

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

8-bit (1-byte) value and is the most versatile register the 8052 has due to the sheer number of instructions that make use of the accumulator.
The "R" registers

The "R" registers are a set of eight registers that are named R0, R1, etc. up to and including R7. The "R" registers as very important auxiliary, or "helper", registers. The Accumulator alone would not be very useful if it were not for these "R" registers. The "R" registers are also used to temporarily store values.
The "B" Register

The "B" register is very similar to the Accumulator in the sense that it may hold an 8-bit (1-byte) value. The "B" register is only used by two 8052 instructions: MUL AB and DIV AB. Thus, if you want to quickly and easily multiply or divide A by another number, you may store the other number in "B" and make use of these two instructions. Aside from the MUL and DIV instructions, the "B" register is often used as yet another temporary storage register much like a ninth "R" register.
Dual Data Pointer Registers

To facilitate accessing both internal and external data memory, two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user should always initialize the DPS bit to the appropriate value before accessing the respective Data Pointer Register.

Department of Electronics

10

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

The Program Counter (PC) The Program Counter (PC) is a 2-byte address which tells the 8052 where the next instruction to execute is found in memory. When the 8052 is initialized PC always starts at 0000h and is incremented each time an instruction is executed. It is also interesting to note that while you may change the value of PC (by executing a jump instruction, etc.) there is no way to read the value of PC. The Stack Pointer (SP) The Stack Pointer, like all registers except DPTR and PC, may hold an 8-bit value. The Stack Pointer is used to indicate where the next value to be removed from the stack should be taken from. This order of operation is important. When the 8052 is initialized SP will be initialized to 07h. If you immediately push a value onto the stack, the value will be stored in Internal RAM address 08h. SP is modified directly by the 8052 by six instructions: PUSH, POP, ACALL, LCALL, RET, and RETI. SFRs A map of the on-chip memory area is called the Special Function Register (SFR) space. Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect. User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0.
Department of Electronics

11

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

PSW Register (Program Status Word) This is one of the most important SFRs. The Program Status Word (PSW) contains several status bits that reflect the current state of the CPU. This register contains: Carry bit, Auxiliary Carry, two register bank select bits, Overflow flag, parity bit, and user-definable status flag. The ALU automatically changes some of registers bits, which is usually used in regulation of the program performing. Program Memory Code memory is the memory that holds the actual 8052 program that is to be run. In 89S52 the internal code memory is a Flash memory. Internal code memory is limited to 8K. Code may also be stored completely off-chip in an external ROM or, more commonly, an external EPROM. Flash RAM is also another popular method of storing a program. The microcontroller handle external memory depends on the pin EA logic state: EA=0. In this case, internal program memory is completely ignored, only a program stored in external memory is to be executed. EA=1 In this case, a program from built in FLASH is to be executed first (to the last location). Afterwards, the execution is continued by reading additional memory. In both cases, P0 and P2 are not available to the user because they are used for data and address transmission. Besides, the pins ALE and PSEN are used too. Data Memory (RAM) The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function
Department of Electronics

12

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

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. Instructions that use indirect addressing access the upper 128 bytes of RAM. Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space. Counters and Timers The 8052 microcontrollers have 3 timers/counters called T0, T1 and T2. As their names tell, their main purpose is to measure time and count external events. Besides, they can be used for generating clock pulses used in serial communication, i.e. Baud Rate. UART (Universal Asynchronous Receiver and Transmitter) The UART in the AT89S52 operates the same way as the UART in the AT89C51 and AT89C52. Also known as a serial port. It is a duplex port, which means that it can transmit and receive data simultaneously. P0, P1, P2, P3 - Input/output ports 4 ports within a total of 32 input-output lines are available to the user for connection to peripheral environment T2CON Timer/Counter 2 Control Register

Department of Electronics

13

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

TF2- Timer 2 overflow flag set by a Timer 2 overflow and must be cleared by software. TF2 will not be set when either RCLK = 1 or TCLK = 1. EXF2- Timer 2 external flag set when either a capture or reload is caused by a negative transition on T2EX and EXEN2 = 1. When Timer 2 interrupt is enabled, EXF2 = 1 will cause the CPU to vector to the Timer 2 interrupt routine. EXF2 must be cleared by software. EXF2 does not cause an interrupt in up/down counter mode (DCEN = 1). RCLK- Receive clock enable. When set, causes the serial port to use Timer 2 overflow pulses for its receive clock in serial port modes 1 and 3. RCLK = 0 causes Timer 1 overflow to be used for the receive clock. TCLK- Transmit clock enable. When set, causes the serial port to use Timer 2 overflow pulses for its transmit clock in serial port modes 1 and 3. TCLK = 0 causes Timer 1 overflows to be used for the transmit clock. EXEN2- Timer 2 external enable. When set, allows a capture or reload to occur as a result of a negative transition on T2EX if Timer 2 is not being used to clock the serial port. EXEN2 = 0 causes Timer 2 to ignore events at T2EX. TR2- Start/Stop control for Timer 2. TR2 = 1 starts the timer. C/T2- Timer or counter select for Timer 2. C/T2 = 0 for timer function. C/T2 = 1 for external event counter (falling edge triggered). CP/RL2- Capture/Reload select. CP/RL2 = 1 causes captures to occur on negative transitions at T2EX if EXEN2 = 1. CP/RL2 = 0, causes automatic reloads to occur when Timer 2 overflows or negative transitions occur at T2EX when EXEN2 = 1. IE (Interrupt Enable Register)

Department of Electronics

14

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

EA - Disables all interrupts. If EA = 0, no interrupt is acknowledged. If EA = 1, each interrupt source is individually enabled or disabled by setting or clearing its enable bit. ET2 - Timer 2 interrupt enable bit. ES - Serial Port interrupt enable bit. ET1 - Timer 1 interrupt enable bit. EX1 - External interrupt 1 enable bit. ET0 -Timer 0 interrupt enable bit. EX0 - External interrupt 0 enable bit. WATCH DOG TIMER 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 overflows, it will drive an output RESET HIGH pulse at the RST pin. 2.2.4 REAL TIME CLOCK (DS12887) It is totally nonvolatile with over 10 years of operation in the absence of power. It has a self-contained subsystem that includes lithium,
Department of Electronics

15

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

quartz, and support circuitry. It counts seconds, minutes, hours, day of the week, date, month, and year with leap year compensation valid up to 2100. It also has binary or BCD representation of time, calendar, and alarm. It has 12 or 24 hour clock with AM and PM in 12 hour mode. Daylight savings time option is also present in it. It is interfaced with software as 128 RAM locations, ie.15 bytes of clock and control registers, and 113 bytes of general purpose RAM. 2.2.5 EEPROM
The EEPROM used is 24C08. The memory is internally organized as 1024 x 8 (8K). It has a 2-wire serial interface. It is guided on the basis of Bi-directional Data Transfer Protocol. There is a write protect pin for hardware data protection. It has 16byte page write modes. It is highly reliable. Endurance is 1 Million Write Cycles. Data retention is 100 years. There is 3 address inputs A0-A2. The Write Protect (WP) pin allows normal read/write operations when connected to ground (GND). When the Write Protect pin is connected to VCC, the write protection feature is enabled. SCL is the serial clock input. SDA is the serial data.

Figure 2.5 Pin diagram of EEPROM

2.2.6 LCD MODULE

Department of Electronics

16

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Figure 2.6 LCD Display In recent years the LCD is finding widespread use replacing LEDs. This is due to the following reasons: The declining price of the LCDs. The ability to display numbers, characters and graphics. This is in contrast to LEDs, limited to displaying only numbers to few characters. Features + 5V power supply (Also available for + 3V) 1/16 duty cycle To be driven by pin 1, pin 2 or pin 15, pin 16

LCD pin descriptions These are the 16 pins and they are given below along with their basic functions and symbols used to represent them. PIN NUM BER 1 2 3 4 5 6 7 8 9
Department of Electronics

SYMBOL

FUNCTION

Vss Vdd Vo RS R/W E DB0 DB1 DB2


17

GND + 3Vor + 5V Contrast Adjustment H/L Register Select Signal H/L Read/Write Signal H ->L Enable Signal H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line
Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

10 11 12 13 14 15 16

DB3 DB4 DB5 DB6 DB7 A/Vee

H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line H/L Data Bus Line + 4.2V for LED/Negative Voltage Output

K Power Supply for B/L (OV) Table 2.1 Lcd pin discription

Vcc, Vss, Vee The Vcc or Vdd pin is used to provide supply of +5V, Vss is the ground pin and the Vee or Vo is used for controlling LCD contrast. RS, Register Select There are 2 very important types of register inside the LCD. The RS pin is used for their selection as follows. If RS=0, the command code register is selected. If RS=1, the data register is selected, allowing user to send data to be displayed on the LCD. R/W, Read/Write R/W input allows the user to write the information to the LCD or read information from it. If this pin is set high then read will be selected, else if zero implies write. E, Enable This pin is used by the LCD to latch information presented to its data pins. When data is supplies to data pins, a high to low pulse must be applied to this pin in order for the LCD to latch in the data present in the data pins. This pulse must be a minimum of 450ns wide. DO - D7, Data lines The 8-bit data pins, DO - D7, are used to send information to the LCD or read the contents of the LCD's internal registers. To display letters and numbers, we send ASCII codes for the letters A - Z, a - z, and numbers 0 - 9 to these pins while making RS = 1. There are also instruction command codes that can be sent to the LCD to clear the display or force the cursor to the home position or blink the cursor. We also use RS = 0 to check the busy flag bit to see if the LCD is ready to receive information The busy flag is D7 and can be read when R/W = 1 and RS = 0, as follows: if R/W = 1,RS =

Department of Electronics

18

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

O. When D7 = 1 (busy flag = 1 ) , the LCD is busy taking care of internal operations and will not accept any new information.

2.2.7 MAX 232


It meets or Exceeds TIA/EIA-232-F and ITU. It operates from a single 5-V power supply with 1.0F Charge-Pump Capacitors. It can operate up to 120 kbit/s. It has two drivers and two receivers and 30-V input levels. It works at low supply current 8 mA typical. ESD Protection Exceeds JESD 22. 2000-V Human-Body Model A114A. Upgrade with improved ESD (15-kV HBM) and 0.1F Charge-Pump capacitor is available with the MAX202.

2.2.8 KEYPAD ENCODER


The MM74C922 and MM74C923 CMOS key encoders provide all the necessary logic to fully encode an array of SPST switches. The keyboard scan can be implemented by either an external clock or external capacitor. These encoders also have on-chip pull-up devices which permit switches with up to 50 kW on resistance to be used. No diodes in the switch array are needed to eliminate ghost switches. The internal debounce circuit needs only a single external capacitor and can be defeated by omitting the capacitor. The Data available output returns to a low level when the entered key is released, even if another key is depressed. The Data available will return high to indicate acceptance of the new key after a normal debounce period; this twokey roll-over is provided between any two switches. An internal register remembers the last key pressed even after the key is released. The 3-STATE outputs provide for easy expansion and bus operation and are LPTTL compatible.

Department of Electronics

19

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Figure 2.7 74C922 Encoder Features 50 kW maximum switch on resistance On or off chip clock On-chip row pull-up devices Keybounce elimination with single capacitor Last key register at outputs

Department of Electronics

20

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

CHAPTER 3 CIRCUIT DIAGRAM


3.1 Circuit Diagram

Figure 3.1 Circuit diagram

Department of Electronics

21

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

3.2 Working
Microcontroller reads time from real time chip DS12887. Whenever a RFID tag is brought near RFID module, it sends the card number in ASCII fomat to the microcontroller. The microcontroller compares this number with those numbers in the EEPROM. If match is found, it first check whether it is a master card, then it displays menu for master card. If not, it displays the ID number and then sends the time and date details along with ID number to EEPROM for marking daily attendance. If no matches found, the microcontroller displays Card Not Programmed in LCD. Master card menu consists of set time, add, edit, delete, transfer. The various options are selected using the keypad keys- up, down, enter, cancel. Keypad encoder converts the key pressed into corresponding hex file. The output from RFID is given as the serial input. The card ID number is 8 bytes long and two extra bytes serve as start and stop bits. Set time: It is used to edit the time of RTC. The time is entered using the keypad. Add: It is used to add a new tag and store the new tag number and ID number to EEPROM. Edit: It is used to edit the card ID number. The new ID number is entered through keypad. Delete: It is used to delete a card from record. Transfer: This option is used to transfer the marked attendance stored in EEPROM to the computer. MAX232 is used to convert the TTL voltage to RS232 compatible voltage. Real time clock is used to provide the date, month, and year details for marking the attendance.

Department of Electronics

22

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

CHAPTER 4 PROGRAM FLOW CHART

Department of Electronics

23

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Department of Electronics

24

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Department of Electronics

25

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

CHAPTER 5 PROGRAM

#include<reg52.h> #include<aBsacc.h> //----------------------- PORT DECLARATION ---------------------------------------------------// sfr ldata = 0xA0; sbit RS = P1^4; sbit EN = P1^5; sbit sda = P3^5; sbit sclk = P3^4; sbit IN = P1^6; //---------------------------------- GLOBAL VARIABLES ----------------------------------------------------// unsigned char hr,min,sec,day,mnt,yr; unsigned char code1,laddr,l2addr,addr,data1[8]; unsigned char nadd=0,nedit=0,ndel=0,w,r,choice=0; unsigned char dwaddr[]={0xA0,0XA2,0XA4,0XA6},draddr[]={0XA1,0XA3,0XA5,0XA7}; //---------------------------------- DISPLAY MESSAGES ----------------------------------------------------// code unsigned char msg0[]={"ATTENDANCE-SYSTEM"}; code unsigned char msg1[]={"CARD NOT-PROGRAMMED"}; code unsigned char msg2[]={"DETECTED CARD-NO"}; code unsigned char msg3[]={"MASTER CARD- MENU"}; code unsigned char *msg4[]={"SET TIME"," ADD","EDIT","DELETE","TRANSFER"}; code unsigned char msg5[]={"SHOW CARD-TO DELETE"}; code unsigned char msg6[]={"ENTER HOUR -0~24"}; code unsigned char msg7[]={"ENTER MINUTES -'00~59'"}; code unsigned char msg8[]={"ENTER DAY -'01~31'"}; code unsigned char msg9[]={"ENTER MONTH -'01~12'"}; code unsigned char msg10[]={"ENTER YEAR -'00~99'"}; code unsigned char msg11[]={"SHOW CARD-TO ADD"}; code unsigned char msg12[]={"SHOW CARD-TO EDIT"}; code unsigned char msg13[]={"ENTER THE- ID NO"}; code unsigned char msg14[]={"CARD ADDED"}; code unsigned char msg15[]={"CARD EDITED"}; code unsigned char msg16[]={"RECORD -MEMORY FULL"};
Department of Electronics

26

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

code unsigned char msg17[]={"SENDING DATA.."}; code unsigned char msg18[]={"DELETE DATA?"}; code unsigned char msg19[]={"DATA DELETED"}; //------------------------------------ FUNCTION PROTOTYPE -------------------------------------------------// void msdelay(unsigned int); void lcdcmd( unsigned char); void lcddata( unsigned char); void lcdinit(); void display(unsigned char []); void bcdascii(unsigned char); void hexascii(unsigned char); unsigned char hexbcd(unsigned char); void nop(void); unsigned char checkcard(); void prog(); void senddetails(); void settime(); unsigned char input(unsigned char); void added(); void edited(); void sendcode(unsigned char); void sendadd(unsigned char); void start_s_eeprom(); void send_byte_s_eeprom(unsigned char); unsigned char get_byte_s_eeprom(); void stop_s_eeprom(); void send_to_mem(unsigned char, unsigned char); unsigned char get_from_mem(unsigned char); void transmit(); void serial(unsigned char); void del();

//----------------------------------- SERIAL INTERRUPT ----------------------------------------------// void serialintr() interrupt 4 { unsigned char num,j; static int l=0; if(TI ==1) T1=0; else { num=SBUF;
Department of Electronics

27

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

if(num!=0x0D && num!=0x0A) { data1[l]=num; l++; } else if(num==0x0D) if(l==8) { if(nadd==1) added(); else { j=checkcard(); if(j==0) display(msg1); else if(j==1) { if(nedit==1) edited(); else if(ndel==1) del(); else { senddetails(); display(msg2); hexascii(code1); } } else prog(); } l=0; lcdcmd(0x01); } RI=0; } } //-------------------------------------Main Program------------------------------------------------------void main() { msdelay(80); TH1= -3; TMOD=0x20; SCON=0x50; TR1=1;
Department of Electronics

28

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

IE=0x90; lcdinit(); w=0; r=0; laddr=get_from_mem(0xFD); msdelay(4); w=get_from_mem(0xFE); msdelay(4); l2addr=get_from_mem(0XFF); msdelay(4); r=1; display(msg0); lcdcmd(0x01); while(1) { hr=XBYTE[4]; bcdascii(hr); lcddata(':'); min=XBYTE[2]; bcdascii(min); lcddata(':'); sec=XBYTE[0]; bcdascii(sec); lcdcmd(0xC0); day=XBYTE[7]; bcdascii(day); lcddata('-'); mnt=XBYTE[8]; bcdascii(mnt); lcddata('-'); yr=XBYTE[9]; lcddata('2'); lcddata('0'); bcdascii(yr); lcdcmd(0x80); } } //-----------------------------Function Definition------------------------------------------------void msdelay(unsigned int td) { unsigned int i,j; for(i=0; i<td; i++) for(j=0; j<1275; j++); } void lcdcmd( unsigned char value)
Department of Electronics

29

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

{ ldata=value; RS=0; EN=1; msdelay(1); EN=0; msdelay(60); } void lcddata( unsigned char value) { ldata=value; RS=1; EN=1; msdelay(1); EN=0; msdelay(60); } void lcdinit() { lcdcmd(0x38); lcdcmd(0x0E); lcdcmd(0x01); lcdcmd(0x06); lcdcmd(0x80); } void display(unsigned char msg[]) { short int i=0; lcdcmd(0x01); lcdcmd(0x80); while(msg[i]!='\0') { if(msg[i]=='-') lcdcmd(0xC0); else lcddata(msg[i]); i++; } } void bcdascii(unsigned char num) { unsigned char x,y; x=num&0x0F;
Department of Electronics

30

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

x=x|0x30; y=num&0xF0; y=y>>4; y=y|0x30; if(choice==0) { lcddata(y); lcddata(x); } else { serial(y); serial(x); } } void hexascii(unsigned char val) { unsigned char x,y,z; x=val/100; val=val%100; y=val/10; z=val%10; x=x|0x30; y=y|0x30; z=z|0x30; if(choice==0) { lcddata(x); lcddata(y); lcddata(z); } else { serial(x); serial(y); serial(z); } } unsigned char hexbcd(unsigned char num) { unsigned char n[2]; n[1]=num/10; n[0]=num%10; n[1]=n[1]<<4; num=n[1] | n[0];
Department of Electronics

31

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

return num; } void nop(void) { } unsigned char checkcard() { unsigned char a=0,data2[8],flag=0,taddr,temp1,temp2; unsigned char i,j; temp1=w; temp2=r; w=0; r=0; for(addr=0x00;addr<=laddr;) { flag=0; taddr=addr; for(i=0;i<9;i++) { if(i!=8) data2[i]=get_from_mem(taddr++); else code1=get_from_mem(taddr++); } for(j=0;j<8;j++) if(data1[j]!=data2[j]) flag=1; if(flag==0) { if(addr==0x00) a=2; else a=1; break; } else addr=taddr; } w=temp1; r=temp2; return a; } unsigned char input(unsigned char c) { unsigned char count=1,n1,num=0,c1[]={1,10,100};
Department of Electronics

32

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

while(count<=c) { while(IN==0); while(IN==1); n1=P1; n1=n1&0x0F; if(c==1) break; else if(n1<0x0A) { if(count==1) { num=n1*c1[(c-1)]; count++; } else if(count==2) { num=num+n1*c1[(c-2)]; count++; } else { num=num+n1; count++; } } } if(c==1) return n1; else return num; }

void prog() { unsigned char k=0,inp; display(msg3); display(msg4[k]); do { display(msg4[k]); inp=input(1); if(inp==0x0C) { if(k==0)
Department of Electronics

33

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

k=4; else k--; } else if(inp==0x0D) { k++; if(k>4) k=0; } else if(inp==0x0F) break; else if(inp==0x0E) { switch(k) { case 0: settime(); break; case 1: display(msg11); nadd=1; break; case 2: display(msg12); nedit=1; break; case 3: display(msg5); ndel=1; break; case 4: display(msg17); transmit(); break; } break; } }while(inp!=0x0F); } void settime() { msdelay(80); XBYTE[10]=0x20; XBYTE[11]=0x83; display(msg6); hr=input(2); hr=hexbcd(hr); display(msg7); min=input(2); min=hexbcd(min);
Department of Electronics

34

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

display(msg8); day=input(2); day=hexbcd(day); display(msg9); mnt=input(2); mnt=hexbcd(mnt); display(msg10); yr=input(2); yr=hexbcd(yr); XBYTE[0]=0x00; XBYTE[2]=min; XBYTE[4]=hr; XBYTE[7]=day; XBYTE[8]=mnt; XBYTE[9]=yr; XBYTE[11]=0x03; } void added() { unsigned char i=0,k,taddr; taddr=laddr; display(msg13); k=input(3); display("Adding"); for(i=0;i<8;i++) { send_to_mem(taddr+i,data1[i]); stop_s_eeprom(); msdelay(4); } send_to_mem(taddr+8,k); stop_s_eeprom(); msdelay(4); display(msg14); laddr=laddr+0x09; send_to_mem(0xFD,laddr); stop_s_eeprom(); msdelay(4); nadd=0; } void edited() { unsigned char k,caddr; display(msg13); k=input(3); caddr=addr+0x08;
Department of Electronics

// page write

35

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

display("Editing"); send_to_mem(caddr,k); stop_s_eeprom(); msdelay(4); display(msg15); nedit=0; }

void del() { unsigned char i=0,taddr; taddr=addr; send_to_mem(taddr,0xFF); for(i=1;i<7;i++) send_byte_s_eeprom(0xFF); stop_s_eeprom(); msdelay(4); send_to_mem(taddr+7,0xFF); send_byte_s_eeprom(0xFF); stop_s_eeprom(); msdelay(4); display(msg19); ndel=0; } void senddetails() { if(w<4) { start_s_eeprom(); send_byte_s_eeprom(dwaddr[w]); send_byte_s_eeprom(l2addr); send_byte_s_eeprom(code1); send_byte_s_eeprom(hr); send_byte_s_eeprom(min); send_byte_s_eeprom(day); send_byte_s_eeprom(mnt); send_byte_s_eeprom(yr); stop_s_eeprom(); msdelay(4); l2addr+=7; if(l2addr==0xFC) { w+=1; if(w==4) l2addr=0xFC;
Department of Electronics

// page write

36

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

else l2addr=0x00; } send_to_mem(0xFE,w); stop_s_eeprom(); msdelay(4); send_to_mem(0xFF,l2addr); stop_s_eeprom(); msdelay(4); } else display(msg16); } void transmit() { unsigned char i,num,temp,addr2=0x00; choice=1; temp=w; if(temp==4) temp--; w=1; r=1; do { serial('@'); for(i=0;i<7;i++) { num=get_from_mem(addr2++); if(i==0) hexascii(num); else bcdascii(num); } serial('#'); msdelay(4); if(w==temp) if(addr2>=l2addr) break; if(addr2==0xFC) { w+=1; r+=1; addr2=0x00; } }while(w<=temp);
Department of Electronics

37

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

choice=0; display(msg18); if(input(1)==0x0E) { l2addr=0x00; w=1; r=1; display(msg19); } } void serial(unsigned char n) { SBUF=n; while(TI==0); TI=0; } void send_to_mem(unsigned char s_address,unsigned char s_data) { start_s_eeprom(); send_byte_s_eeprom(0XA0); send_byte_s_eeprom(s_address); send_byte_s_eeprom(s_data); // stop_s_eeprom(); } unsigned char get_from_mem(unsigned char s_address) { unsigned char i = 0; //-------dummy write seq----+ word address-----------------------------------start_s_eeprom(); send_byte_s_eeprom(dwaddr[w]); send_byte_s_eeprom(s_address); //----------------dummy over---------------------------------------------------start_s_eeprom(); send_byte_s_eeprom(draddr[r]); i = get_byte_s_eeprom(); stop_s_eeprom(); return(i); } void send_byte_s_eeprom(unsigned char s_byte) { unsigned char temp = s_byte;
Department of Electronics

38

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

unsigned char i,j; for(i = 8 ; i > 0 ; i--) { j=i-1; temp = s_byte; temp = temp >> j; temp = temp & 0X01; if(temp == 0) sda = 0; else sda = 1; sclk = 1; nop(); nop(); nop(); sclk = 0; } sda = 1; nop(); sclk = 1; nop(); nop(); nop(); sclk = 0; } unsigned char get_byte_s_eeprom() { unsigned char temp, temp_h, i,j; temp = 0; temp_h = 1; sda = 1; for(i = 8; i >0 ; i--) { j=i-1; sclk =0; nop(); nop(); nop(); nop(); sclk = 1; if(sda == 1) temp = temp | temp_h<<j ; }
Department of Electronics

39

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

sclk = 0; return(temp); } void start_s_eeprom() { sda = 1; sclk = 1; nop(); nop(); nop(); sda = 0; nop(); nop(); nop(); sclk = 0; } void stop_s_eeprom() { sda = 0; nop(); nop(); nop(); sclk nop(); nop(); nop(); sda = 1; } = 1;

Department of Electronics

40

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

FABRICATION OF PCB
Making a Printed Circuit Board is the first step towards building electronic equipment by any electronic industry. We should keep in mind that quality of soldering affects the quality of the output. The procedure for fabricating the PCB for setting up the circuit of any multipurpose project is described below. PCB Making: The making of PCB is as much as art on a technique particularly so when they are to fabricated in very small numbers. There are several ways of drawing PCB patterns and making the final boards. The making of PCB essentially involves two steps: 1. Preparing PCB drawing 2. Fabricating PCB from the drawing The traditional method of drawing with complete placement of parts, taking a photographic negative of the drawing, developing the image of the negative formed on photo sensitized copper plate and dissolving the excess copper by etching is a standard practice being followed by large scale operations. However for small-scale operations, where large numbers of copies are not required, the cost saving method presented here may be adopted. PCB Drawing: Making of PCB drawing involves placement of components, locating holes, optimum area each component should occupy shape and size of pads for the components, track size and spacing and prevention of overcrowding of components at a particular area. With these details the sketch of the PCB is made. For anchoring leads of component 1mm diameter holes and for fixing PCB holding screws to the 3mm holes diameter can be made. Following these hints, a sketch of PCB is made. PCB Fabrication:
Department of Electronics

41

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

The fabrication of the PCB starts by transferring the PCB drawing onto a copper clad sheet. For a small number of PCB, a direct photographic transfer of the PCB drawing from a negative image of the drawing to a photo sensitized 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 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 helps in speedy etching. The dissolution of unwanted copper would take about 45min. If etching takes longer, the solution may be heated again and the 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 of 0.9mm, 1mm, 3mm etc for the leads and mounting holes.

Department of Electronics

42

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

CHAPTER 6 MERITS AND DEMERITS

Advantages

Unauthorized attendance can be avoided. Easy to verify the attendances over a long period of time. Promiscuity of tags. Non-contact and non-line-of-sight. Space consumption can be reduced to a greater extent. No need to connect this system to a P.C always.

Disadvantages
Identity theft. System affected by metal interference. Very little power available to digital portion of the IC, limited functionality. Lack of standards and protocols

Department of Electronics

43

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

CHAPTER 7 FUTURE ENHANCEMENT


Protocols may be rolled out which make tags obstinate to power interruption and fault induction. Power loss graceful recovery of tags can be implemented. Research works could be conducted on smart cards and other embedded systems. Many multitudes of labour can be done associating low cost hardware . Improved memory storage can make it possible to mark the attendances of a large group of people, without connecting to the system. By using active tags or using high frequency RFID readers, the range can be increased.

Department of Electronics

44

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Department of Electronics

45

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

APPENDIX

Department of Electronics

46

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

AT89C52
Features
Compatible with MCS-51 Products 8K Bytes of In-System Reprogrammable Flash Memory Endurance: 1,000 Write/Erase Cycles Fully Static Operation: 0 Hz to 24 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 Programmable Serial Channel Low-power Idle and Power-down Modes

Description
The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 and 80C52 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer.

Department of Electronics

47

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Absolute Maximum Ratings


Operating Temperature.......................................... -55C to +125C Storage Temperature ............................................. -65C to +150C Voltage on Any Pin with Respect to Ground .........-1.0V to +7.0V Maximum Operating Voltage .................................. 6.6V DC Output Current................................................... 15.0 mA
DC CHARACTERISTICS

Department of Electronics

48

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

External Program and Data Memory Characteristics

74C922- 16 KEY ENCODER


These CMOS key encoders provide all the necessary logic to fully encode an array of SPST switches. The keyboard scan can be implemented by either an external clock or external capacitor. These encoders also have on-chip pullup devices which permit switches with up to 50 kX on resistance to be used. No diodes in the switch array are needed to eliminate ghost switches. The internal debounce circuit needs only a single external capacitor and can be defeated by omitting the capacitor. A Data Available output goes to a high level when a valid keyboard entry has been made. The Data Available output returns to a low level when the entered key is released, even if another key is depressed. The Data Available will return high to indicate acceptance of the new key after a normal debounce period; this two-key rollover
Department of Electronics

49

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

is provided between any two switches. An internal register remembers the last key pressed even after the key is released. The TRI-STATE outputs provide for easy expansion and bus operation and are LPTTL compatible.
Features

50 kX maximum switch on resistance On or off chip clock On-chip row pull-up devices 2 key roll-over Keybounce elimination with single capacitor Last key register at outputs TRI-STATE outpust LPTTL compatible Wide supply range 3V to 15V Low power consumption

Department of Electronics

50

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

DC Electrical characteristics

Department of Electronics

51

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Department of Electronics

52

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

EEPROM 24C08
Features Low-voltage and Standard-voltage Operation

2.7 (VCC = 2.7V to 5.5V) 1.8 (VCC = 1.8V to 5.5V) Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K), 1024 x 8 (8K ) or 2048 x 8 (16K) 2-wire Serial Interface Schmitt Trigger, Filtered Inputs for Noise Suppression Bi-directional Data Transfer Protocol 100 kHz (1.8V) and 400 kHz (2.5V, 2.7V, 5V) Compatibility Write Protect Pin for Hardware Data Protection 8-byte Page (1K, 2K), 16-byte Page (4K, 8K, 16K) Write Modes Partial Page Writes are Allowed Self-timed Write Cycle (5 ms max) High-reliability Endurance: 1 Million Write Cycles Data Retention: 100 Years Automotive Grade, Extended Temperature and Lead-free/Halogen-free Devices Available
8-lead PDIP, 8-lead JEDEC SOIC, 8-lead MAP, 5-lead SOT23, 8-lead TSSOP and 8-ball dBGA2 Packages Absolute Maximum Ratings Operating Temperature...................................... -55 C to +125C Storage Temperature ......................................... -65 C to +150C Voltage on Any Pin with Respect to Ground ...-1.0V to +7.0V Maximum Operating Voltage ............................ 6.25V DC Output Current............................................. 5.0 mA

Department of Electronics

53

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Real time clock DS12887


FEATURES

Drop-in replacement for IBM AT computer clock/calendar Pin compatible with the MC146818B and DS1287 Totally nonvolatile with over 10 years of operation in the absence of power Self-contained subsystem includes lithium, quartz, and support circuitry.
Department of Electronics

54

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Counts seconds, minutes, hours, days, day of the week, date, month, and year with leap year compensation valid up to 2100 Binary or BCD representation of time, calendar, and alarm 12 or 24hour clock with AM and PM in 12hour mode Daylight Savings Time option Selectable between Motorola and Intel bus timing Multiplex bus for pin efficiency Interfaced with software as 128 RAM locations 15 bytes of clock and control registers 113 bytes of general purpose RAM Programmable square wave output signal Buscompatible interrupt signals (IRQ) Three interrupts are separately software maskable and testable Timeofday alarm once/second to once/day Periodic rates from 122 ms to 500 ms End of clock update cycle Century register

Department of Electronics

55

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Department of Electronics

56

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

RFID READER

Features

Selectable UART or Wigand26


Department of Electronics

57

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Plug-and-Play, needs +5V to become a reader No repeat reads LED/Beeper indicates tag reading operation Excellent read performance without an external circuit Compact size and cost-effective A very efficient module for portable readers.

Pin description

Department of Electronics

58

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Applications of LF DT125R Series

Applications of the RFID OEM LF DT125R Reader Module are limited by the imagination of the designer because of the compact form factor and low power consumption. Some of the common applications for this module are: Access control Handheld readers Asset management Time and Attendance Immobilizers

LCD DISPLAY
Absolute Maximum Ratings

Department of Electronics

59

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

Electrical Characteristics

PIN Description

Department of Electronics

60

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

CHAPTER 8 CONCLUSION

The project RFID based attendance system has been completed and working has been observed. RFID tag shown over the reader identifies the person and the code can be entered by the use of keypad. The ID number and related details are sent to the computer . RFID module comprising of a RFID Reader and a RF Tag avails an easy implementation option and is a far less tedious bid. It is a simple method and is reliable. Saving attendance in a computer allows easy verification and longer record keeping.

Department of Electronics

61

Govt.Polytechnic

College,Nattakom

Project 2011 Based Attendance System

RFID

REFERENCES

1. The 8051 Microcontroller and Embedded Systems (Second

Edition) by

Muhhammad Ali Mazidi, Janice Gillispie Mazidi, Rolin D McKinlay 2. Electric and Electronics Measurement and Instrumentation (Fourth edition), A.K.Sawhney 3. Kenneth J Ayala, The 8051 Microcontroller, Pearson Education. 4. Muhammad Ali Mazzidi, The 8051 Microcontroller Architecture, programming and applications, J.B. Gupta , Electronic Devices And Circuits
5. www.dallas.com 6. www.cornell.com 7. www.electronics4u.com 8. www.datasheet4u.com

Department of Electronics

62

Govt.Polytechnic

College,Nattakom

S-ar putea să vă placă și