RFID BASED SMART OFFICE

FYP-07-019

ARSHIAN AHMED ABDUS SAMAD QURAISHI ZEESHAN SATTAR ZAYEEM BIN ALAM

K040057 K040044 K040066 K040102

INTERNAL ADVISOR DR. ZUBAIR A. SHAIKH EXTERNAL ADVISOR ENGR. ABU ZAFAR ABBASI

NATIONAL UNIVERSITY OF COMPUTER AND EMERGING SCIENCES - FAST JUNE 2008

RFID BASED SMART OFFICE

BY

ARSHIAN AHMED ABDUS SAMAD QURAISHI ZEESHAN SATTAR ZAYEEM BIN ALAM

K040057 K040044 K040066 K040102

Report submitted in partial fulfilment of the requirements for the degree of Bachelor of Science in Telecommunication Engineering

DEPARTMENT OF TELECOM AND COMPUTER ENGINEERING NATIONAL UNIVERSITY OF COMPUTER AND EMERGING SCIENCES - FAST JUNE 2008

2

ACKNOWLEDGEMENT

First of all, we are very grateful to Almighty Allah Who gave us opportunity, strength, determination and wisdom to achieve our goal. Without His support this could not have been possible.

We would like to acknowledge and extend our heartfelt gratitude to our internal advisor Dr. Zubair A. Shaikh for his vital encouragement and support. We would also like to thank Mr. Aqeel-ur-Rehman, who not only served as our supervisor but also encouraged and challenged us throughout our project. He patiently guided us through the process, never accepting less than our best efforts.

We are also greatly indebted to our external advisor Mr. Abu Zafar Abbasi for his valuable suggestions and advices. He always was being there for us despite of his busy schedule. His comments and suggestion provided the valuable information necessary to complete the project.

Besides our advisors, we would like to thank our friend Mr. Syed Arsalan Pervaiz (from computer science dept) for his valuable support in our project software. Last, but not the least, we thank our parents for giving us life in the first place, for educating us with aspects from both arts and sciences, for unconditional support and encouragement to pursue our interests and for all the things they have done for us.

Arshian Ahmed Abdus Samad Quraishi Zeeshan Sattar Zayeem Bin Alam JUNE 2008

K040057 K040044 K040066 K040102

ii

3 1.1 2.1 1.9 Introduction Objective RFID history Background 1.2 Project design Methodology 2.2 2.3 2.4 2.TABLE OF CONTENTS Page ACKNOWLEDGEMENT TABLE OF CONTENTS LIST OF TABLES LIST OF FIGURES ABSTRACT ii iii vi vii ix CHAPTER 1: INTRODUCTION 1.8 1.2 1.2 RFID Tags RFID Reader 1 1 2 3 3 3 3 4 4 5 7 Working of RFID Frequencies of RFID Future of RFID Applications Literature review CHAPTER 2: SYSTEM DETAILS 2.1 1.2.4.4.1 2.4     1.2.3 2.7 1.4 RFID reader Transmission Database server Control circuitry 10 10 10 11 11 11 13 16 System flow diagrams Network block diagram iii .5 1.6 1.2.2.

5 5.2 5.6.1 Selection of technologies 3.2.4 Working of software Standard mode Administrator mode 43 43 44 44 45 52 52 System requirements for SAS Serial port terminal iv .1 5.3 5.3 4.1.6 Introduction Components Working Why microcontroller? Control circuit schematic Control circuitry with NVRAM 5.1 Modification in user’s profile 5.4 4.3 6.2 3.2 6.2 Software introduction SAS Main features 6.1 3.2 4.1 6.1 6.5 RFID Reader working Microcontroller working ZigBee working Port switching circuit Dummy node 27 29 31 32 33 CHAPTER 5: SYSTEM HARDWARE: CONTROL CIRCUITRY 5.4 5.7 Control circuit with NVRAM schematic 34 34 34 37 39 40 40 42 CHAPTER 6: SOFTWARE DESIGN 6.1 4.2 Microcontrollers Wireless standards 18 18 21 25 Selection of software tool CHAPTER 4: SYSTEM HARDWARE: READER NODE 4.2.1.CHAPTER 3: SELECTION OF TECHNOLOGIES 3.2.3 6.

CHAPTER 7: COST ANALYSIS CHAPTER 8: FUTURE AND CONCLUSION 55 56 REFERENCES APPENDICES A.2 A.3 Datasheets Assembly code (Reader node) Assembly code (Control circuitry with NVRAM) 58 61 78 84 v .1 A.

LIST OF TABLES Page 3.1 Pin configuration Microcontroller and microprocessor comparison Microcontroller and PLC comparison Cost analysis 24 37 38 55 vi .2 7.1 5.1 5.

3(a) 2.1 4.1 5.2 3.2 6.1 2.5(b) 6.4 6.5(a) 6.3(a) 5.1 3.2 2.3 6.5(c) 6.2 4.9 6.8 6.7 6.5 5.3 4.4(b) 4.6 6.3 4.LIST OF FIGURES Page 2.5 3.1 6.3(b) 5.2 5.4(a) 4.4 2.10 Project block diagram Control circuit block diagram Reader flow diagram Reader flow diagram Control circuit flow diagram Network block diagram AT89c51 ATMEGA8 ZigBee pin configuration Reader node schematic RFID backscatter Tagging 74LS244 connections 74LS244 truth table Dummy node schematic Optocoupler Relay schematic diagram Control circuit schematic (Receiver part) Control circuit schematic (Automation part) Control circuit with NVRAM schematic Snapshot of standard mode Snapshot of file menu Snapshot of administrator mode Snapshot of add profile window Snapshot of operations menu Before adding a new profile After adding a new profile Snapshot of admin mode Snapshot of modify window Snapshot of modify window (after modification) Snapshot of admin mode Snapshot of delete window 10 12 13 14 15 16 19 20 24 27 28 30 32 32 33 35 36 39 40 42 44 45 45 46 46 47 47 48 49 49 50 50 vii .3(b) 2.4 6.

13 Before deleting user profile After deleting user Profile Snapshot of serial port terminal Snapshot of text file records of serial port terminal 51 52 53 54 viii .11(a) 6.12 6.6.11(b) 6.

Passive RFID tags are used for animal tagging. The modules operate within the ISM 2. When the tag is energized by the RF field.4 standards and support the unique needs of low-cost. and a user-interface computer.4 GHz frequency band. It is also designed to automate their offices. Office automation is based on personalized profiles. ix . the system could generate sophisticated staff attendance data for analysis purposes. low-power wireless sensor networks. a reader. Profiles can be edited on the run time without making any changes in the hardware. Every node after transmitting waits for an acknowledgment from the server to make data transfer reliable. access control applications. Based on the verification of staff identification at the entrances. it transmits back the contents of its memory by modulating the incoming RF field. The RFID (radio-frequency identification) system consists of an RFID tag.15.RFID BASED SMART OFFICE ABSTRACT ‘RFID BASED SMART OFFICE’ is designed to collect and manage staff attendance records from RFID devices installed in an enterprise environment. the project uses ZigBee modules. The ZigBee and ZigBee-PRO OEM RF Modules are engineered to meet IEEE 802. The database software is smart enough to mark the attendance if and only if the card holder spent a minimum time required for attendance in office. The modules require minimal power and provide reliable delivery of data between devices. The reader detects and demodulates the signal and identifies the tag. etc. asset tracking. For wireless data transmission and networking between sensor nodes.

1. So the RFID is a wireless identification. filters. the project uses ZigBee modules. Normally the RFID system comprises of two main parts: RFID Reader and RFID Tag. For wireless data transmission and networking between sensor nodes. The project is designed for 256 rooms and it can store upto 512 card IDs but it is easily scalable upto 65000 card IDs but for that it requires external memory. Our project is going to solve these problems by using RFID technology.1 INTRODUCTION The two major problems faced by organizations are time consuming manual attendance and wastage of electrical power. In addition the system also supports the room automation (automatic control of doors and lights). coupler and a micro processor. Radio Frequency Identification (RFID) is an automatic identification method.CHAPTER 1 INTRODUCTION 1. 1 . modulator. “RFID based Smart Office” is a system that uses RFID technology to maintain the attendance at real-time that can be monitored on Database server (PC). The RFID Reader may consist of antenna. demodulator. relying on storing and remotely retrieving data using devices called RFID tags or transponders.2 OBJECTIVE The aim of the project is to design a system that have a small coverage area and can be use for authentication or identification purposes. RFID Reader is an integrated or passive network which is used to interrogate information from RFID tag (contains antennas to enable them to receive and respond to radiofrequency queries from an RFID transceiver).

patient history) [13]. automatic gates. The basic Cardullo patent covers the use of RF. vehicle routing. which modulated the reflected radio frequency. security (personnel identification. The initial device was passive. surveillance) and medical (identification. automatic toll system. The technology used in RFID has been around since the early 1920s according to one source (although the same source states that RFID systems have been around just since the late 1960s). electronic license plate. banking (electronic check book. Sound waves vibrated a diaphragm which slightly altered the shape of the resonator. and was demonstrated in 1971 to the New York Port Authority and other potential users and consisted of a transponder with 16 bit memory for use as a toll device. a passive radio transponder with memory.Chapter 1 1. electronic credit card). electronic manifest. 2 . Mario Cardullo's in 1973 was the first true ancestor of modern RFID. not an identification tag. Even though this device was a passive covert listening device. it has been attributed as a predecessor to RFID technology.3 RFID HISTORY Introduction In 1946 Leon Theremin invented an espionage tool for the Soviet Union which retransmitted incident radio waves with audio information. sound and light as transmission medium. vehicle performance monitoring). The original business plan presented to investors in 1969 showed uses in transportation (automotive vehicle identification. powered by the interrogating signal.

Some can be as small as a grain of rice.4 BACKGROUND Introduction RFID has established itself in a wide range of markets including livestock identification and automated vehicle identification (AVI) systems because of its ability to track moving objects [1]. captures data from tags. 1. The reader. 1. Data is stored in the IC and transmitted through the antenna to a reader. but are externally powered typical from the reader) RFID Transponders. 1. 3 .4. and action.1 RFID TAGS Tags also sometimes are called “transponders”. then passes the data to a computer for processing.Chapter 1 1. In passive systems. The two commonly used RFID Transponders [2] are Active (that do contain an internal battery power source that powers the tags chip) and Passive (that do not have an internal power source. The reader decodes the data encoded in the tag(s) integrated circuit (silicon chip) and the data is passed to the host computer for processing. which are the most common. using an attached antenna. RFID tags can come in many forms and sizes. an RFID reader transmits an energy field that “wakes up” the tag and provides the power for the tag to respond to the reader. Data collected from tags is then passed through communication interfaces (cable or wireless) to host computer systems in the same manner that data scanned from bar code labels is captured and passed to computer systems for interpretation.5 WORKING OF RFID Information is sent to and read from RFID tags by a reader using radio waves.4. controlled by a microprocessor or digital signal processor. storage.2 RFID READER A reader (now more typically referred to as an RFID interrogator) is basically a radio frequency (RF) transmitter and receiver.

4 .7 FUTURE OF RFID RFID is said by many in the industry to be the frontrunner technology for automatic identification and data collection. a band familiar to ISPs). • High frequency (HF) 13. A tag's read range performance is usually considered the primary gauge of its suitability for a particular application. It is important to remember that not all applications require maximum range. as of yet unproven. • Microwave (at 2450 MHz.56 MHz.2 KHz. Tags in the LF-HF band have a range of 1 to 18 inches. 1. and microwave tags can reach 1 to 6 feet. The biggest. • Ultra high frequency (UHF) (including 869 and 915 MHz). while passive UHF tags can reach up to 20 feet.6 FREQUENCIES OF RFID Introduction RFID deployments tend to use unlicensed frequencies for their obvious cost benefits. The ranges greatly depend upon the surface on which the tag is mounted. benefit would ultimately be in the consumer goods supply chain where an RFID tag attached to a consumer product could be tracked from manufacturing to the retail store right to the consumer's home.Chapter 1 1. There are four commonly used frequencies: • Low frequency (LF) 125/134.

having a number of important advantages over the older barcode technology. toll tags to speed passes at the gas pumps. runners in marathons to assets in the supply chain [3]. In World War II. The unique identity in any case is a mandatory requirement for RFID tags. It is likely that goods will be tracked preferably by the pallet using RFID tags and at package level with Universal Product Code (UPC) or EAN from unique barcodes. They may not ever completely replace barcodes. • REPLACING BARCODES RFID tags are often a replacement for UPC (Universal Product Code) or EAN (European Article Number) barcodes. The new EPC (Electronic Product Code). Filtering and categorizing RFID data is needed in order to create useful information. while current bar codes are limited to a single type code for all instances of a particular product.8 APPLICATIONS Introduction RFID itself isn’t new. for example. The storage of data associated with tracking items will require many terabytes on all levels. Today. This may help companies to combat theft and 5 . RFID technology is used in everything from inventory control to product authentication. RFID tag data capacity is big enough that any tag will have a unique code. finally ending up in the consumer's hands. but the technology is currently experiencing a revival because of Wal-Mart’s announcement in June 2003 that it was requiring its top 100 vendors to be RFID compliant. The uniqueness of RFID tags means that a product may be individually tracked as it moves from location to location. rudimentary RFID was used to distinguish between friendly and enemy aircraft. is widely available at reasonable cost. despite special choice of the numbering scheme. Following are the potential uses of RFID.Chapter 1 1. along with several other schemes. due in part to their higher cost and in other part to the advantage of more than one independent data source on the same object.

which could meet the pedigree requirements. as well. but also contributes to concern over post-sale tracking and profiling of consumers. more generally. However. hospitals have begun implanting patients with RFID tags and using RFID systems. a number of U. RFID seemed to be the most promising and the committee felt that the pedigree requirement could be met by easily leveraging something that is readily available [8]. There is some evidence.Chapter 1 Introduction other forms of product loss. 6 . however. Moreover. for workflow and inventory management [14]. this is not likely to be possible without a significant reduction in the cost of current tags and changes in the operational process around POS.S. that nurses and other hospital staff may be subjected to increased surveillance of their activities or to labor intensification as a result of the implementation of RFID systems in hospitals [15]. • IDENTIFICATION OF PATIENTS AND HOSPITAL STAFF In July 2004. An FDA nominated task force came to the conclusion after studying the various technologies currently commercially available. the Food and Drug Administration issued a ruling that essentially begins a final review process that will determine whether hospitals can use RFID systems to identify patients and/or permit relevant hospital staff to access medical records. It has also been proposed to use RFID for POS (point for sale) store checkout to replace the cashier with an automatic system which needs no barcode scanning. Amongst all technologies studied including bar coding. This may help companies to cope with quality deficiencies and resulting recall campaigns. Since then. There is some research taking place. this is some years from reaching fruition. the tracing back of products is an important feature that gets well supported with RFID tags containing not just a unique identity of the tag but also the serial number of the object.

7 . It combines a proximity bar code reader. One option is to design a system that uses several PCs. the cost of purchasing so many PCs can be prohibitive [4]. This system is using serial signals generated by bar code. However. to give businesses a fool proof method for preventing unauthorized personnel from entering restricted areas.9 LITERATURE REVIEW Introduction During the research. This system is using Bar Code technology for attendance recording. with one PC located near each device.Chapter 1 1. The problem arises if a large number of card readers are combined to form a more complex entry system. PIN. touch pad for inputting a PIN. which can be used to control the entire system. and fingerprint readings that are easily transmitted to one centrally located computer. LTD. Details of such systems are follows: • ATTENDANCE RECORDING SYSTEM MANUFACTURED BY FORTUNA IMPEX PVT. and fingerprint reader. we have encountered various type of automatic attendance system depending on different technologies like barcode and biometric.

This system is using RFID for attendance monitoring. The RFID Reader writes down the time. Attendance processing (Interface) software can also be integrated with the payroll software for salary calculation and employee tracking. 8 . An employee places the RFID card within 5cm distance from the RFID Reader. date and type of departure/arrival. The Interface software which is available with this system is responsible for attendance record processing and it produces attendance reports in the customer preferred format. The display also indicates the current time. Manual entry is also possible [5]. The type of arrival/departure is indicated on the LCD display.Chapter 1 • Introduction EMPLOYEE ATTENDANCE SYSTEM MANUFACTURED BY SELVAM SYSTEMS PVT. This System assigns a unique card number for each employee. LTD.

[7]. electronic image storage. the European Union. and many states. verification systems verify a claimed identity (a user might claim to be Shameer by presenting his PIN or ID card and verify his identity using his fingerprint). receipt of benefits. Israel. Italy. which are used for a variety of purposes. including Canada. and local administrative regions have their own systems. Venezuela.S. Turkey. Many states also have their own AFIS system. and is managed by the FBI. the International Criminal Police Organization. AFIS systems have capabilities such as latent searching. On a technical level. applicant background checks. and electronic exchange of fingerprints and responses. whereas identification systems determine identity based solely on fingerprints. Chile. Pakistan.Chapter 1 Introduction • AUTOMATED FINGERPRINT IDENTIFICATION Automated fingerprint verification is a closely-related technique used in applications such as attendance and access control systems. and receipt of credentials (such as passports) [6]. Integrated Automated Fingerprint Identification System holds all fingerprint sets collected in the country. provinces. Algeria. the United Kingdom. 9 . including criminal identification. Australia. Many other entities. The U.

1. 2.1 • • RFID READER Reader consisting of RFID module and microcontroller will be designed Once the employee carrying the tag is in the vicinity of the reader.1 PROJECT DESIGN Figure 2.2 METHODOLOGY The design cycle consists of following steps as shown in the figure 2.2.1: Project Block Diagram 2.Chapter 2 CHAPTER 2 SYSTEM DETAILS System Details 2. Tag will be detected • The microcontroller will verify valid tag number by comparing it with predefined tag numbers already stored in the microcontroller ROM 10 .

3 • • • DATABASE SERVER The mapped tag is received by the database server (PC) Application does some data analysis against that tag Data analysis includes marking of attendance and updating the record of that particular tag holder 2.2. fan etc.2 11 .Chapter 2 • System Details If the tag is valid it is stored on the microcontroller’s RAM for further processing (10 bytes tag mapped to 2 bytes) • 2 bytes are then broadcasted 2.2.2 • TRANSMISSION Transmission from RFID reader to the control circuitry and database server is wireless (using ZigBee modules) • For serial communication RS232 standard is used 2.2.) against the valid tag number based on the defined profile of tag holder • Block diagram of control circuit is shown in Figure 2.4 • • CONTROL CIRCUITRY At the same time mapped tag is also received by the control circuitry Control circuitry automates office equipments (light.

Chapter 2 System Details Figure 2.2: Control Circuit Block Diagram 12 .

3 SYSTEM FLOW DIAGRAMS System Details Start 3-way handshaking b/w RFID module and MCU A Reader activated.3(a): Reader flow diagram 13 .Chapter 2 2. ready to detect tags Tag shown RFID module transfers 10 byte tag to MCU (serially) Is Received Tag = One of the Tag stored in ROM? N A Y Map 10 bytes to 2 bytes for transmission D Append Node ID with 2 bytes C Figure 2.

3(b): Reader flow diagram A 14 .Chapter 2 System Details C Broadcast using ZigBee B Delay Is Acknowledgement received? Y Indicate Ack N Is Retransmit Count > 3? Y N D Figure 2.

4: Control Circuit Flow Diagram 15 .Chapter 2 System Details Start E ZigBee receives broadcast B Are Received 3 bytes = One of the 3 bytes stored in ROM? Y N E Complement corresponding ports a/c to the matched profile E Figure 2.

4 NETWORK BLOCK DIAGRAM System Details Figure 2.Chapter 2 2.5: Network Block Diagram SCENARIO • • Reader will detect the RFID card and forward that ID to microcontroller Microcontroller will authenticate the ID and generate a specific number (3 byte code) against that ID • This specific number is then forwarded to the ZigBee transceiver via serial link from where it is broadcast to receiving nodes • One of the receiving node is the database server where attendance record is managed 16 .

The profiles can be modified from the server as they are stored in NVRAM • In order to simulate the multi node environment. This is a hard wired link 17 .Chapter 2 • System Details At the same time control circuit node receives the broadcast and automates the office equipments based on that specific profile. there is a dummy node that simulates the working of the RFID reader • A separate control circuitry (labeled as room 2) is attached with it.

1 • • MICROCONTROLLERS AT89C51 ATMEGA 8 AT89C51 89C51 is the member of 8051 family.1.Chapter 3 CHAPTER 3 Selection of Technologies SELECTION OF TECHNOLOGIES 3. Selection of these technologies was based on the following factors: • • • • • Application Cost Availability Compatibility Future enhancement The details of different models of Microcontroller and available wireless standards follows. 3. high performance CMOS 8-bit microcontroller with 4Kbytes of Flash programmable and erasable read only memory (PEROM).1 SELECTION OF TECHNOLOGIES The two main choices regarding technologies that have been made were of Microcontroller and Wireless Transmission Standards. This device is compatible with the industry standard 8051 instruction set and pin outs. it also provides the reasons for choosing the appropriate technology. AT89C51 is a low power. The on-chip Flash allows the program memory to be quickly 18 .

two-level interrupt architecture Full duplex serial port ~ on chip oscillator and clock circuitry Figure 3. By combining an industry standard 8-bit CPU with Flash on a monolithic chip. allowing the system designer to 19 . The 8951 provides the following features [9].1: AT89c51 ATMEGA 8 The ATmega8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC architecture. [20]: • • • • • • 4 Kbytes of Flash 128 bytes of RAM 32 I/O lines Two16-bit timer/counters Five vector.Chapter 3 Selection of Technologies reprogrammed using a nonvolatile memory programmer. the ATmega8 achieves throughputs approaching 1 MIPS per MHz. By executing powerful instructions in a single clock cycle. the 8951 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications.

2: ATMEGA8 WHY AT89C51? • COMPUTING NEEDS o ATMEGA8 has many built in features in it like analog to digital converter. Therefore 4Kbytes flash memory of AT89c51 can easily store 40-50 such IDs 20 . Crystal etc. The ATMEGA 8 provides the following features [10]: • • • • • 8 Kbytes of Flash 1024 bytes of RAM 23 I/O lines Two 8-bit timer/counters and one 16 bit timer/counter Full duplex serial port ~ on chip oscillator and clock circuitry Figure 3.Chapter 3 Selection of Technologies optimize power consumption versus processing speed. But in this project we don’t need those extra features o We are using 64 bits capacity ID cards in this project.

each having its own advantages and disadvantages. Main features of Wi-Fi include: 21 . There are various wireless technologies available. Our requirement was to choose a low power wireless standard with permissible range. to exchange the data at the broadband speed.11 working group. which is the public radio frequency ISM band.1. following is the brief summary of them.Chapter 3 • COST o Selection of Technologies AT89c51 is much cheaper than AVR microcontrollers (ATMEGA8) • MICROCONTROLLER PROGRAMMER o AT89c51 programmers are easily available in the local market where as AVR (ATMEGA8) programmers are not available in the market • RESOURCES AVAILABILITY o AT89c51 resources are easily available in different books and on internet also 3. We surveyed various Wireless Communication standards. We also probed in various alternatives present from the different vendors. where attendance will be managed.2 WIRELESS STANDARDS Wireless Transmission is required between the RFID reader and the database server (PC). Wi-Fi technology uses a spectrum in the 2. WI-FI Wireless fidelity (Wi-Fi) is a wireless networking protocol developed by the IEEE 802.4 GHz range.

Wi-Fi cannot do collision detection [16].Chapter 3 • Selection of Technologies Wi-Fi users can connect to the network sensor and to the internet when in the proximity of an Access Point (AP) • • Supports Mesh Networking Peer to Peer Connectivity Wi-Fi devices consume relatively high power as compared to other wireless networks. Besides power consumption they have limited range of up to 45 meters (indoors) to 90 meters (outdoors). Like other wireless standards it utilizes 2.14. Therefore. Applications and main features are: • • • Share files between PC and PDA Transmitting a signal from remote control to television It transmit data up to 1Mbps BLUETOOTH Bluetooth is an IEEE 802.1 standard that enables a short wireless connection to communicate between two devices when they are in close proximity to each other and don’t require high bandwidth.15.4 in terms of low power consumption and low cost.4 GHz Radio Spectrum and transmits data over a very short range of 10 meter. WIBREE Wibree is the most recent interoperable wireless communication technology introduced by Nokia that is a competitor of IEEE 802. 22 . Wibree cannot go head to head with the ZigBee in applications where more range is required [17].

where attendance is being managed. low cost and moderate range 30 m to 1. [19].4 GHz band there are 16 ZigBee channels. with each channel requiring 5 MHz of bandwidth [18].1 23 . In the 2. Another most important reason for using ZigBee module is that these modules come with serial interface therefore it will be easier for us to use these modules.Chapter 3 Characteristic And Main features are: • Selection of Technologies A Bluetooth PAN is composed of up to 8 active devices in a master-slave relation ship • • • The Bluetooth protocol divides the bandwidth into 79 channels Each channel has a centre frequency of 1 MHz A Bluetooth enable wireless device is capable making phone calls. Pin description of ZigBee module is illustrated in table 3. sending and receiving faxes. WHY ZIGBEE? We selected ZigBee because of its low power consumption. and printing documents [11]. This range is suitable for our application where we want to wirelessly transmit data from RFID reader to the Database Server.6 Km. These low-Rate WPAN standards have exceedingly secured wireless transmission over a very distant range. synchronizing data with desktop computers.

Chapter 3 Table 3.3: ZigBee pin configuration 24 .1: ZigBee Pin description Selection of Technologies Figure 3.

There's no doubt. It’s not advisable to go with Jscript. It cleans up many of the syntactic peculiarities of C++ without diluting much of its flavor (thereby enabling C++ developers to transition to it with little difficulty). Currently Microsoft is offering four languages out of the box: C#. VB. So the obvious question is which language is best suited for .2 SELECTION OF SOFTWARE TOOL Selection of Technologies The Selection of software tool was made by comparing the different programming languages and came up to a conclusion of using C# for the database server. JSCRIPT Nobody in the current market is talking about Jscript (found in the quick start only) and most programmer strongly believe JScript to end up with a very small user base.Net? Here is a brief discussion on the above topic. MANAGED C++ C++. despite it being cool.Net platform and many more to come from various independent vendors. C# C# is the new language with the power of C++ and the slickness of Visual Basic. that experienced C++ practitioners will continue to admire and use its power. even in its new managed form. multiple code inheritance and deterministic finalization.Chapter 3 3.NET and C# for their cleaner syntax and ease of use. Managed C++ and Jscript for application development on . C# with clean object oriented syntax and large class library (in conjunction with 25 . And its superiority over VB6 in facilitating powerful object oriented implementations is without question.Net. definitely lags behind other languages such as VB. templates. though.

NET language. but for the reasons we've described of productivity. C# is the clear choice. It's said that VB. But as I said before. To the question 'Whether to choose VB. some expert claims that you have to write 33% more Lines of Code in VB.NET is an object oriented language and VB6 is not.Net than C# (Nothing Official).Chapter 3 Selection of Technologies . Now VB. So the problem is that if you're not thinking object oriented. VB. If you're looking for the safest bet. you're probably not going to enjoy the VB.NET (from VB6) transitioning experience coz this is more than just a syntax shift.The answer has been 'Use the one with which you are comfortable with'. 26 .NET and the base class libraries) could be the ‘most productive mainstream language’ and it is an ECMA (European Computer Manufacturers Association. For the serious developer wanting Microsoft's most productive and mainstream . VB. hitch a ride with C#.Net provides all that and it’s now a fully-fledged object oriented language.NET VB Developers over the years have been asking for more power (inheritance and polymorphism).NET is now just as powerful and C++ remains even more so.) standard language that offers the potential of being available across many platforms. Sure VB.Net or C#' . you won't regret it therefore we choose C# for our application [12].Net is there only to please those millions of VB6 Developers and nothing else. clarity and a broad community. There is one more problem.

1 • • • • RFID module Microcontroller (AT89c51) ZigBee module Port switching circuit Figure 4.Chapter 4 CHAPTER 4 System Hardware: Reader Node SYSTEM HARDWARE: READER NODE Reader node can be divided into four main components as shown in figure 4.1 • RFID READER WORKING An RFID module typically contains a transmitter and receiver. a control unit and a coupling element (antenna).1: Reader node Schematic 4. 27 .

demodulating and decoding. or signals back to the direction they came from) the carrier wave from the reader. Information is sent to and read from RFID tags by a reader using radio waves.2 Figure 4. storage. The minute electrical current induced in the antenna by the incoming radio frequency signal (125 KHZ) provides just enough power for the CMOS integrated circuit in the tag to power up and transmit a response.) Data collected from tags (10 bytes) is then passed through communication interfaces (cable or wireless) to host computer systems in the same manner that data scanned from bar code labels is captured and passed to computer systems for interpretation.2: RFID backscatter • • Passive tags have practical read distances ranging from about 10 cm (4 in. and action. • Most passive tags signal by backscattering (Backscatter is the reflection of waves. 28 . particles.Chapter 4 • System Hardware: Reader Node The reader has three main functions: energizing. • Passive RFID tags have no internal power supply. as shown in figure 4.

indicating the microcontroller that it is ready to read • ID EXTRACTION o Whenever RFID card is in the vicinity (4 in. The string is of 16 bytes o o The encoded string is” re364 acknwlge” Reader responds with an acknowledgement string 24 bytes long. This waiting time avert the microcontroller from reading the same ID twice o Microcontroller than starts comparing (byte by byte) the received ID with the IDs stored in its ROM • TAGGING o After ID authentication microcontroller will map 10 byte card ID on a 2 byte tag# so that it can efficiently utilize the transmission time o Transmission time at 9600 baud rate of 10 bytes: T= (1/9600)*80=8.Chapter 4 System Hardware: Reader Node 4.) of a reader it will extract the ID (refer 4.1 for details) and serially transfer (10 byte) it to the microcontroller o Microcontroller will save it in its RAM and wait for 3 seconds.33 msec 29 .2 • MICROCONTROLLER WORKING HAND SHAKING o o On power-up reader sends an activation string to the microcontroller After receiving the activation string microcontroller sends an encoded string to the reader which is provided by the vendor.

This is done to avoid data collision between nodes 30 .3: Tagging o • After ID verification microcontroller extract its tag# for transmission TRANSMISSION o Before forwarding tag# to the ZigBee module microcontroller append one byte of node ID before tag# o o This node ID is used to pinpoint the card location Microcontroller than serially transmits 3 byte of data (containing 1 byte of node ID and 2 bytes of tag#) and wait for the acknowledgement from the server o The waiting time of every node is unique because waiting time is dependent upon its node ID. tag numbers are also unique In microcontroller’s ROM these IDs are saved in a 12 byte fashion as illustrated in fig 4. More the transmission time higher will be the probability of data collision and vice versa o o Like RFID cards.3 Figure 4.6 msec So it means we are saving more than 80% of the transmission time by using tagging technique o In multi node environment transmission time is directly related with the system performance.Chapter 4 2 bytes: System Hardware: Reader Node T= (1/9600)*16=1.

ZigBee RF Modules operate in Transparent Mode. the data is sent out the DO pin (pin 2) • • Data is buffered in the DI buffer If the module cannot immediately transmit (for instance. the modules act as a serial line replacement .all UART data received through the DI pin (pin 3) is queued up for RF transmission. When operating in this mode. if it is receiving RF data).Chapter 4 o System Hardware: Reader Node If microcontroller doesn’t receive acknowledgement from the server it will retransmit the node ID and tag# and again wait for the acknowledgement. the serial data is stored in the DI Buffer • The data is packetized and sent at any Packetization timeout or when 100 bytes (maximum packet size) are received • ZigBee transceiver will broadcast that number to all the receivers (ZigBee transceivers) operating within its region 31 . When RF data is received. The re-transmit limit of every node is 3 o Whenever we push a button on dummy node it transmit a fixed fake node ID and tag# 4.3 • • ZIGBEE WORKING For wireless transmission microcontroller is serially connected with ZigBee module Microcontroller will forward node ID and tag# to the ZigBee transceiver via serial link between microcontroller and transceiver module • By default.

Chapter 4
4.4 • PORT SWITCHING CIRCUIT

System Hardware: Reader Node

The microcontroller AT89c51 has one serial port (i.e. one Tx and one Rx pin), but the line driver (max232) used between microcontroller and DB9 connecter can support two serial ports

To avoid tapping (interfacing ZigBee and RFID module through same port), 3-state buffer (74ls244) is used

74ls244 has two enable pins (pin 1 and 19), each pin can control the four inputoutput pair associated with it, as shown in figure 4.4(a)

Figure 4.4(a): 74ls244 connections

Figure 4.4(b): 74ls244 truth table

When these pins are high, the output is in high impedance state. Pin 1 is reserved for RFID module and pin 19 for ZigBee module.

When the output is intended for particular device corresponding pin is set low (enable pins are active low as shown in figure 4.4(b)) through the assembly program burned in microcontroller

32

Chapter 4
4.5 • • • DUMMY NODE

System Hardware: Reader Node

To simulate multinode environment we are using dummy node Dummy node is also operating in the same fashion as reader node Dummy node is not interfaced with the RFID reader, instead it has push buttons as shown in figure 4.5

Each push button generates a Tag # which simulates as if real Tag was shown

Figure 4.5: Dummy node schematic

33

Chapter 5

System Hardware: Control Circuitry
CHAPTER 5 SYSTEM HARDWARE: CONTROL CIRCUITRY

5.1

INTRODUCTION

Control circuitry is one of the vital part of the project. The control circuitry is basically used for the room automation, the room automation can be personalized or kept as default.

5.2

COMPONENTS 1) ZigBee 2) MAX 232 3) Microcontroller 4) Buffer 5) Optocoupler 6) NPN Transistor 7) Relay

5.3 • •

WORKING ZigBee receives the 3byte data (Node + Card ID) ZigBee transceiver sends the data to the microcontroller via MAX 232 IC (line driver)used for protocol translation from RS 232 to TTL and vice versa • The translated data is read by the microcontroller via a serial link

The microcontroller compares the card and node ID with the ID stored in its memory

34

typically a transmitter and a receiver.1: Optocoupler • The output current is proportional to the amount of incident light supplied by the emitter 35 .1 Figure 5.Chapter 5 • System Hardware: Control Circuitry Every ID stored in the microcontroller’s memory has a specific room to be automated against it • • • • • • • The room itself has it own profile The default profile is to switch every AC load controlled by the microcontroller In other case the profile can be personalized according to the user ID The microcontroller is connected to the relays via a switching circuitry Switching circuitry consists of 3 components Buffer. Optocoupler and Relay Buffer is used to amplify the output current of the microcontroller The optocoupler is used to isolate the vital components (ZigBee and Microcontroller) from the reverse current • Optocoupler is a device that uses a short optical transmission path to transfer a signal between elements of a circuit. while keeping them electrically isolated. as illustrated in Figure 5.

the resulting magnetic field attracts an armature that is mechanically linked to a moving contact. as illustrated in Figure 5.2 Figure 5.2 Relay schematic diagram • The moving armature makes a connection with a fixed contact resulting in the switching of power line on to the AC load 36 .Chapter 5 • System Hardware: Control Circuitry As the current across the phototransistor increases it goes to the NPN transistor which is used as an amplifier to drive the relay • A relay is an electrical switch that opens and closes under the control of another electrical circuit • When the current flows through the relay coil.

e. for example as in the case of a Digital Signal Processor which performs a small set of signal processing functions • Microprocessors tend to be designed to perform a wider set of general purpose functions • Microcontrollers are widely used in modern cars where they will each perform a dedicated task. or a microcontroller to regulate the car air conditioning • Microprocessor in a PC which performs a wide range of tasks related to the general requirements of a PC. performing I/O for the main subsystems.1: Microcontroller and Microprocessor comparison MICROCONTROLLER • Microcontrollers incorporate program memory. and 80386 are examples of microprocessors • Microcontrollers are usually designed to perform a small set of specific functions.e. Intel's 80186. peripheral control etc 37 . ram memory and Input/output. i. performing the necessary calculations for a very wide set of software applications. a microcontroller to regulate the brakes on all four wheels. 80188. Microchip's pic series and Atmel's AVR series are examples of microcontrollers • MICROPROCESSOR Microprocessors generally require external components to implement program memory. ram memory and input/output resources internal to the chip.4 WHY MICROCONTROLLER? System Hardware: Control Circuitry Table 5. i.Chapter 5 5.

input/output (I/O) ports and a clock oscillator. They're also programmable via standard computer interfaces and proprietary languages and network options. serial port. PLC • PLC is used in an industrial environment The main reasons for using microcontroller over programmed logic controllers and microprocessor are as follows: • Cheapest among the three components 38 . timer/counters. basic. assembly. They contain multiple inputs and outputs that use transistors and other circuitry to simulate switches and relays to control equipment. They combine an arithmetic logic unit (ALU).2: Microcontroller and PLC comparison MICROCONTROLLER • Micro-controller is smaller and well suited for embedded situations • Micro controller has a very different programming language.Chapter 5 System Hardware: Control Circuitry Table 5. • PLC is programmed in "Ladder Logic" which appears very similar to industrial schematics. etc. memory. • PLC is the control hubs for automated systems NAD processes. • MCU) are complete computer systems on a chip.

5 CONTROL CIRCUIT SCHEMATIC Figure 5.Chapter 5 • • Used for embedded situations System Hardware: Control Circuitry References and resources are easily available 5.3(a): Control circuit schematic (Receiver part) 39 .

6 • CONTROL CIRCUITRY WITH NVRAM To give this project flexibility we are using NVRAM with the control circuitry.6. Due to time constraint we are unable to implement this idea with our reader node • NVRAM give us the opportunity to modify user’s profile on the run time without making any changes in the hardware • NVRAM is a combination of RAM and ROM.Chapter 5 System Hardware: Control Circuitry Figure 5. He can select any profile for modification. Non-volatile random access memory (NVRAM) is the general name used to describe any type of random access memory which does not lose its information when power is turned off 5. To modify the selected profile our program 40 .1 • MODIFICATION IN USER’S PROFILE Administrator can modify user’s profile by a separate program on the server.3(b): Control circuit schematic (Automation part) 5.

Each node will receive this string and perform modification according to the string code. • • First byte will inform the nodes that administrator wants to modify the profile Second byte will contain the node ID. If administrator wants to modify the profile on all nodes than it will contain code number 99H • Fourth and fifth byte is of card ID and sixth byte contains the profile number as illustrated in figure • To keep other nodes synchronized with the server the modification program transmit these 6 bytes into two 3 byte chunks Node ID 99H 00H Card ID (2 Bytes) Profile # 41 .Chapter 5 System Hardware: Control Circuitry will send a unique string of six bytes.

7 System Hardware: Control Circuitry CONTROL CIRCUIT WITH NVRAM SCHEMATIC Figure 5.Chapter 5 5.4: Control circuit with NVRAM schematic 42 .

1 SOFTWARE INTRODUCTION The “Smart Attendance System” is an application for this project’s database server. It maintains profiles against unique Ids. This application maintains the attendance record against unique IDs assigned to RFID card holders and also provides facility to add/edit the user profile specified in control circuit RAM.Chapter 6 CHAPTER 6 SOFTWARE DESIGN Software Design 6.2 • SAS MAIN FEATURES SAS (Smart Attendance System) will continuously read data which is provided by the RFID reader. The profile has various fields o o o o • • • • • Name Email Address Phone Number Room Number It maintains the daily record of attendance It provides option of search profiles by name. 6. • • It maintains the attendance in database made on Microsoft Access. ID and email It also provides the option to see the attendance record according to calendar It also makes a graph of each card holder’s check in and checkout timings This application has also many checks and balances which makes it more secure. For example o It prevents a card holder to check in at two places simultaneously. 43 .

2.2. Each log has the information about node ID. Like if minimum requirement for a attendance to be marked is 3 hours it means a card holder must spent 3 hours in office otherwise his/her attendance will not be marked by the system.1 WORKING OF SOFTWARE The SAS has two modes of operation • • Standard Mode Admin Mode 6. time spent and date of that log.2 STANDARD MODE In standard mode daily record of attendance appears. entrance time. exit time. card ID. 6. Figure 6.1: Snapshot of standard mode 44 .Chapter 6 o Software Design It marks attendance if and only if a card holder spent a minimum time required for attendance.

It also provides us options to delete and modify saved profiles. 6.2. Figure 6.Chapter 6 Software Design After running this application the first thing is to open comport from its file menu. Figure 6.3 ADMINISTRATOR MODE Administrator mode is a password protected mode it provides us option to add new profiles.3: Snapshot of Administrator Mode 45 .2: Snapshot of file menu It can also provide us option to save the daily attendance in a separate text file through its “save log” option in a file menu as we can see in the figure 6.2.

5(a): Snapshot of operations menu 46 . There are two ways to add new profile • • By click on “ADD” button in quick operations pane as shown in figure 6.4: Snapshot of Add profile window Figure 6.4 By the help of operations menu as shown in figure 6.5(a).(b) and (c) Figure 6.Chapter 6 (a) HOW TO ADD A PROFILE? Software Design The SAS provides us very simple and easy way to add new profiles.

5(b): Before Adding a new profile Figure 6.5(c): After Adding a new profile 47 .Chapter 6 Software Design Figure 6.

Chapter 6 (b) HOW TO MODIFY A PROFILE? Software Design The SAS provides us very simple and easy way to modify previously stored profiles.6: Snapshot of Admin mode 48 .6. select the profile by clicking on it and then press modify button as shown in figure 6. There are two ways to modify previously stored profile • • By click on “MODIFY” button in quick operations pane By the help of operations menu At first. Figure 6.

we just need to change the name field in modify window as shown in figure 6. For example If we change the name “Arshian” to “Arshian Ahmed”.Chapter 6 Software Design Figure 6.7: Snapshot of modify window As we can see in the figure 6. here we have options to modify any detail of selected profile.9. Figure 6.8.8: Snapshot of modify window (after modification) After pressing the button named “Modify” we can observe the change in profile name in admin window as shown in figure 6.7. 49 .

There are two ways to delete a profile • • By click on “Delete” button in quick operations pane By the help of operations menu Figure 6.9: Snapshot of Admin mode (c) HOW TO DELETE A PROFILE? The SAS provides us very simple and easy way to delete previously stored profiles.Chapter 6 Software Design Figure 6.10: Snapshot of Delete window 50 .

Figure 6.10. we observe the removal of that record which we have deleted.11a: Before deleting user profile 51 .Chapter 6 Software Design If we press the button named “DELETE” in the delete record window as shown in figure 6.

Chapter 6 Software Design Figure 6.Net Frame work 3.4 SERIAL PORT TERMINAL To frequently test RFID reader and project’s hardware we have made another program with a name of “Serial Port Terminal” as shown in figure 6.5 128 Mb of RAM (minimum) 1 GHZ Processor (minimum) 6. This program is solely made for testing purpose.3 SYSTEM REQUIREMENTS FOR SAS To run “Smart Attendance System” following are the basic requirements • • • • Windows XP/VISTA (XP with service pack 2) .11b: After deleting user Profile 6.12. 52 .

Chapter 6 Software Design Figure 6. baud rate.12: Snapshot of Serial Port Terminal • It can read data automatically we don’t have to press any button for reading data from serial buffer • It has a facility to set particular com port. 53 . parity.13. data bits and also stop bits • • We can send and receive and data in text as well as Hex format Before start our communication we have to open serial port by pressing “open port” button • It dump node Id and card Id separately in a text file along with the system time as shown in figure 6.

13: Snapshot of text file records of SerialPort terminal 54 .Chapter 6 Software Design Figure 6.

plus the project casing for presentation purpose.13360/- * Miscellaneous includes resistors.) Provided by University 800 DUMMY NODE • • • • • • • • Microcontroller ZigBee module Miscellaneous CONTROL CIRCUITRY Microcontroller Relays Zigbee module Miscellaneous NVRAM 70 200 Provided by University 600 350 70 Provided by University 600 SERIAL CABLES • Few serial cables 200 MICROCONTROLLER BURNER • Burner for microcontroller 900 TOTAL Rs. max232 etc. 55 .1: Cost analysis Cost Analysis SYSTEM PARTS READER NODE • • • • RFID reader module Microcontroller ZigBee module Miscellaneous 9500 70 COST (Rs. switches.Chapter 7 CHAPTER 7 COST ANALYSIS Table 7. capacitor.

Chapter 8 CHAPTER 8 Conclusion and Future Work CONCLUSION AND FUTURE WORK 8. security. This limitation can be overcome by the use of NVRAM with the reader node which will not only make the design scalable but also flexible. it is expected that wireless ad hoc sensor networks will become commonly deployed.1 CONCLUSION The objective of this project that is “RFID based Smart Office” was to design a system based on RFID technology that will not only change the hectic manual attendance procedure but also automate user’s office. The final design of the project accomplished the idea of multinode environment which is responsible for automatic attendance and office automation according to the personalized profile of the RFID card holder.2 FUTURE WORKS With the coming availability of low cost. short range radios along with advances in wireless networking. 8. The design also deals with the issues (reliable data transfer) of multinode environment. This project facilitates the users in numerous ways like time saving in attendance procedure. This project can be improvised by using external memory because the project design has a capability of handling 65000 card IDs which is large enough for any organization but the limitation lies in the microcontroller storage capacity. 56 . To make sure reliable data transfer between server and reader node the project adopts CSMA/CD algorithm. NVRAM not only provide us extra memory but also enable us to add cards IDs on the run time. employees’ attendance management and many more.

There is also some space to improve the project code.Chapter 8 Conclusion and Future Work Furthermore. 57 . this project can be extended by making nodes IP enabled so that it can be accessed virtually from any where.

REFERENCES INTERNET [1] KORTEX PSI Point Of Sale & Industry http://www.edu/research/magazine/2006/robots/ September.alibaba.html (Accessed on 2nd September. 2007) [5] Selvam Systems Pvt Ltd-Computer.techtarget.htm (Accessed on 5th September. www. 2007) (Accessed on [2] VIRADIX: The smart choice for E-commerce consulting http://www. 2007) [7] Information Security: Covering Today’s Security Topics http://searchsecurity.com/RFID-FDA-Regulations. 2007) [8] RFID-FDA-Regulations http://www.com/solutions/success_stories_Attendance_Recording_System.htm 2nd September. Computer software Project http://www.bin95.html (Accessed on 16th April.html (Accessed on 5th September..com/Applications/Applications_TOC. 2007) [6] Federal Bureau of Investigation http://www. 2007) (Accessed on 2nd [4] Moxa Success Story – Attendance Recording System http://www.htm (Accessed on 16th April. 2007) [9] 58 .com/terminology.atmel.sid14_gci812929.moxa.com/sDefinition/0.fbi.korteks.gov/hq/cjisd/iafis.tamu.htm (Accessed on 16th April.com/member/203023.00. 2007) [3] Texas A&M Engineering http://engineer.com/products/8051/ (Accessed on 4th October. 2007) Atmel Corporation.viradix.

com (Accessed on 8th October. 2007) [17] Nick Hunn. Monahan (Ed). pp. 2007) PAPERS [13] Dr.15. AIM Inc. 2-7. Research Paper. White Paper. and Monahan. “Indoor Positioning and Digital Management: Emerging Surveillance Regimes in Hospitals”. 2007) [11] The Official Bluetooth Technology Info Site.net/index. 2007) 59 .com/papers/Fisher_Monahan_RFID_IJMI.International Journal of Medical Informatics. October 2001. http://www.net/papers/rfid.ezurio. Torin.bluetooth.pdf (Accessed on 6th October. Jill A. 2007) [16] Paul S. September 2004. “ZigBee/IEEE 802. pp. pp. pp.jillfisher.1-3 http://pages. Ezurio Ltd. http://www.edu/~suman/courses/838/papers/zigbee.pdf (Accessed on 16th April. White Paper.pdf (Accessed on 16th April.com/archives/archive73. In T. http://www.pdf (Accessed on 8th October. Surveillance and Security: Technological Politics and Power in Everyday Life.176-183. AT&T Labs – Research.pdf (Accessed on 8th October.php?module=Freaks%20Devices&func= displayDev&objectid=52 (Accessed on 4th October. pp.pdf (Accessed on 16th April. University of Berkeley. http://www. http://www. “An introduction to Wibree”. April 2007. Jill A.transcore. 2006. “Is Wi-Fi in Your Future? ”. http://torinmonahan. 2007) [12] Overview .4 Summary”. 2007) [14] Fisher.com/files/00616.1-19 http://www.com/pdf/AIM%20shrouds_of_time. pp.[10] AVR freaks http://www. 2002.csharphelp.wisc. 2002.Why C# ?. Henry.comsoc. 2007) [15] Fisher. 2007) [18] Sinem Coleri Ergen. “Tracking the Social Dimensions of RFID Systems in Hospitals”.avrfreaks.html (Accessed on 2nd October. Jeremy Landt “Shrouds of Time: The history of RFID”. 3-7. 77–88.cs.org/confs/ieee-infocom/2002/non-image_files/ Infocom2002%20Keynote-short.

pp.zigbee. Bachelor's Thesis. 5-24 http://www. 2007) BOOKS [20] Mohammad Ali Mazidi.diku.[19] J. Skovgaara. Munk-Stander.pdf (Accessed on 8th October. Second Edition. University of Copenhagen. p 28 60 . “The 8051 Microcontroller and Embedded Systems Using Assembly and C”. “Implementing a ZigBee Protocol Stack and Light Sensor in TinyOS”.dk/~bonnet/ba. June 2005. Department of Computer Science. M. Neilsen. T.

1 DATA SHEETS 61 .APPENDICES A.

62 .

63 .

64 .

65 .

66 .

67 .

68 .

69 .

70 .

71 .

72 .

73 .

74 .

75 .

76 .

77 .

A.2

ASSEMBLY CODE: READER NODE

;************************************************************************************************** ;************************************** SETTING TIMER *************************************** ORG 0H MOV TMOD,#20H MOV TH1,#-3 MOV SCON,#50H SETB TR1 MOV P2,#0H MOV P1,#0H

;SETTING BAUD RATE 9600BPS

;************************************************************************************************* CLR P2.3 SETB P2.4 ;TO ACTIVATE READER PORT ;TO DISABLE ZIGBEE PORT

;***************************************** HANSHAKING ************************************* MAIN: MOV R1,#08 REC: JNB RI,REC MOV A,SBUF CLR RI DJNZ R1,REC SETB P2.0 MOV R5,#36 MOV R4,#255 MOV R3,#255 DJNZ R3,A3 DJNZ R4,A2 DJNZ R5,A1 ;5 SEC DELAY ;MCU RECIEVES THE MODULE ;POWERED ON STRING

A1: A2: A3:

MOV DPTR,#CODED_STRING MOV R6,#16 MCU_SEND: CLR A MOVC A,@A+DPTR MOV SBUF,A JNB TI,$ CLR TI INC DPTR DJNZ R6,MCU_SEND SETB P2.1

;MCU SEND THE ENCODED STRING ;STRING TO MODULE

78

HERE: MOV R2,#24 REC2: JNB RI,REC2 MOV A,SBUF CLR RI DJNZ R2,REC2 SETB P2.2

;MCU RECIEVES THE ACK STRING ;FROM READER

FIRST_TIME: JNB RI,$ MOV A,SBUF MOV 43H,A CLR RI JNB RI,$ MOV A,SBUF MOV 44H,A CLR RI JNB RI,$ MOV A,SBUF MOV 45H,A CLR RI JNB RI,$ MOV A,SBUF MOV 46H,A CLR RI JNB RI,$ MOV A,SBUF MOV 47H,A CLR RI JNB RI,$ MOV A,SBUF MOV 48H,A CLR RI JNB RI,$ MOV A,SBUF MOV 49H,A CLR RI JNB RI,$ MOV A,SBUF MOV 40H,A CLR RI

;FUNCTION TO READ FIRST TAG

79

JNB RI,$ MOV A,SBUF MOV 41H,A CLR RI JNB RI,$ MOV A,SBUF MOV 42H,A CLR RI SETB P1.0 MOV R7,#22H

;CHECK FOR FIRST TAG TO BE READ

;************************************************************************************************* ;*********************************** READ FUNCTION *************************************** TAG_RECIEVE_CMP_MAP_TRANS: CJNE R7,#23H,DELAY CLR P2.3 SETB P2.4 MOV R0,#40H CLR RI TAG: MOV R2,#10 TREC: JNB RI,TREC MOV A,SBUF MOV @R0,A INC R0 CLR RI DJNZ R2,TREC CPL P1.0 DELAY: MOV R7,#23H MOV R5,#22 A4: MOV R4,#255 A5: MOV R3,#255 A6: DJNZ R3,A6 DJNZ R4,A5 DJNZ R5,A4 CLR RI MOV DPTR,#TAG1 ;TO ACTIVATE READER PORT ;TO DISABLE ZIGBEE PORT ;MAIN FUNCTION

;SAVING THE TAG INTO RAM STARTING ;AT LOCATION 40H--49H

;3 SEC DELAY

80

RETRANSMIT TIME FOR .#23H LJMP TAG_RECIEVE_CMP_MAP_TRANS 81 .TO DISABLE READER PORT .TO GENERATE RANDOM .4 LABEL1: CJNE R2.MOV_DPTR INC DPTR INC R0 DEC R1 DJNZ R2.#10 MUL AB .@A+DPTR MOV B.@R0 CJNE A.******************************** COMPARE AND MAP ************************************ COMPARE: MOV R2.TO ACTIVATE ZIGBEE PORT SETB P2.#40H MOV R1.@A+DPTR MOV R6.COMPARING THE READ TAG WITH .#0 ..THE ONE STORED IN ROM .#16 MOV B.#0CH CMP1: CLR A MOVC A.A INC DPTR .EACH NODE LABEL0: MOV R2.RETRANSMIT CHECK MOV R7.#10 MOV R0.#3.CMP1 CLR A MOVC A.A INC DPTR CLR A MOVC A.NODE_SEND .B.@A+DPTR MOV R7.GENERAL AND SCABLE FUNC .3 CLR P2.ALSO DOES MAPPING TO 2 BYTES MOV A.

#180 MOV R4.R7 JNB TI.C2 DJNZ R5.#23H LJMP TAG_RECIEVE_CMP_MAP_TRANS MOV_DPTR: INC DPTR DJNZ R1.#10H.*************************************** NODE SEND ***************************************** NODE_SEND: MOV SBUF.CONT .$ CLR TI INC R2 MOV R5.INCCREMENT IF NOT COMPARE ..#8 D4: MOV R4.@A+DPTR CJNE A.#255 D5: MOV R3.C1 JNB RI.D6 DJNZ R4.#255 D6: DJNZ R3.R6 JNB TI.A DJNZ R4.1 SEC DELAY MOV R7.MOV_DPTR CLR A MOVC A.D4 CLR P1.SBUF CJNE A.1 DELAY_1SEC: MOV R5.1 MOV R7.SENDING THE MAPPED TAG NO C1: C2: .$ CLR TI MOV SBUF.LABEL1 SETB P1.$ CLR TI MOV SBUF.#0FFH.LABEL1 MOV A.#10H JNB TI.D5 DJNZ R5.#23H LJMP TAG_RECIEVE_CMP_MAP_TRANS CONT: LJMP COMPARE 82 .

6BH..6EH. IN ROM TAG1: DB "06000707AD" .67H.0FFH. TAG2: DB "0600072E1B" MYTAG2: DB 00H.65H END 83 .36H.07H.02H.6CH.65H.33H.63H.0FFH ORG 400H CODED_STRING: DB 72H.STORING TAG NO.0FFH.02H TAG3: DB "060007195B" MYTAG3: DB 00H.02H.34H.MAPPED TAG NO.61H.********************************** STORED TAGS IN ROM********************************** ORG 300H .03H END_SEQ: DB 0FFH.ORIGNAL TAG MYTAG1: DB 00H.01H .77H.

IF AA WAS SEND THEN MOVE TO . MAIN SJMP MODIFY_PROFILE L2: .#0AAH.STAY1 MOV A.L1 MOV R0. #3 L1: JNB RI.A INC R0 DJNZ R2.L2 SJMP TO_AUTOMATE CJNE A. TO MODIFY FUNC ************************ MODIFY FUNCTION **************************** MODIFY_PROFILE: MOV R0.#20H MOV TH1.SBUF MOV @R0.A 84 . #40H MOV A.@R0 CJNE A.#50H SETB TR1 MOV P2.3 ASSEMBLY CODE:CONTROL CIRCUIT WITH NVRAM ************************************************************************ ****************** CONTROL CCT CODE WITH NVRAM ******************* ************************* SETTING THE BAUD RATE ********************* ORG 0H MOV TMOD.A.#40H MOV R2.4 MOV R0.#3 STAY1: JNB RI. L1 MOV A.#0H ***************************** MAIN *********************************** MAIN: CLR P3.#10H.#-3 MOV SCON.#0H MOV P1.SBUF MOV @R0. #40H MOV R2.

@DPTR MOV B.A INC R0 MOV A.#0000H LABEL: MOVX A.#0FFH.@R0 MOV R3.H2 LJMP MAIN SJMP LABEL .#40H MOV A.INC R0 DJNZ R2.#0000H MOV R2.B.#10 S2: MOVX A.OVERWRITE THE MEM LOCATION .S2 LJMP MAIN INC DPTR INC DPTR INC DPTR MOVX A.@R0 MOV R6.$ CLR TI INC DPTR DJNZ R2.@DPTR MOV B.A INC R0 MOV A.A MOV DPTR.SKIP TO NEXT PROFILE LOCATION .@DPTR CJNE A.C1 INC DPTR MOVX A.B.A JNB TI.STAY1 MOV R0.A MOV DPTR.WITH THE NEW BYTE C1: H2: C2: INC DPTR 85 .R7 CJNE A.R3 MOVX @DPTR.C2 INC DPTR MOV A.@DPTR MOV SBUF.R6 CJNE A.@R0 MOV R7.

@DPTR CJNE A.H2 LJMP MAIN END 86 .#0FFH.INC DPTR MOVX A.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer: Get 4 months of Scribd and The New York Times for just $1.87 per week!

Master Your Semester with a Special Offer from Scribd & The New York Times