Wifi RFID Scanner

76
UNIVERSITEIT STELLENBOSCH UNIVERSITY jou kennisvennoot your knowledge partner Design Of An Automated Class Attendance Recording System by Carel van Wyk 14543109 Project E448 Report submitted in partial fulfilment of the requirements of the module Project (E) 448 for the degree Baccalaureus in Engineering in the Department of Electrical and Electronic Engineering at the University of Stellenbosch Supervisor: H.R. Gerber October 2008

Transcript of Wifi RFID Scanner

Page 1: Wifi RFID Scanner

UNIVERS ITE IT •STELLENBOSCH •UNIVERS ITY

j ou kenn i s v ennoo t • you r know ledge pa r tne r

Design Of An Automated

Class Attendance Recording System

by

Carel van Wyk

14543109

Project E448

Report submitted in partial fulfilment of the requirements ofthe module Project (E) 448 for the degree Baccalaureus inEngineering in the Department of Electrical and Electronic

Engineering at the University of Stellenbosch

Supervisor: H.R. Gerber

October 2008

Page 2: Wifi RFID Scanner

Acknowledgements

I would like to express my sincere gratitude towards the technical and teaching staff ofthe E&E Department of the Stellenbosch University Engineering faculty. Without theirprofessional and friendly assistance, this project would not have been realisable.I would like to thank the following people specifically:

• Mr H.R. Gerber

• Mr Ashley Cupido

• Mr Ralph A. Dreyer

• Mr Quintis Brandt

• Mr Wessel Croukamp

• Mr Charles S. Fredericks

• Mr Johan Arendse

i

Page 3: Wifi RFID Scanner

Declaration

By submitting this report electronically, I declare that the entirety of the work containedtherein is my own, original work, and that I am the owner of the copyright thereof (unlessto the extend explicitly otherwise stated) and that I have not previously in its entirety or inpart submitted it for obtaining any qualification.

Signature: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .C.P.J. van Wyk

Date: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Copyright c© 2008 Stellenbosch UniversityAll rights reserved.

ii

Page 4: Wifi RFID Scanner

Abstract

The goal of this project is to design and develop a fully functional automated class attendanceregister system, including hardware, firmware and application software. The project makesuse of RFID and Wifi technology, and basic research of RFID equipment was conducted. Itwas shown that an effective attendance register system can be implemented with the help ofnew and emerging technologies. ConnectOne’s iWifi module is used for Wifi communication.Python is used as far as possible in the development of application software. The applicationsoftware will be integrated with H.R. Gerber’s MyStudies application and server. This reportprovides background information and an introduction to the project, a system level designoverview and detailed design solutions. Tests and measurements are also provided in thefinal chapters.

iii

Page 5: Wifi RFID Scanner

Uittreksel

Die doel van hierdie projek is om ’n volledige klasbywonings-register stelsel te ontwerp en teimplimenteer. Dit sluit in die ontwerp van hardeware, ’middel’-ware en sagteware. Die pro-jek maak gebruik van ’RFID’ tegnologie en ’Wifi’ draadlose kommunikasie. Die werking van’RFID’ is oppervlakkig ondersoek. Daar word gewys dat ’n effektiewe klasbywonings-registerstelsel met behulp van nuwe en opkomende tegnologie ontwikkel kan word. ConnectOne se’iWifi’ module word gebruik vir draadlose kommunikasie. ’Python’ is so ver as moontlikgebruik in die skryf van sagteware. Die stelsel se sagteware sal met H.R. Gerber se ”MyS-tudies”program en bediener integreer. Hierdie verslag voorsien ’n agtergrond en inleiding totdie projek, so wel as ’n stelsel vlak oorsig en detail ontwerpsoplossings. Toetse en meetingsword ook voorsien in latere hoofstukke.

iv

Page 6: Wifi RFID Scanner

Contents

Declaration ii

Abstract iii

Uittreksel iv

Contents v

List of Figures viii

List of Tables ix

Nomenclature x

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Scope and Aims of Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Introduction to Other Chapters . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 System Analysis and Design 42.1 System and Design Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.1.1 Technologies Utilised . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Study of RFID technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2.1 General concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2.2 Antenna . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2.3 Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2.4 Stellenbosch University Implementation . . . . . . . . . . . . . . . . . 8

2.3 Design Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.4 Chapter 2 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3 Detail Hardware Design and Synthesis 103.1 User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.1.1 Student Identification Scanner . . . . . . . . . . . . . . . . . . . . . . 103.1.2 LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.1.3 Keypad or Touchpad . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

v

Page 7: Wifi RFID Scanner

CONTENTS vi

3.1.4 Interface PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.2 Processing and Communications Unit . . . . . . . . . . . . . . . . . . . . . . 14

3.2.1 Wireless Communications Module . . . . . . . . . . . . . . . . . . . . 143.2.2 Antenna Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.2.3 Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.2.4 Memory Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.2.5 Real Time Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.2.6 Bus Expander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.2.7 RS232 Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.2.8 USB Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.2.9 Processing and Communications PCB . . . . . . . . . . . . . . . . . . 20

3.3 Power Supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.3.1 Power Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.3.2 Voltage Rails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.3.3 Battery Charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243.3.4 Power Supply Control . . . . . . . . . . . . . . . . . . . . . . . . . . 253.3.5 Battery Level Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . 263.3.6 Power Supply PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.4 Chapter 3 conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4 Detail Software Design and Synthesis 274.1 Database Table Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4.1.1 Attendance Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274.1.2 ClassInstance Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274.1.3 Notes Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284.1.4 classtype Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

4.2 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284.3 LCD Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294.4 iWifi configuration website . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4.4.1 index.html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294.4.2 status.html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304.4.3 sync.html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4.5 Lecturer Administration GUI . . . . . . . . . . . . . . . . . . . . . . . . . . 304.6 Wifi to MyStudies interface Server . . . . . . . . . . . . . . . . . . . . . . . 304.7 Thin Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

5 Testing and Integration 325.1 Testing Hardware Components . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.1.1 Wifi Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325.1.2 RFID Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335.1.3 Printed Circuit Boards . . . . . . . . . . . . . . . . . . . . . . . . . . 335.1.4 Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345.1.5 LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345.1.6 Touchpad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355.1.7 Voltage Rails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

Page 8: Wifi RFID Scanner

CONTENTS vii

5.1.8 Battery Charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365.1.9 Other Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.2 Integration of Hardware Components . . . . . . . . . . . . . . . . . . . . . . 375.2.1 Processing and Communications Unit . . . . . . . . . . . . . . . . . . 375.2.2 User interface module . . . . . . . . . . . . . . . . . . . . . . . . . . 375.2.3 Power Supply module . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.3 Testing Software Components . . . . . . . . . . . . . . . . . . . . . . . . . . 375.4 Integration of Software Components . . . . . . . . . . . . . . . . . . . . . . . 38

6 Measurements and Results 396.1 Hardware Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

6.1.1 iWifi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396.1.2 RFID Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406.1.3 3.3V Voltage Rail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406.1.4 5V Voltage Rail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426.1.5 Battery Charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

6.2 Total Power Consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426.3 Software Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

7 Conclusion and Recommendations 447.1 Achievements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447.2 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Bibliography 46

A Project Planning Schedule 47

B Project Specification 48B.1 Functional Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

B.1.1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48B.1.2 Software and Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . 48

B.2 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49B.3 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

C Outcomes Compliance 51

D Circuit Diagrams and PCB layouts 53

E Photos and Screenshots 59

F Source Code 62F.1 Secure Interface Webserver Prototype . . . . . . . . . . . . . . . . . . . . . . 62F.2 iWifi configuration page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63F.3 RFID and iWifi Communcations Handling Module . . . . . . . . . . . . . . . 63

Page 9: Wifi RFID Scanner

List of Figures

2.1 Design decision flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Tree-level diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 Airgap Interface between card and scanner . . . . . . . . . . . . . . . . . . . . 8

3.1 Calibrated LCD resistor values. . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2 Li-Ion Output Voltage Depletion Chart[1] . . . . . . . . . . . . . . . . . . . . 22

6.1 Low-power operation regulated output with max and min input voltage. . . . . 416.2 Full-power operation regulated output with max and min input voltage. . . . . 41

D.1 User Interface Module Schematic . . . . . . . . . . . . . . . . . . . . . . . . . 54D.2 User Interface Module PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55D.3 Processing and Communications Unit Schematic . . . . . . . . . . . . . . . . . 56D.4 Processing and Communications Unit PCB . . . . . . . . . . . . . . . . . . . . 57D.5 Power Supply Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

E.1 Photo of user interface ontop of processing and communications unit. . . . . . 59E.2 Screenshot of wifi configuration page. . . . . . . . . . . . . . . . . . . . . . . . 60E.3 Screenshot of administration GUI. . . . . . . . . . . . . . . . . . . . . . . . . . 60E.4 Screenshot of secure interface webserver. . . . . . . . . . . . . . . . . . . . . . 61

viii

Page 10: Wifi RFID Scanner

List of Tables

3.1 Student Identification Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . 113.2 Wireless Communications Module Solutions . . . . . . . . . . . . . . . . . . . 153.3 Possible Microcontroller Solutions . . . . . . . . . . . . . . . . . . . . . . . . . 173.4 Rechargeable Battery Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.5 Estimated Current Consumption . . . . . . . . . . . . . . . . . . . . . . . . . 233.6 Available 3.3V Regulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.7 Available 5V Regulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

6.1 Measurements taken at different input voltage levels for low-power operation. . 406.2 Measurements taken at different input voltage levels for full-power operation. . 41

A.1 Project Planning Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

ix

Page 11: Wifi RFID Scanner

Nomenclature

Acronyms

WWW - World Wide WebWifi - 802.11b/g wireless network standardRFID - Radio-Frequency IdentificationUSB - Universal Serial BusLF - Low FrequencyUHF - Ultra High FrequencyISO - International Organization for StandardizationWORM - Write Once Read ManyLCD - Liquid Crystal DisplayLED - Light Emitting DiodeMCU - MicrocontrollerPCB - Printed Circuit BoardGSM - Global System for Mobile communicationsIO - Input/OutputGPIO - General Purpose Input/OutputGUI - Graphical User InterfaceUART - universal asynchronous receiver/transmitteEEPROM - Electrically Erasable Programmable Read-Only MemoryRAM - Random Access MemoryRTC - Real Time ClockDIP - Dual Inline PackageIC - Integrated CircuitLDO - Low Dropoutbps - Bits per second

x

Page 12: Wifi RFID Scanner

Chapter 1

Introduction

This chapter provides an introduction to this report, and provides background informationto the project. It includes a definition of the problem, and states the scope and aim of thisproject. An introduction to following chapters are provided at the end of this chapter.

1.1 Background

Up until now, class attendance records have been maintained manually by having studentssign next to their names on printed class lists during class. This method is outdated andtime-consuming, and may be improved by applying technology and designing an automatedelectronic class attendance recording system.

There are many cases in which it would be beneficial for the University of Stellenbosch tobe in possession of an automated class register system. Such a system would be of most valueto students, who may make use of system reports and statistics to assess their own approachto their studies, and be kept informed about course material covered in classes attended andmissed.

An automated attendance recording system would be advantageous to the lecturer, byproviding data on student attendances which may be correlated with a student’s academicprogress.

Attendance recording is an important aspect of tests and exams, where a record must bekept of students writing the paper.

Finally, such a system could provide evidence of a student’s class attendance habits incases where the University is accused by a student of providing insufficient guidance inlectures. In such cases, the University holds no liability if it can be showed that the studentwas regularly absent from class.

1.2 Problem Definition

This project is derived from a topic suggested by Mr. H.R. Gerber for the development of anautomated class attendance recording device. The device must positively identify studentsand provide reliable class attendance logs for the benefit of students, lecturers and the Uni-versity, as described in the previous section.

1

Page 13: Wifi RFID Scanner

CHAPTER 1. INTRODUCTION 2

Attendance logs must be stored on a centralised database in order to generate reports andstatistics. Therefore, the device must be able to communicate with a central database server.

Students should be able to access information and personalized reports generated by thesystem for effective self-assessment and keeping up to date. Lecturers should be able to viewattendance information and be able to add information to the system.

The system should also provide appropriate administration interfaces for administering therecording devices and system parameters.

1.3 Scope and Aims of Project

As part of the original project proposal, it was specified that the student identification devicemake use of RFID scanner technology, and that the device should be able to communicatevia wireless with the central database server. As such, using an RFID scanner and wirelesscommunications is part of the project scope, however alternatives to RFID and wireless com-munication is discussed in Chapter 3 section 3.1.1 and 3.2.1 of this report.

The aims of this project are, in order:

• Provide a mobile RFID scanner device capable of scanning student cards with embeddedRFID chips and processing the data on the card.

• Provide a software suite to log information about scanned cards against a database andprovide detailed statistics and feedback about attended and missed classes to studentsand the lecturer. The software suite must include sufficient administration capabilities.

• Provide a wireless interface between the scanner and database server.

• Maximize battery life of the mobile scanner device and provide a simple USB-chargerinterface.

The scope of this project includes designing and assembling the mobile, Wifi enabled,student card scanning device, designing and writing the firmware required for operating thedevice, and designing and writing a full software suite for managing multiple scanning de-vices and providing detailed feedback to students and lecturers as described in the projectspecification in appendix B. The software suite must be integrated with H.R. Gerber’s MyS-tudies framework as far as possible. The scope of this project does not include an in-depththeoretical study on a particular subject.

Page 14: Wifi RFID Scanner

CHAPTER 1. INTRODUCTION 3

1.4 Introduction to Other Chapters

Chapter 2 specifies the design process used, and states design limitations. It includes an

analysis of the problem, the design process and a system level analysis.

Chapter 3 and 4 contains detailed design considerations for all leaf-node components of this

project, as defined in chapter 2

Chapter 5 contains testing and integration information.

Chapter 6 contains recommendations and a conclusion to the project.

Page 15: Wifi RFID Scanner

Chapter 2

System Analysis and Design

The design approach used in this project involves breaking the main system up into subsys-tems called ’branches’. Each subsystem branch may be broken up further into subbranches,and subbranches may again be broken up into ’leaf-nodes’, which represent the lowest levelof subsystems. This method forms a tree-like structure overview of the system as representedin figure 2.2. In this way, system level analysis and design is done by looking at the over-laying structure of the system, while detail design is limited to the leaf nodes. At the lowestlevel, components and design methods are chosen based on functional and non-functionalrequirements and design constraints.

Once the lowest levels of sub-systems are designed, they are integrated and tested in a’Bottom-up’ approach until all subsystem branches are combined into the all encompassingtop-level system. In essence, a ’Top-Down’ analysis and design method with ’Bottom-Up’integration and testing process is used. Figure 2.1 is a flow-chart representation specifyingthe design approach used for this project, with inherent awareness of design constraints andlimitations.

Focusing on designing subsystems provides an advantage in that once one sub-system’sdesign is completed, it may be sent in for manufacturing while design of the other subsystemscan continue in parallel with manufacturing, which saves time. If one subsystem fails, it canbe redesigned without influencing other sub-systems, and in this way valuable time is saved.

4

Page 16: Wifi RFID Scanner

CHAPTER 2. SYSTEM ANALYSIS AND DESIGN 5

S T A R T

C a n S y s t e m b e b r o k e n u p i n t o s u b s y s t e m s ?

Iden t i f y f unc t i ona l r e q u i r e m e n t s .

C r e a t e n e w b r a n c h .

Y e s

C r e a t e L e a f - N o d e . F i n d s u i t a b l e c o m p o n e n t

b a s e d o n f u n c t i o n a l r e q u i r e m e n t s .

N o

D o e s t h e c o m p o n e n t a d h e r e t o n o n - f u n c t i o n a l r e q u i r e m e n t s

a n d d e s i g n c o n s t r a i n t s ?

U s e C o m p o n e n t

Y e s

N o

Figure 2.1: Design decision flow chart

2.1 System and Design Overview

Before subsystems can be identified, the functional requirements for this project must beidentified first. The requirements have been derived from the original project proposal byH.R. Gerber and are available in appendix B. Analysing the problem as defined in 1.2 thenbecomes simple. By examining the project requirements, a tree-level diagram of subsystemsis created which represents a full system level overview.

The tree diagram in Figure 2.2 represents the system level analysis of the problemdefined in 1.2. The three main parts of the system is the hardware, firmware and applicationsoftware components. Hardware can be broken up into three main modules: A power supply,a processing and communications module and a user interface. The firmware will control thehardware and manage the interfaces between the hardware, application software and the user.The application software component can also be broken up into three logical subsections: Thedatabase, GUIs and wireless device administration and synchronisation. The bottom-levelor leaf-nodes are discussed in chapters 3 and 4.

2.1.1 Technologies Utilised

RFID

As per the project specification, an RFID scanner is used for student identification. A briefstudy of RFID is included in the next section.

Page 17: Wifi RFID Scanner

CHAPTER 2. SYSTEM ANALYSIS AND DESIGN 6

Figure 2.2: Tree-level diagram

802.11b/g Wifi

The mobile scanner device will use an 802.11b/g Wifi module to communicate with theStellenbosch University campus wide wireless network, ’Maties Wifi’.

Capacitive Sensors

The scanner device will use a capacitive sensor array for user input as opposed to a keypad.Capacitive sensor technology is discussed further in section 3.1.3.

MyStudies

MyStudies is a framework for the management of students, courses, classes and work. Itconsists of a server written in python with a SOAP interface and mysql database back-end,that serves wxpython based GUI clients. This project’s application software will be integratedwith the MyStudies framework and will rely on the MyStudies server for data storage andmanagement.

Page 18: Wifi RFID Scanner

CHAPTER 2. SYSTEM ANALYSIS AND DESIGN 7

SOAP

SOAP is a protocol that allows exchange of XML-based messages over HTTP or HTTPS. Itis the main transport method of data used in the MyStudies framework and this project.

Python

Python1 is a highly versatile and dynamic interpreted programming language. It will beused as the basis for most application software in this project with the exception of devicefirmware and configuration webpages. Python really is a remarkable language that providespowerful libraries, and allows for rapid prototyping and development. VisualWx was usedfor making WXPython based GUIs.

Twisted

Twisted2 is an event-driven networking engine programmed in Python. Twisted.Web is usedas webserver instead of apache to allow direct integration of the python based web servercode and other python based application software code. Data is transferred from the wirelessscanner device to a Twisted.Web server webpage via HTTP POST. The data is parsed andthen submitted to the MyStudies server via SOAP.

MySQL Database

MySQL is a relational database that is used by the MyStudies framework. The MySQLdatabase will be used for all data storage in this project.

2.2 Study of RFID technology

As RFID is an integral part of this project, the literature study focuses on a white paper onRFID technology released by BITKOM[2], German Association for Information Technology,Telecommunications and New Media.

2.2.1 General concept

RFID, or Radio Frequency Identification, relies on two main components: The RFID scanneror reader and the RFID tag or transponder. For the one to communicate with the other,both must make use of the same carrier frequency, with RFID frequencies currently rangingfrom 125 kHz in the LF range to 5.8 Ghz in the UHF range[2]. Additionally, a secured systemmay make use of cryptographic functions for one-way or two-way identification.

1www.python.org2http://twistedmatrix.com/

Page 19: Wifi RFID Scanner

CHAPTER 2. SYSTEM ANALYSIS AND DESIGN 8

2.2.2 Antenna

According to BITKOM[2], the typical read-range of ISO 14443 based cards (as used byStellenbosch University) are 7-15cm, even though tests mentioned elsewhere in this reportshows proximity distances of 1.6cm or less for this report’s specific application. In shortread-distance applications like this, the tag is within the near-field of the reader antenna’selectromagnetic wave pattern when it is scanned. The card’s antenna is in the form of acoil or inductive loops that run around the edge of the card, and the card’s RFID microchipis powered by energy transferred from the reader to the card antenna’s inductive loops viamagnetic coupling[3].

2.2.3 Modulation

Figure 2.3: Airgap Interface between card and scanner

In essence, the connection between the reader and card is represented by an airgap in-terface which is the distance the card is held from the scanner when it is being read. The’airgap interface’ is represented by various layers[2]:

• On the physical layer, the card and reader are linked by an electromagnetic wave thatcouples the reader and card antennas at a specific carrier frequency. This is representedin figure 2.3.

• To enable a layer of communication, information must be modulated on the wave.

• On the logical layer, the structure of commands and data are specified by ISO or otherproprietary standards. It is important that all layers of the air interface adhere toglobal standards in order to ensure compatibility with other RFID systems worldwide.

2.2.4 Stellenbosch University Implementation

The RFID tags embedded in Stellenbosch University student cards are Write Once ReadMany (or WORM) modules, with 26 bytes of user data, including 8 bytes representing thestudent’s unique student number and 4 bytes representing the year of issue. These cardsoperate at 13.56MHz and makes use of the ISO 14443 based, MIFARE secure encoding

Page 20: Wifi RFID Scanner

CHAPTER 2. SYSTEM ANALYSIS AND DESIGN 9

standard, which has been shown by Nohl and Plotz[4] to have critical security vulnerabilities.The RFID reader units used by the University are Model 718-10 scanners from GSC systems.

2.3 Design Constraints

One of the most important factors in deciding on a design process is to be fully aware of designconstraints and limitations. The chosen design process for this project aims to minimise theimpact of design constraints, and to defer design limitation resolution to the leaf-nodes (orbottom design layers). This project was subject to several key design limitations which islisted here:

Budget: With a limited project budget, it is not possible to simply select the first and bestoption that presents itself. Care must be taken to minimize component and manufac-turing costs and sometimes creative solutions need to be found for problems that maybe solved by more expensive components, but that will overshoot the budget too far.

Time: With a timeframe of 4 to 5 months to complete literature studies, hardware and soft-ware design and synthesis, obtain all components and write a project report, the designprocess must be optimized to maximize productive time. Design processes may takeplace in parallel if properly coordinated, for example: software development may takeplace while hardware components are being manufactured. Readily available compo-nents must be selected as far as possible and critical non-readily available componentsmust be available in time.

Limited availability of passive components: Even though surface-mount resistors, ca-pacitors or inductors may work better in some situations, these components are notreadily available in faculty stores. As these components are purchased in reels of thou-sands and typically only one or two of specific values are required at a time, it is notfeasible to purchase such components on the project’s budget. Other examples of lim-ited components include basic elements such as screw terminals, spacers, screws andstand-offs.

Limited manufacturing capabilities: In some cases, the design process has to rely onmanufacturing facilities available at the Electronic Engineering faculty, as professionalmanufacturing would overshoot the budget too far. In some cases, this limits componentselection and other design aspects.

2.4 Chapter 2 Conclusion

A system level design overview of the project can easily be seen in figure 2.2. As mentionedin 2.1.1, this project implements several cutting edge and exciting technologies, both interms of hardware and software, to solve design problems.

Page 21: Wifi RFID Scanner

Chapter 3

Detail Hardware Design and Synthesis

As discussed in section 2.1, the leaf-nodes of the hardware branch of the design tree areanalysed in this chapter. The design process used is specified in chapter 2 and is representedby figure 2.1. From the tree-level diagram in figure 2.2 it can be seen that the hardwarecomponents of the project can be broken up into three main sub-systems: The power supply,processing and communications unit and user interface.

3.1 User Interface

3.1.1 Student Identification Scanner

The project specification requires RFID to be used for student identification, and the RFIDscanner must be provided by the University’s access control department since it is preconfig-ured with encryption keys for Stellenbosch University student cards. Therefore, there were nodesign choices possible for this hardware component, although alternatives are listed below.

Student cards are the primary method of student identification on campus. From the startof 2007, all Stellenbosch University student cards are equipped with an RFID chip that can beread by holding it briefly against a configured proximity sensor. Due to its ease of use, RFIDtechnology is perfectly suited for use in an automated class attendance recording system.The advantages of using RFID are speed (cards can even be scanned through wallets), andavailability (students should have their cards available at all times). The disadvantages ofRFID are that students could lose their student cards, and that students could ’lend’ theircards to their friends to have it scanned for them. In the former case, a class list may still bemade available for individuals without cards and the latter case is outside the scope of thisproject.

Table 3.1 represents a list of possible solutions to the problem of student identification.For this project, the GSC systems Model 718-10 Mifare RFID scanner is used.

Requirements

• Minimum 5V voltage rail.

• Approximately 120mA @ 5V according to datasheet.

10

Page 22: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 11

• RS232 receiver @ 19200 bps baudrate

Name Description Advantages DisadvantagesRFID RFID chips embedded in all stu-

dent cards.Fast, Efficient,Availability

Card may begiven to friendfor scanning.

Biometrics Finger print or retina scanner. Absolute posi-tive identifica-tion

Very expensive,Slow

Magstripe The magnetic strip on all studentcards.

Availability Slow, Wear andTear, Old tech-nology, Cardmay be givento friend forscanning

Table 3.1: Student Identification Solutions

3.1.2 LCD

A standard 16-pin KS0066U or equivalent alphanumeric LCD is used for user output. As withmost components, the primary design constraint for this component is cost, and the secondarydesign constraint is size. A standard 20x2 characters LCD was chosen for maximising outputspace while minimising cost and physical dimensions.

For this project the model 202A-FC-BC-3LP from Displaytech was ordered from RS SouthAfrica. This specific model features black on white text with a white LED backlight for amore modern and professional look than a yellow on green LCD. The LCD will be operatedin 8-bit mode, as opposed to 4-bit mode, to increase display speed. Two control lines arealso required.

The LCD requires three resistors: Two determine contrast and one determines backlightbrightness. The method for choosing these resistors was by first connecting the correspondingresistors pins to variable resistors and tuning the resistor parameters until optimal contrastand brightness levels was found.

Figure 3.1 represents the calibrated resistor configuration for determining LCD contrastand brighness.

Requirements

• Minimum 5V rail.

• Approximately 10mA @ 5V operating current + 20mA @ 5V backlight current.

• 8+2 General Purpose I/O lines directly to the MCU

Page 23: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 12

Figure 3.1: Calibrated LCD resistor values.

3.1.3 Keypad or Touchpad

For user input, the conventional choice would have been a matrix keypad, but it was decidedthat a more exciting and creative approach would be appropriate for this project, since othercentral components used in this design (such as the RFID scanner and Wifi module men-tioned later) are also examples of new and interesting technologies.

The ISQ221 proximity sensor chip from Paarl based company, Azoteq, provides a capac-itive sensor array with binary outputs. This means that a custom touchpad can easily bemanufactured by etching conductive pads and tracks on a standard PCB. A touchpad alsooffers several advantages over a traditional keypad:

• There are no mechanical components that can wear out over time.

• Buttons can take any shape, form or layout. This allows for custom and creativetouchpad designs.

• When a button pad is touched, a binary 1 is immediately output on the correspondingoutput channel, as opposed to a matrix keypad that requires scanning which takesseveral clock cycles.

• The IQS221 is designed and supported locally in Paarl, less than 40km from Stellen-bosch.

See below for a basic explanation of capacitive sensors. A photograph of the user inter-face’s custom touchpad is available in appendix E, as figure E.1.

Capacitive Sensors

LionPrecision[5] describes capacitive sensors as follows:

Page 24: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 13

’Capacitive sensors use the electrical property of capacitance to make measure-ments. Capacitance is a property that exists between any two conductive surfaceswithin some reasonable proximity. A change in the distance between the surfaceschanges the capacitance. It is this change of capacitance that capacitive sensorsuse to indicate changes in position of a target.’

For this project, the IQS221 evaluation module, model AZP075A05-2008, was obtainedfrom Azoteq.

Requirements

• Minimum 3.3V voltage rail

• 190uA operating current @ 3.3V

• 8 digital inputs, each corresponding to one touch pad. Connected either directly to theMCU or to a bus expander.

3.1.4 Interface PCB

The PCB and schematic for the user interface module is available in appendix D. There isno critical design constraints involved in the user interface’s PCB design. The only notableaspect of this PCB’s design is the custom touchpad area, as discussed in section 3.1.3. Oth-erwise, some care was taken to ensure proper mounting of the LCD, touchpad controllermodule, RFID scanner and the other two project PCBs (Processing and communicationsmodule and power supply module).

Page 25: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 14

3.2 Processing and Communications Unit

The processing and communications unit is the core of the hardware device sub-systemsthat the other sub-systems connect to. It handles processing and storage of data, provideswireless communications and provides the appropriate interfaces for the power supply anduser interface module to connect to. The most integral leaf-node component (As definedin chapter 2) of this subsystem is the wireless communications module. All other leaf-nodedesign choices for this sub-system must be compatible with the choice of wireless module.

3.2.1 Wireless Communications Module

The most integral design aspect of the processing and communications unit is the wirelesscommunications module, and therefore much care was taken in finding a suitable module.Table 3.2 represents several possible solutions to this problem1:

Protocol Selection

There are three main wireless protocols represented in the table 3.2 table: Zigbee, Bluetoothand Wifi. The main design consideration for this component is compatibility with existingwireless infrastructure in order to maximise operating range and minimise additional costsand design, such as custom base station hardware. Stellenbosch University boasts a campus-wide Wifi network, ’MatiesWifi’. Interoperability with this network will ensure wirelessconnectivity across campus and in all classrooms, which makes it ideal for the objectives ofthis project. Therefore, the wireless communications module choice is narrowed down to the802.11b/g Wifi modules.

Module Selection

From the advantages and disadvantages columns in the table 3.2, it was concluded that themost attractive option for this application is the Mini Socket iWifi module from ConnectOne.It also happens to be least expensive of the Wifi modules (R470 at time of purchase), and isonly slightly more expensive than a Bluetooth or Zigbee solution.

The iWifi is an impressive piece of technology that lives up to all expectations. Releasedin July 2008, it was very fortunate that one could be obtained in time for use in this project.Core features include ease of use, an embedded web server, an AT command set via UARTand support for the following protocols[6]:

Internet Protocols: ARP, ICMP, IP, UDP, TCP, DHCP, DNS, NTP, SMTP, POP3, MIME,HTTP, FTP and TELNET

Security Protocols: SSL3/TLS1, HTTPS, FTPS, RSA, AES-128/256, 3DES, RC-4, SHA-1, MD-5, WEP, WPA and WPA2

The author can strongly recommend this module for use in future projects that require Wificommunication capabilities.

1Dollar to Rand conversion done using R8 per $1

Page 26: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 15

Name Description Advantages Disadvantages PriceJennicJN5121

(Zigbee802.15.4) Used forwireless personalarea networks(WPANs). Simplerthan Bluetooth.

Low Power consump-tion, Compact, Sim-ple, Combined wire-less module and MCU

Low data rate, ShortRange (20m indoors),Requires base stationhardware

R260+R800Pro-gram-mer

Bluetooth (802.15.1) Usedfor Wireless Per-sonal Area Net-works.

Low power consump-tion, Compact, Uni-versal hardware (lap-tops, PCs), AT com-mand set interface

Low data rate, Shortrange

R460

GSM (GSM 07.07)Global System forMobile communi-cations. Used fordata transmissionby mobile phones.

Universal hardware(mobile phones,laptops, PCs), ATcommand set inter-face, Higher Datarate,Very long range

High power consump-tion, Data transmis-sion not free

R160toR930

RabbitCoreRCM5400W

(Wifi 802.11b/g)Wifi enabled MCUwith 39 GPIO and512K Flash mem-ory

Universal hardware(laptops, PCs, APs),High datarate, Pro-grammed over serial,Standard externalantenna connector,long range

Relatively high powerconsumption, Expen-sive

R790

EzurioWISMC01

(Wifi 802.11b/g)Wifi enabled MCUwith 12 GPIO, 210bit A/Ds andUART

Universal Hardware(laptops, PCs, APs),High datarate, Pro-grammed over serial,Relatively Low powerconsumption

No external antenna,Shorter range thanother 802.11 modules,Expensive

R1045

ConnetBlueSPA311G

(Wifi 802.11b/g)Wifi module onlywith AT command-set. Requires con-trolling MCU.

Universal Hardware(laptops, PCs, APs),High datarate, ATover UART interface,External antenna con-nector, Long range,Compact

Very expensive R1450

ConnectOneMini SocketiWifi

(Wifi 802.11b/g)Wifi module onlywith AT command-set and onboardweb server. Re-quires controllingMCU.

Universal Hardware(laptops, PCs, APs),High datarate, ATover UART interface,External antenna con-nector, Long range,Compact

Relatively high powerconsumption (but lessthan some other wifimodules)

R470

Table 3.2: Wireless Communications Module Solutions

Page 27: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 16

iWifi Requirements

• Minimum 3.3V (Maximum 3.6V) voltage rail

• 250 mA @ 3.3V for transmit, 8 mA @ 3.3V in power save mode

• One UART channel

• Any standard reverse polarity SMA connector dipole antenna

3.2.2 Antenna Selection

Any standard reverse polarity SMA connector 2.4 GHz antenna may be used with this mod-ule. A 2.5dBi dipole antenna is recommended by ConnectOne, and one was ordered alongwith the iWifi module from Mouser.com. Larger dipole antenna’s up to 9dBi is availablefrom Scoop Distributions2 in Cape Town. Range tests are available in Chapter 6.

2www.scoop.co.za

Page 28: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 17

3.2.3 Microcontroller

Choosing a microcontroller is not a critical design consideration of this project. Any genericMCU with enough General Purpose IO pins, UART channels, an I2C bus, and flash memorywill be sufficient. As with all leaf-nodes, non-functional requirements carry the most weightin choosing the component, and therefore availability of the MCU chip and MCU programmerplayed the most important role in this case. Table 3.3 presents the three possible MCU’sthat was readily available along with their programmers.

Name Description Advantages DisadvantagesRenesasR8C/27

32 pin, 20Mhz general pur-pose MCU used in DesignE314.

Immediately avail-able, 32 pin wideDIP socket.

No Built-in RS232

RenesasR8C/2B

62 pin general purposeMCU. Advanced version ofthe R8C/27

Faster thanR8C/27, Moreflash memorySurface

mount LQFP64,Not immediatelyavailable, Nobuilt-in RS232

MicrochipPIC18F2550

28 pin general purposeMCU.

Built-in RS232 in-terface

Unfamiliar plat-form

Table 3.3: Possible Microcontroller Solutions

There are no defining characteristics that put one MCU above the other. Thereforethe R8C/27 which was available immediately along with its programmer was chosen, eventhough either of the other two chips would have been adequate. Furthermore, the R8C/27 isinexpensive, and offers a familiar embedded development platform and requires little power.

Operating Voltage

One important design consideration regarding the microcontroller is its operating voltage,as this will affect interfacing with components that operate at voltage levels different fromthe MCU. Since the wireless communication module can handle an absolute maximum of3.6V, and is considered one of the integral components of this project, it was decided thatthe MCU operate at the same voltage as the wireless module at 3.3V to eliminate the needfor level translators.

Requirements

• 3.3V to 5V input voltage

• 32.768 kHz crystal

• Approximately 10mA @ 3.3V

Page 29: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 18

3.2.4 Memory Module

The memory module must provide non-volatile data storage for when the scanning device isout of range or in case of power loss. Any flash memory module with at least 8 kilobytesof RAM will be sufficient for this project’s purposes. An M24C64 EEPROM module with8 kilobytes of memory and I2C interface was chosen as it was immediately available, has asmall footprint and is simple to program. The memory map of the EEPROM module for theWifi RFID scanner device is available in chapter 4.

Requirements

• 3.3V to 5V input voltage

• I2C interface

• 5uA in standby mode, 2-5mA in read/write mode

3.2.5 Real Time Clock

A real time clock component will keep track of time, even if the device loses power, by meansof a separate battery backup. As motivated in 3.2.9, it was decided that the processing andcommunications module PCB consist only of through-hole components. At time of writing,there is only one I2C real time clock available from RS South Africa3 in 8 pin DIP format,the DS1307+ from Maxim-IC4, and it was chosen for this project. Any I2C RTC would havebeen sufficient for this design. The DS1307 provides an ultra-low battery backup mode at500nA with a 3V battery backup power supply, while the standard operating voltage forreads and writes are 5V.

Requirements

• 32.768 kHz crystal

• 5V Input

• 1.5mA supply current @ 5V

• I2C interface

• 3V battery + battery clip

3.2.6 Bus Expander

A bus expander interface is useful for key- or touchpad input. It frees up valuable generalpurpose IO pins on the microcontroller and also provides suitable interrupt functionality. Forinstance, a bus expander can generate an interrupt if any of its input pins change state, sothat the microcontroller is notified of a key change event, and need to poll the bus expander

3www.rssouthafrica.com4www.maxim-ic.com

Page 30: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 19

only once in order to determine which key was pressed. This method is opposed to connectinga key- or touchpad directly to the MCU where pins would have to be polled continuously.

Since there are already two other components that make use of the I2C bus, the busexpander will also make use of I2C. Any general purpose bus expander with 8 or more inputpins, an I2C interface and an interrupt output pin is suitable for this project. The MCP23017was chosen since it meets all these conditions and was instantly available.

Requirements

• 3.3V to 5V operating voltage

• 1mA operating current @ 3.3V

• I2C interface

• One interrupt line

3.2.7 RS232 Interface

The RFID scanner outputs scanned student card data in RS232 format. The renesas R8C/27microcontroler chosen for this project does not include a built-in RS232 interface. WhereUART represents a logical 1 with Vhigh and a logical 0 with Vlow, RS232 represents a logical 1with -12V and a logical 0 with +12V[7]. The R8C is unable to generate these output levels,so an RS232 interface chip is required. Since it was decided in 3.2.3 that the microcontrolleroperate at 3.3V, the RS232 interface chip must also operate at 3.3V.

Two pin-identical DIP18 chips were obtained: The LTC1385 from Linear Technologies5

and the MAX3222CPN+ from Maxim-IC6. These two chips are identical in almost all regards,both are low-power chips, both operate at 3.3V and provide two RS232 to UART interfacechannels, and they have identical pin-outs. There are only two differences. The first beingthat the LTC1385 has electrostatic discharge protection while the MAX3222 does not, andthe second being that the LTC1385 actually supports EIA/TIA-562 (which is the low-voltageversion of RS232), while the MAX3222 supports true RS232. Both are compatible with theRFID scanner.

Since both chips were already available, the LTC1385 was chosen, although it could beswapped with the MAX3222 without any changes in PCB layout or component design.

Requirements

• 3.3V input

• 200uA @ 3.3V input operating current

• One UART channel

5linear.com6maxim-ic.com

Page 31: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 20

3.2.8 USB Communication

It was decided that USB communication between the Wifi scanner device and a host device isan unnecessary feature. Even though it would be trivial to implement, USB communicationrequires additional UART to USB conversion hardware and will only increase costs. Imple-menting wired communication on a wireless device defeats the purpose of using a wirelesscommunication module.

If serial communication with a host device is required, it can easily be implemented byusing the unused secondary channel on the RS232 interface chip.

3.2.9 Processing and Communications PCB

The PCB and schematic for this module is available in appendix D. The processing andcommunications PCB was the first to be completed, and at the time of layout there wasstill uncertainty regarding the level of detail available in the manufacturing process madeavailable at the electronic engineering faculty. As such it was decided that components forthis PCB be limited to through-hole components and that surface-mount components beeliminated. This also had the advantage of a simplified PCB design and use of more robustcomponents.

Page 32: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 21

3.3 Power Supply

Design of the wireless scanner’s power supply is dependant on the requirements of all otherchosen hardware components. The DC voltage regulators are dependant on the requirementsof the other components used in hardware design, and the DC voltage source is dependanton the power required by the voltage regulators.

3.3.1 Power Source

The project specification indicates that the scanner device must be mobile; therefore thepower source must be a battery. The battery must adhere to the following requirements:

• It must be rechargeable.

• It must have large capacity.

• It must be compact with an optimal energy density ratio.

• It must have a long lifespan.

• It must be able to deliver enough peak-current.

Table 3.4 lists possible battery solutions:

Type Nominal Voltage[V] Energy Density [Wh/kg] Lifespan [years]Alkaline 1.5 85 <5Ni-Cad 1.2 60NiMH 1.2 80Li-Ion 3.6 160 2-3Li-Poly 3.7 130-200 2-3

Table 3.4: Rechargeable Battery Types

All batteries in the table are capable of delivering sufficient peak current for this project’sapplication. From table 3.4, it was decided that a Li-ion cell be used, as it features a highenergy density ratio and is readily available. Figure 3.2 provides a graph of estimated batteryterminal voltage in terms battery depletion.

Two 2400mAh TrustFire Protected 18650 Lithium-Ion Batteries were ordered from DealEx-treme7 at R45 per cell8. This battery received overwhelmingly positive reviews and includes aprotective embedded PCB for short-circuit, overcharge and discharge protection. The authorcan strongly recommend these cells for any mobile application.

7www.dealextreme.com, stock number sku.57768At an exchange rate of R8 per 1 USD

Page 33: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 22

Figure 3.2: Li-Ion Output Voltage Depletion Chart[1]

3.3.2 Voltage Rails

Inspection of the other leaf-nodes of the hardware design branch, as indicated in figure 2.2,indicates that two voltage rails are required: 3.3V and 5V. A rough estimation of the powerconsumption for each rail must be made in order to determine the required power rating ofeach rail’s regulator.

Assessment of the previous sections in this chapter shows the following components foreach rail, with their estimated peak current consumption:

3.3V Rail: Touchpad (190uA), Wifi (250mA), MCU (10mA), memory (5mA), bus expander(1mA), RS232 (200uA)

5V Rail: RFID scanner (120mA), LCD (30mA), RTC (1.5mA)

As shown in table 3.5, the 3.3V regulator must be able to source a minimum of 293mApeak current, while the 5V regulator must be able to source at least 167mA. The 5V regulatormust also include a disable/shutdown option, to provide an enhanced sleep mode for thedevice

The requirements for both regulators are:

• It must be ultra-efficient.

Page 34: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 23

3.3V Rail 5V RailTotal Estimated Peak Current Consumption 266mA 152mA10% Safety Factor 26.6mA 15.2mA

293mA 167mA

Table 3.5: Estimated Current Consumption

• It must require minimum external components.

• It must be as stable as possible.

• It must have an enable/shutdown control pin.

• It must be low-dropout (LDO).

3.3V Rail

Since a 3.6V Li-ion voltage source is used, the 3.3V regulator must be a step-down DC-DCconverter. Table 3.6 is a table of 3.3V step-down DC-DC converters that was acquired.

Name Description MaximumOutputCurrent

Efficiency InputVoltage

Texas In-strumentsTPS62260

2.25Mhz high efficiency syn-chronous step-down converterwith low dropout. (Adjustableversion)

600mA 88 to 94% 2V-6V

Texas In-strumentsTPS62056

High efficiency synchronous step-down converter with low dropoutand low noise operation (Fixed3.3V version)

800mA 90 to 9% 2.7V-10V

LinearTech-nologiesLTC1879

High Efficiency Synchronous buck(step-down) converter with lowdropout. (Adjustable version)

1200mA 93 to 95% 2.65V-10V

Table 3.6: Available 3.3V Regulators

The Texas Instruments TPS62056 was chosen for the following reasons:

• It provides the highest efficiency.

• It is a fixed output voltage version which means less external components.

• It has a wide input voltage range for use with one or two Li-Ion cells.

• It can provide more than enough output current.

Page 35: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 24

• It is a low noise component.

As the TPS62056 is a fixed 3.3V chip, no calculation of external components was required.

5V Rail

Since a 3.6V Li-ion voltage source is used, while the 5V regulator must be a step-up DC-DCconverter.

Table 3.7 is a table of 5V step-up DC-DC converters that was acquired.

Name Description MaximumOutputCurrent

Efficiency MinimumInputVoltage

Texas In-strumentsTPS61120

High Efficiency Synchronousboost (step-up) converter. Ad-justable version.

600mA 94 to 95% 1.8V

Maxim-ICMAX682

Compact charge-pump (step-up)regulator with minimal externalcomponents. Fixed 5V version.

250mA 70 to 71% 2.7V

LinearTech-nologiesLTC1306

High Efficiency synchronousboost (step-up) regulator. Ad-justable version

1000mA 83 to 87% 2.5V

Table 3.7: Available 5V Regulators

The TPS61120 was chosen because it provides the highest conversion efficiency and suf-ficient output current. It is an adjustable version of the component range and thereforerequires more external components and it has an enable/shutdown pin for power save mode.

As the TPS61120 is an adjustable voltage version chip, the following external componentcalculation was made: From the datasheet:

R3 = R6 × ( VO

VFB− 1)

VFB = 0.5V, VO = 5V. The suggested range for R6 is 180kΩ.

Choose R6 = 200kΩ ,then R3 = 200000 × ( 50.5−1

) = 1.8MΩ

3.3.3 Battery Charger

Much research and searching was done for an appropriate USB battery charger chip for thisproject. Initially, the perfect chip was found in terms of total power management. TheLinear Technologies9 LTC 3567 is a high efficiency, next generation USB power manager plus

9www.linear.com

Page 36: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 25

integrated 1A 3.3V buck-boost (step-up/step-down) regulator for utilizing the full capacityof the battery. The LTC 3567 includes control via an I2C interface. Extensive searchingyielded no alternatives that came close to the functionality of the LTC 3567’s model range.This IC is perfect for this project’s application in all regards, however it was not chosen dueto two design constraints:

• The component footprint is too small and sophisticated for PCB manufacturing at theengineering faculty. This component requires a professionally manufactured PCB.

• The component requires several external passive components that are not available atthe engineering faculty. As components cannot be purchased in single unit quantities, itwas not feasible to purchase the required external components on the project’s budget.

The author can highly recommend this chip if the necessary equipment and components areavailable.

As an alternative, the MAX1811 from Maxim-IC10 was chosen as it was the only USBcharger IC that could be found in a more convenient chip packaging, and that would besufficient for use in this project. The MAX1811 turned out to be a very convenient andeasy to use, and the author can recommend it for any application that requires a simple andeffective USB Li-Ion battery charger solution.

MAX1811

The MAX1811 allows configuration of input charge current, output charge voltage, chargeenable/disable and a charge active output pin for control. It also provides preconditioningthat soft-starts near-dead cells before charging, and other safety features. The MAX1811supports the USB 500mA mode for maximum charge current.

3.3.4 Power Supply Control

Power Save Mode

Since only the RFID scanner, LCD and Real Time Clock (with battery backup) is connectedto the 5V rail, the wireless scanner device can allow the 5V regulator to be disabled whenentering a power saving sleep mode. The device can be awakened from sleep by pushing abutton on the touchpad which will remain active in sleep mode. This functionality requiresthe 5V regulator to have an enabled/shutdown pin connected to a microcontroller output.

Charge Control

As the Max 1811 battery charger chip does not include an internal safety timer, the mi-crocontroller must continuously monitor and regulate battery charging. The microcontrollermust provide safety timer functionality and disable charging once the battery has chargedfor 5 hours.

10www.maxim-ic.com

Page 37: Wifi RFID Scanner

CHAPTER 3. DETAIL HARDWARE DESIGN AND SYNTHESIS 26

3.3.5 Battery Level Monitor

The battery’s voltage level will be monitored continuously by connecting the battery voltageterminals to a microcontroller’s analog-to-digital input through a high-impedance voltagedivider resistor pair. Battery status will be calibrated in the device’s firmware and by exam-ining figure 3.2 (battery discharge level curve). From the discharge curve, it can be seen thatthe voltage range to monitor is between 2.8V and 4.2V. Since the MCU requires a minimumof 3.3V, the voltage range to monitor changes to 3.3V to 4.2V, since a voltage below 3.3V willcause system failure. The MCU’s reference voltage is 3.3V. The calculation for determiningresistor pair values:

A maximum leakage current of 50uA is defined and Vbat(max) is 4.2V.

Then Ileak(max) >Vbat(max)

(R1+R2)

R1 + R2 > 4.210

× 10−6 > 84kΩThe voltage input range to the MCU’s A/D pin must be 0V to 3V.Thus: Va/d(max) = R1

(R1+R2)× Vbat(max) = 3V

1 + R2

R1=

Vbat(max)

Va/d(max)= 4.1

3R2

R1= 0.3666 , R2 = 0.3666 × R1

Choose: R2 = 33kΩ , then R1 = 90kΩ and R1 + R2 = 123kΩ > 84kΩ

3.3.6 Power Supply PCB

The PCB and schematic for the user interface module is available in appendix D. The crit-ical power supply chips are all surface mount components, and most specify that externalcomponents be placed as close as possible to the chip’s pins, therefore the PCB was mostlydesigned for surface mount components. Additionally, connected ground planes must be usedas far as possible to reduce noise and avoid instability.

The manufactured PCB showed that PCB’s manufactured at the engineering faculty isable to support components with 0.27mm pins and 0.23mm gaps between pads, which isquite remarkable considering the manufacturing process used.

3.4 Chapter 3 conclusion

The result is a collection of stable and effective components that may be combined into acomplete system solution. Testing and integration of individual hardware components arecovered in chapter 5. It was attempted to find the best possible solution to a specific designproblem in all cases.

Page 38: Wifi RFID Scanner

Chapter 4

Detail Software Design and Synthesis

Chapter 4 covers design and development of software components of the project. Bothfirmware that run on the scanner device and application software is discussed in this chapter.

4.1 Database Table Design

One of the most important software design consideration is how data will be stored and pre-sented in the database. This section covers the database tables integrated into the MyStudiesdatabase by the attendance register system.

4.1.1 Attendance Table

This table represents a logged attendance of a student during a specific instance of a class.The attendance table contains the following fields:

• ID - Primary Key, Auto Increment.

• UserCode - An indexed field linking to a MyStudies user in the user table.

• classInstanceId - An indexed field linking to a specific instance of a class in the classin-stance table.

• Time - An optional field specifying the time of the logged attendance.

4.1.2 ClassInstance Table

This table represents every instance of a class. For example, if a class occurs once every weekfor 10 weeks, there will be 10 entries in the classinstance table for the class. The classinstancetable contains the following fields:

• ID - Primary Key, Auto Increment.

• courseCode - An indexed field linking to a MyStudies course in the course table.

• typeID - Indicating the type of class, links to the classtype table.

27

Page 39: Wifi RFID Scanner

CHAPTER 4. DETAIL SOFTWARE DESIGN AND SYNTHESIS 28

• noteID - Optional field indicating the type of class. Links to the notes table.

• startTime - The start time of this class.

• length - The length of this class.

• topic - An optional string representing the topic of this specific class instance.

• date - Day of class instance.

• year - Year of class instance.

4.1.3 Notes Table

This table holds notes added to specific class instances by lecturers. The notes table containsthe following fields:

• ID - Primary Key, Auto Increment.

• noteString - A string representation of the note.

4.1.4 classtype Table

This table holds strings for the different types of classes The classtype table contains thefollowing fields:

• ID - Primary Key, Auto Increment.

• typeString - A string representation of the class type.

4.2 Memory Map

The EEPROM’s memory map is also an important software design consideration. Care mustbe taken to ensure a dynamic memory environment is created so that available memoryspace is used effectively.The following graph represents the memory layout of the EEPROM:1 2 3 4 5

Segment 1

Used for device configuration such as its device ID(2 bytes), device password(6 bytes), anddevice administrator codes(18 bytes). Also reserved 14 bytes for counters and future use.

Segment 2

12 Courses are represented in this area, with 2 bytes storing a course code, and 8 bytesstoring a short-hand course name. Therefore this section must be at least 12x8 = 96 byteslong. It is padded to 120 bytes.

Page 40: Wifi RFID Scanner

CHAPTER 4. DETAIL SOFTWARE DESIGN AND SYNTHESIS 29

Segment 3

Stores the class instances for every day of the week(7 days). Each day requires a start addressoffset(1 byte) for the memory space of the specific day’s first class instance, and number ofclass instances for that day(1 byte). Therefore this segment is 2x7 = 14 bytes. it is paddedto 20 bytes.

Segment 4

This segment holds information for specific class instances for the week. The start addressesfor the class instances are stored in the startadroffset register for each day at a specific bytein memory. Every class instance requires the following data: The courseID(1 byte - an offsetin segment 2 of the memory), the start address of student numbers logged for this classinstance(2 bytes). The number of student numbers logged for this class instance(2 bytes).And the time of logging in hours (1 byte). Therefore this segment requires 6 bytes for everyclass instance of the week.

Segment 5

This segment holds logged student numbers. The start address of logged numbers for aspecific class instance on a specific day is determined by segments 3 and 4, therefore thisaddress space is entirely dynamic and student numbers can easily be added or removed frommemory. Every student number requires 3 bytes of memory to be logged.

4.3 LCD Layout

The LCD layout will be as follows:

MM DD HH:00 CS 212HELLO 14543109 —b38%

Where ’MM DD HH:00’ represents the current date and time, ’CS 212’ represents the currentclass module, ’HELLO 14543109’ represents a greeting to the logged student and —b38%represents the current battery condition.

4.4 iWifi configuration website

The iWifi embedded webserver will serve three pages:

4.4.1 index.html

This page will present a login form and access to all configuration parameters on successfullogin. Figure E.2 in appendix E shows a screenshot of the configuration page.

Page 41: Wifi RFID Scanner

CHAPTER 4. DETAIL SOFTWARE DESIGN AND SYNTHESIS 30

4.4.2 status.html

This page does not require authorisation and will return the status of the device.

4.4.3 sync.html

Logging into this page will cause the device to attempt synchronisation with the MyStudiesserver via the twisted.web/SOAP interface. The source code for a configuration websiteprototype is available in Appendix F.

4.5 Lecturer Administration GUI

The administration GUI allows for new class instances to be added to a timetable and forchanging class instance types and class note information. Figure E.3 is a screenshot of theadministration GUI before a new repeated class instance is added to the database. TheGUI communicates with the MyStudies server via SOAP and pushes data over the SOAPprotocol to be inserted into the database. The GUI component was designed using VisualWXfor visual design of WxPython applications.

4.6 Wifi to MyStudies interface Server

The Wifi device can push data to, and retrieve data from the MyStudies server by means of awebserver interface. For transmitting data to the MyStudies server, the Wifi device connectsto the interface server and performs an HTTP POST with the transmission data. Theinterface server parses the POST data and converts it into a form suitable for transmission viaSOAP. A SOAP request is then sent to the MyStudies server with the applicable information.A reply is also sent back to the wifi device indicating a successful transaction.

For retrieving data from the MyStudies server, the wifi device connects to the interfaceserver and performs an HTTP POST request with the variables it wants to retrieve. Theinterface server then retrieves the data from the MyStudies server via SOAP and pass italong to the wifi device.

The interface server must make use of SSL encryption to prevent packet sniffing of user-names, passwords and data.

The source code for a secure interface server implemented in python twisted.web1 isavailable in Appendix F. A screenshot of the server’s initialisation together with a promptfor the SSL PEM key can be seen in figure E.4.

4.7 Thin Clients

The use of a ’thin client’ was investigated. A thin client is a graphical user interface thatcontains no business logic code, but rather extracts GUI component code from a database.This approach could work well with the MyStudies framework as python makes serialisation

1http://twistedmatrix.com/

Page 42: Wifi RFID Scanner

CHAPTER 4. DETAIL SOFTWARE DESIGN AND SYNTHESIS 31

of classes and object trivial. Unfortunately, a thin client implementation is outside the scopeof this project.

Page 43: Wifi RFID Scanner

Chapter 5

Testing and Integration

The hardware testing strategy used is a ’bottom-up’ approach where the leaf-nodes of thetree-level diagram are first tested individually, and then integrated into its parent branchwhen all leaf-nodes of a specific branch is tested. The subsystem branches are then testedand integrated into their parent subsystem branches until all components are integratedinto the completed system. When all hardware components are integrated, a full systemdiagnostic is performed followed by a final field test of the device. The most importantindividual components were tested first.

5.1 Testing Hardware Components

5.1.1 Wifi Module

As this is one of the most critical (and expensive) components of this project, the wirelessmodule was tested first.

Testing Method:

Test1: Connect the ConnectOne iWifi module to a computer via a UART to USB/RS232circuit, which is connected to a computer’s USB port. Supply the iWifi module with3.3V. Set the computer’s COM port to 38400 bps baud rate. Send ’AT+I’ + RETURNto the iWifi. The iWifi must respond with ’I/OK’.

Test2: Set up an ad-hoc wireless network with a laptop. Configure the iWifi to connect tothe ad-hoc wireless network. Ping the iWifi using the windows ’ping’ command. TheiWifi must respond to all ping requests.

Test Results:

Test1: Passed.

Test2: Passed.

32

Page 44: Wifi RFID Scanner

CHAPTER 5. TESTING AND INTEGRATION 33

Revisions:

None.

5.1.2 RFID Scanner

Testing Method:

Connect the RFID scanner to an LTC1306, RS232 to UART interface chip in its correctconfiguration. Supply the RFID scanner with 5V and the LTC1306 with 3.3V. Connect theLTC1306’s UART output is to a UART to USB circuit, which is connected to a computer’sUSB port. Set the computer’s COM port to 19200 bps baud rate. Scan a student card withthe RFID scanner. A 26 byte string, which includes the card’s student number, must bedisplayed on the computer screen.

Test Results:

Test Passed.

Revisions:

None.

5.1.3 Printed Circuit Boards

This project uses three printed circuit boards, one for the wireless scanner device’s powersupply, one for its user interface module and one for its processing and communicationsmodule. All three printed circuit boards are tested in the following way:

Testing Method:

1. The board is inspected for defects and compared to the original schematic to verify alltracks are properly connected.

2. All tracks and vias are tested with a continuity tester for broken tracks

3. Through hole components are inserted (but not soldered) into their positions to ensureall holes line up.

Test Results:

Power Supply PCB: Passed all tests.

Processing and Communications Module: Passed all tests.

User Interface Module: Passed only tests 1 and 2. Failed test 3.

Page 45: Wifi RFID Scanner

CHAPTER 5. TESTING AND INTEGRATION 34

Problem Diagnosis and Solution:

It was determined that the 24-pin header for connecting the user interface module to theprocessing and communications module is mirrored relative to a standard floppy drive ribboncable. One of the two connecters of the ribbon cable was removed and each wire was connectedto the header pins on the PCB in a mirrored fashion.

Revisions:

The 24-pin header on the user interface module must be mirrored.

5.1.4 Microcontroller

Testing Method:

Load firmware onto the chip that generates a 20 Hz square wave on one of the timer outputpins. Connect an LED to the pin through a 50ohm resistor to Vcc in series. Supply theMCU with 3.3V. The LED must blink at 20Hz.

Test Results:

Passed.

Revisions:

None.

5.1.5 LCD

Output is vital in debugging and diagnostics of other components, therefore the LCD testwas conducted before all other components apart from the Wifi module, RFID scanner andMCU.

Testing Method:

Connect the LCD to the MCU with 8 data lines and 2 control lines as indicated in theschematic in figure D.3 available in appendix D. Load firmware on the MCU that displays:

the quick brown fox-jumps over lazy dog.

This text was designed to fill up all 20x2 characters of the LCD and represents most alphabetcharacters. Supply the LCD with 5V. Supply the MCU with 3.3V.

Test Results:

Failed. Some characters did not display correctly.

Page 46: Wifi RFID Scanner

CHAPTER 5. TESTING AND INTEGRATION 35

Problem Diagnosis and Solution:

It was determined that the character ’b’ displays correctly, but printing the character ’c’resulted in a ’b’ being displayed. The binary values of these characters are: b - 01100010, c - 01100011 . The only difference between the two characters is in the least significantbit. It was deduced that the PCB track of the least significant bit may form a short circuitwith ground, thus forcing it to 0 when it should be 1 as in the case of the character ’c’. Acontinuity test was performed and it was confirmed that the least significant bit track wasconnected to ground. It was discovered that the LCD’s cover caused the short circuit as itwas simultaneously touching the least significant bit track and the ground plane. The LCDcover was isolated from the tracks and the LCD test was repeated and passed.

Revisions:

Isolate LCD cover from tracks.

5.1.6 Touchpad

Input is also vital in debugging and diagnostics of other components, therefore the touchpadtest was conducted right after the LCD test.

Testing Method:

Supply the touchpad controller with 3.3V. Touch one of the touchpad buttons. Measure thebutton’s corresponding output channel for a 1.

Test Results:

Failed. Touching one button resulted in several output channels returning 1 instead of 0.

Problem Diagnosis and Solution:

It was determined that the ground plane between the buttons caused the touchpad controllerto register button presses on multiple buttons when one button is pressed, due to its capacitivesensing sensitivity. The ground plane was removed and the buttons covered with 1.5mmtransparent Perspex, which solved the problem of false button presses.

Revisions:

Remove ground plane between buttons.

5.1.7 Voltage Rails

The testing method for the 3.3V and 5V voltage rails were identical.

Page 47: Wifi RFID Scanner

CHAPTER 5. TESTING AND INTEGRATION 36

Testing Method:

Connect a 120 ohm resistor between the output of the regulator and ground to simulatepower-save conditions. Supply the regulator with 3.3V to 3.6V. Measure the voltage dropacross the 120 ohm resistor with a multi-meter and verify it is within 0.2V of the regulator’sexpected output (3.3V/120ohm = 27.5mA, 5V/120ohm = 42mA). Repeat the test with a12 ohm resistor for the 3.3V regulator and 20 ohm resistor for the 5V regulator to simulatemaximum load conditions (3.3V/12ohm = 275mA, 5V/20ohm = 250mA).

Test Results:

3.3V regulator: Passed. (Measurements and oscilloscope outputs available in section 6.1.3)

5V regulator: Failed. The 5V regulator made a hissing sound and became extremely hot.

Problem Diagnosis and Solution:

The 5V regulator chip was removed and it was verified that the PCB connections and com-ponents are exactly as specified in the 5V regulator’s datasheet. The continuity test wasredone on all tracks to eliminate the possibility of short circuits. A new 5V regulator chipwas soldered and it was again verified that the PCB connections and components are correct.A continuity test was repeated again to ensure no short circuits were present. The abovetesting method was redone and the new chip made a hissing sound and became extremelyhot. It was decided that a different 5V regulator chip be used, and the Maxim-IC MAX 682was chosen from table 3.7 because it has a fixed 5V output.

Unfortunately, the new PCB for the MAX 682 was not available in time for testing andresults to be published in this report.

Revisions:

The MAX 682 replaces the TPS 61120 as 5V regulator.

5.1.8 Battery Charger

Testing Method:

Insert a battery into the battery clips of the power supply module. Connect the power supplymodule to a computer’s USB port with a USB cable.Connect the battery charger’s chargeenable pin to ground and verify battery charger’s CHG pin is not 0. Connect the batterycharger’s charge enable pin to the USB input voltage and verify the battery charger’s CHGpin is 0. With charge enabled, verify the voltage across the battery is approximately 4.1V.

Test Results:

All tests passed.

Page 48: Wifi RFID Scanner

CHAPTER 5. TESTING AND INTEGRATION 37

Revisions:

None.

5.1.9 Other Components

The Bus expander, Memory Module and Real Time Clock were tested by writing data tothese devices and reading data back. The returned data was displayed on the LCD andverified. All other components passed testing.

5.2 Integration of Hardware Components

The hardware components of the individual branches were integrated into their individualsubsystems first and tested.

5.2.1 Processing and Communications Unit

The Processing and Communications unit was completed first. The MCU, Wifi module,EEPROM, Bus expander and Real Time Clock were tested together with no problems.

5.2.2 User interface module

Next the user interface module was completed. The keypad started registering false keypresses when the RFID scanner was mounted on the PCB. Engineering science was appliedin the diagnosis and solution of the problem. It was speculated that the false key presses wereas a result of electromagnetic interference from the RFID scanner. An Aluminium shield wasdesigned and inserted between the RFID scanner and the rest of the PCB. Once the shieldwas in place, the keypad no longer registered false key presses.

The user interface module was connected to the processing and communications moduleand the diagnostic tests of each individual component were repeated within the integratedsystems. All tests were passed.

5.2.3 Power Supply module

As the 5V regulator of the power supply was burnt out, the power supply unit could not befully integrated. Unfortunately the replacement PCB was not available in time for writingof this report and integration tests could not be fully completed.

5.3 Testing Software Components

The individual software components were tested as they were being developed. The only casewhere an explicit test was designed was with the webserver/MyStudies interface server. Aclient that simulates an iWifi HTTP POST request was quickly written in python to simulatedata POST events and verify that the interface server worked correctly.

Page 49: Wifi RFID Scanner

CHAPTER 5. TESTING AND INTEGRATION 38

5.4 Integration of Software Components

The main components were designed from the ground up to be compatible with the MyStudiesserver, therefore a level of integration was maintained from the start. Unfortunately therewas not enough time to fully integrate the administration GUIs with the MyStudies client,but it will be trivial to do so.

Page 50: Wifi RFID Scanner

Chapter 6

Measurements and Results

Measurement of hardware and software’s non-functional parameters is important in deter-mining the effectiveness of the system. From measurements, estimates can be made in termsof things such as operating time, operating range, number of users supported, and ultimatelythe successfulness of the entire system. Current consumption measurements were taken witha standard multi-meter, output graphs were obtained from digital oscilloscopes available inthe engineering faculty’s labs, and distance measurements were either estimated in cases oflong distances, or measure with a ruler in cases of short distances.

6.1 Hardware Measurements

6.1.1 iWifi

Current Consumption:

• Power save mode: 7.6mA @ 3.3V

• Transmit mode: 243mA @ 3.3V

Operating Range:

The following reception distance measurements were taken using a laptop , ad-hoc networkand the windows ’ping’ tool:

• Line of sight: 150m

• No line of sight: 50m (Due to weak laptop wifi card)

• MatiesWifi reception: Everywhere

Conclusion:

Measurements indicate expected results as specified in the component’s datasheet.

39

Page 51: Wifi RFID Scanner

CHAPTER 6. MEASUREMENTS AND RESULTS 40

6.1.2 RFID Scanner

Current Consumption:

• 63mA @ 5V in idle mode.

• 102mA @ 5V when a student card is scanned.

Operating Range:

1.6cm

Conclusion:

The device’s current consumption in idle mode is two times less than expected. This willsignificantly increase expected battery life.

6.1.3 3.3V Voltage Rail

The 3.3V rail was first tested by putting the device in sleep mode and measuring input andoutput currents for an input voltage range of 3.3V to 4.1V. Next, the device was operated infull operating maximum power mode and the same measurements were taken.

Table 6.1 lists the results of the low-power mode tests.

Input Voltage Regulated Out-put Voltage

Currentfrom Source

OutputCurrent

OutputVoltageRipple

3.3V 3.29V 23.9mA 22mA 80mV3.6V 3.4V 24mA 21.6mA 160mV4.1V 3.32V 22.3mA 20.9mA 280mV

Table 6.1: Measurements taken at different input voltage levels for low-power operation.

Figure 6.1 shows the digital oscilloscope outputs for low-power operation with inputvoltages of 4.1V and 3.3V.

Page 52: Wifi RFID Scanner

CHAPTER 6. MEASUREMENTS AND RESULTS 41

(a) Low-power regulation with 4.1V in-put

(b) Low-power regulation with 3.3V in-put

Figure 6.1: Low-power operation regulated output with max and min input voltage.

Table 6.2 lists the results of the full-power mode tests.

Input Voltage Regulated Out-put Voltage

Currentfrom Source

OutputCurrent

OutputVoltageRipple

3.3V 3.24V 293mA 270mA 40mV3.6V 3.36V 302mA 272mA 80mV4.1V 3.4V 286mA 269mA 240mV

Table 6.2: Measurements taken at different input voltage levels for full-power operation.

Figure 6.2 shows the digital oscilloscope outputs for full-power operation with input volt-ages of 4.1V and 3.3V.

(a) Full-power regulation with 4.1V in-put

(b) Full-power regulation with 3.3V in-put

Figure 6.2: Full-power operation regulated output with max and min input voltage.

Page 53: Wifi RFID Scanner

CHAPTER 6. MEASUREMENTS AND RESULTS 42

Conclusion:

The 3.3V regulator performs as expected, at greater than 90% efficiency and low enoughoutput voltage ripple.

6.1.4 5V Voltage Rail

Unfortunately, the 5V regulator failed before measurements could be taken. The replacementPCB and chip was not available for measurement at time of writing this report, however theexact same method of measurement as for the 3.3V regulator will be done.

6.1.5 Battery Charger

The output voltage of the battery charger was measured with a multi-meter as 4.12V whenthe charger is enabled. The current consumption was dependant on the state of the battery.

6.2 Total Power Consumption

The total current consumption for the 3.3V and 5V rails were measured for normal operatingconditions using a multi-meter and a power source as a replacement for the 5V rail. Thefollowing normal-mode measurements were made:

• Processor and communications board + keypad: 189mA @ 3.3V

• LCD+RTC+RFID scanner: 69mA @ 5V

The average estimated current that must be sourced from the battery can be calculatedas follows:

Ibat = I3V 3 ×3.3Vbat

/0.9 + I5V × 5Vbat

/0.7

Ibat = 0.189 × 0.916/0.9 + 0.069 × 1.388/0.7

Ibat = 0.192 + 0.137 = 0.329mA

The estimated battery lifetime at constant normal operating conditions is then: t =2400mAh/329mA = 7.29hours

Where 0.9 is the estimated efficiency of the 3.3V regulator and 0.7 the estimated efficiencyof the 5V regulator, and Vbat = 3.6V .

However, battery life can be greatly extended by putting the Wifi module in sleep modeand shutting down the 5V regulator until a wake-up event occurs.

Page 54: Wifi RFID Scanner

CHAPTER 6. MEASUREMENTS AND RESULTS 43

6.3 Software Measurements

Software tests were mainly done in determining the responsiveness of the administrationGUIs. The lecturer administration GUI was tested with the following results:

Adding one class instance to the database

The GUI component was used to add one class instance to the database. The functionexecuted in under 2ms.

Adding the maximum amount of class instances to the database

The GUI component was used to add the maximum amount of class instances to the database(53).The function executed in under 2ms.

Page 55: Wifi RFID Scanner

Chapter 7

Conclusion and Recommendations

The aim of this project was to develop a full automated class attendance register solution.A mobile Wifi-enabled RFID scanner device was designed and built and controlling soft-ware was developed. Prototypes for a full application software suite were implemented. Allhardware requirements for the development of such a system were addressed. Most softwarerequirements were addressed, although only partial prototypes were written in some casesdue to time constraints.

Testing and integration results show that the developed modules satisfy the objectivesof this project, and are suitable for a practical application. The hardware developed can beused as-is in the field if placed in a suitable enclosure.

The modular tree-level approach taken in synthesis and design of components allowscomponents to be interchanged if upgrades or superior alternatives become available. Thisapproach also allows for the system to be easily extended and additional functionality addedif required.

Additional time may still be spent on refining and polishing the system in order for it tobe introduced for use at the engineering faculty of Stellenbosch in 2009.

The design objectives of this project were completed successfully.

7.1 Achievements

This section can be used as a reference for new projects to be developed. It includes findingsand functionality that worked notably well and can be recommended for future solutions.The following hardware components performed remarkably well:

• The ConnectOne iWifi module. With more functionality than similar modules that istwice its cost, this device is perfect for adding Wifi capability to a mobile system. TheiWifi was released in the third quarter of 2008.

• The IQS221 capacitive sensor IC from Azoteq. Allowing the creation of custom touch-pads and sliders, with minimal operating current, the IQS221 provides a perfect userinput solution with no mechanical components that are subject to wear and tear.

• The MAX1811 USB Li-Ion charger IC from Maxim-IC. Minimal external componentsrequired for an effective USB powered Li-Ion battery charger.

44

Page 56: Wifi RFID Scanner

CHAPTER 7. CONCLUSION AND RECOMMENDATIONS 45

The following software components were critical to the development of this project:

• Python. Python is a powerful and versatile language suitable for high- and low-levelapplication development.

• Python Twisted. The twisted.web web server methodology is superior to alternativeweb server solutions and provides many advantages over systems such as Apache.

• For web based interfaces, it is recommended that Python Nevow and Athena be inves-tigated.

7.2 Recommendations

This section includes recommendations for extending the existing system, and enhancingsystem design.

Use of Surface Mount Components: The processing and communications module wasdesigned for surface-mount only components as the manufacturing for surface mountcomponents and their availability was not clear. However, the manufacturing processesat the engineering faculty are sufficient for surface mount component utilisation, andthe use of surface mount components is recommended.

Battery Temperature Monitoring: Additional functionality for monitoring battery tem-perature can be implemented.

’Thin’ Clients: The use of ’thin-clients’ must be investigated for application software GUIs.This refers to minimal client code that extracts and presents GUI information from acentral database.

Access Control: This project can easily be adopted for use in an effective wireless accesscontrol system.

Page 57: Wifi RFID Scanner

Bibliography

[1] Inc., C.E.: Lithium ion battery discharge graph. Available at:http://www.buchmann.ca/, [2008, October 27], 2008.

[2] BITKOM Radio Frequency Identification (RFID) Project Group:Rfid white paper. technology, systems, and applications. Avail-able at: http://www.rfidconsultation.eu/docs/ficheiros

/White_Paper_RFID_english_12_12_2005_final.pdf, [2008, October 27], 2005.

[3] Reinhold, C. and Scholz, P.: Efficient antenna design of inductive coupled rfid-systemswith high power demand. Journal of Communications, vol. 2, no. 6, 2007.

[4] Nohl, K.: Cryptanalysis of crypto-1. Available at:http://www.cs.virginia.edu/~kn5f/pdf/Mifare.Cryptanalysis.pdf, [2008, Octo-ber 27], 2008.

[5] LionPrecision: Capacitive sensors - an overview. Available at:http://www.lionprecision.com/capacitive-sensors, [2008, October 27], 2005.

[6] ConnectOne: Mini socket iwifi data sheet ver. 1.1. Available at:http://www.connectone.com/media/upload/Mini_Socket_iWiFi_DS.pdf, [2008,October 27], 2008.

[7] Strangio, C.: The rs232 standard. Available at:http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html, [2008,October 27], 2006.

46

Page 58: Wifi RFID Scanner

Appendix A

Project Planning Schedule

Table A.1 represents a weekly schedule for the planned completion of different aspects of thisproject.

Week StartDate

Schedule

1 21 July System analysis and planning2 28 July Find important component solutions: Wifi module, battery

charger, batteries, regulators, touchpad.3 4 Aug Request quotation for Wifi module and place sample orders for

components.4 11 Aug Analysis review and further planning.4 18 Aug Find and order secondary component solutions: MCU, memory,

bus expander, RTC, RS232 interface5 25 Aug Obtain and test RFID scanner. Test Wifi module. Begin with

software development.6 1 Sept Test Week.7 8 Sept Design and manufacture Processing and Communications module.

Software integration with MyStudies tests.8 15 Sept Design and manufacture of user interface module. Software

database layouts and design.9 22 Sept Test processing and communications module and integrate module

components. Software GUI design.11 29 Sept Test user interface module and integrate module components. Con-

tinue software developement. Firmware development.12 6 Oct Design and manufacture power supply module. Continue software

development. Software GUI development.13 13 Oct Complete final integration of all hardware components. Software

integration.14 20 Oct Measurements and report writing.

Table A.1: Project Planning Schedule

47

Page 59: Wifi RFID Scanner

Appendix B

Project Specification

The project specification as derived from the original project proposal by H.R. Gerber.

B.1 Functional Requirements

B.1.1 Hardware

• Use an RFID scanner to obtain a studentcard’s student number.

• Use non-volatile for logging card and timestamp data.

• Provide user input by means of a keypad or touchpad for device administration.

• Provide user feedback by means of an LCD, displaying current module data and ad-ministration information.

• Provide a buzzer and LEDs for device status feedback.

• Provide an 802.11b wifi component with a microcontroller for wireless transmission oflogged data.

• Provide a power supply for the mobile wireless scanner device.

• Provide a USB battery charger for charging the power supply battery.

B.1.2 Software and Firmware

• Provide a basic administration interface via the keypad and LCD for setting up Wifinetwork parameters.

• Provide an extended administration interface via an onboard webpage accessible viaWifi for setting extended parameters such as security, logging and log-in information.

• Provide an appropriate authentication system to validate configuration via the keypador webpage interfaces.

48

Page 60: Wifi RFID Scanner

APPENDIX B. PROJECT SPECIFICATION 49

• Interface with MyStudies via SOAP

• Log attendance records in permanent database.

• Provide sufficient database structures for user/timetable and Wifi device control.

• Generate detailed per-user/per-module/per-class/etc statistics from database data.

• Provide real-time feedback of scanned cards.

• Provide a personalized calendar of each student’s timetable, including information onlectures attended and missed.

• Provide a means for different lecturers to post information about the work that will beor has been covered in a specific lecture.

• Provide appropriate authentication, log-in and security mechanisms in order to validatedata pushed from the device and data posted by users (lecturers).

• Provide a sufficient administration interface for admin of timetables and students

• Provide a sufficient administration interface for admin of Wifi Scanners.

B.2 Performance

The system must adhere to the following non-functional requirements, or performance char-acteristics:

• Card data must be scanned and processed as fast as possible.

• The system must be easy to use and configure.

• The system must be secure. Data transmission and configuration must be secured.

• The system must be able to handle many users logged in at once.

B.3 Interfaces

System user interfaces include:

• Physical user input and feedback via the user interface hardware module.

• The iWifi’s embedded webserver configuration webpage.

• Student and lecturer configuration GUIs.

Inter system interfaces include:

• A ribbon cable connects the processing and communications unit with the user interfacemodule.

Page 61: Wifi RFID Scanner

APPENDIX B. PROJECT SPECIFICATION 50

• Wires connect the power supply module with the processing and communications unit.

• The device communicates with a webserver for transmitting data via HTTP POST.

• The received HTTP POST data is parsed and passed to the MyStudies server viaSOAP.

• The MyStudies server provides an interface between the database and other clientsoftware.

Page 62: Wifi RFID Scanner

Appendix C

Outcomes Compliance

The following list shows the ECSA level outcomes for this project, and a cross reference forwhere specific requirements are met within this document.

1. Problem Solving

Demonstrate competence to identify, assess, formulate and solve convergent and divergent

engineering problems creatively and innovatively.

The problem definition is stated explicitly in section 1.2 on page 1. The scope of theproblem is formulated in section 1.3 on page 2. The divergent engineering problem of system-level design is discussed in Chapter 2 on page 4, and the component design problems are solvedin a convergent manner in Chapter 4 and 5.

2. Application of scientific and engineering knowledge

Demonstrate competence to apply knowledge of mathematics, basic science and engineering

sciences from first principles to solve engineering problems.

Knowledge of the scientific phenomenon of ’capacitive sensing’ was applied as describedin section 3.1.3 on page 12. Mathematics was applied from first principles in the calculationof various components and in power consumption calculations. These calculations are avail-able on pages 24, 26, 42 and 23. Engineering science was applied to solve the problem ofelectromagnetic interference in section 5.2.2 on page 36.

3. Engineering Design

Demonstrate competence to perform creative, procedural and nonprocedural design and syn-

thesis of components, systems, engineering works, products or processes.

The tree-level diagram of figure 2.2 on page 6 is an example of a recursive, non-proceduraldesign process. The detail level design of individual components in chapters 3 and 4 is a moreprocedural approach. The touchpad as shown in figure E.1 in appendix E is an example ofa creative solution to the problem of user input.

51

Page 63: Wifi RFID Scanner

APPENDIX C. OUTCOMES COMPLIANCE 52

4. Investigations, experiments and data analysis

Demonstrate competence to design and conduct investigations and experiments.

In chapter 5, tests were designed for individual components and then execued. For ex-ample, the hardware tests formulated on pages 33, 34 and 35. Failed tests lead to structureddiagnostic investigations as formulated, for example, on pages 35 and 36. Other experimentsperformed include investigation of the effect of an aluminium shield on electromagnetic in-terference, as shown in section 5.2.2 on page 37.

5. Engineering methods, skills and tools, including

Information Technology

Demonstrate competence to use appropriate engineering methods, skills and tools, including

those based on information technology.

Use of engineering measuring equipment such as multi-meters and oscilloscopes are demon-strated in Chapter 5 and 6. Figures 6.1 and 6.2 on page 41 are examples of digital oscilloscopemeasurements. In terms of information technology, the internet was used extensively for re-search, and various information technology based communication resources were utilised suchas e-mail, Internet Relay Chat and instant messaging.

6. Professional and technical communication

Demonstrate competence to communicate effectively, both orally and in writing, with engi-

neering audiences and the community at large.

This document itself is an example of effective written communication. The professionaltypesetting application, LaTeX, was used in the creation of this report. An oral presentationwill be delivered with the aid of slides and a demonstration of the mobile scanner device.

9. Independent learning ability

Demonstrate competence to engage in independent learning through well-developed learning

skills.

The study of RFID technology in section 2.2 on page 7 is an example of independentlearning ability. Other examples of independant learning include:

• Use of an SQL database.

• Use of SOAP.

• Knowledge of RFID technology.

• Knowledge of Wifi 802.11b/g networks.

• Knowledge of capacitive sensors.

• Use of LaTeX.

Page 64: Wifi RFID Scanner

Appendix D

Circuit Diagrams and PCB layouts

53

Page 65: Wifi RFID Scanner

APPENDIX D. CIRCUIT DIAGRAMS AND PCB LAYOUTS 54

Figure D.1: User Interface Module Schematic

Page 66: Wifi RFID Scanner

APPENDIX D. CIRCUIT DIAGRAMS AND PCB LAYOUTS 55

Figure D.2: User Interface Module PCB

Page 67: Wifi RFID Scanner

APPENDIX D. CIRCUIT DIAGRAMS AND PCB LAYOUTS 56

Figure D.3: Processing and Communications Unit Schematic

Page 68: Wifi RFID Scanner

APPENDIX D. CIRCUIT DIAGRAMS AND PCB LAYOUTS 57

Figure D.4: Processing and Communications Unit PCB

Page 69: Wifi RFID Scanner

APPENDIX D. CIRCUIT DIAGRAMS AND PCB LAYOUTS 58

Figure D.5: Power Supply Schematic

Page 70: Wifi RFID Scanner

Appendix E

Photos and Screenshots

Figure E.1: Photo of user interface ontop of processing and communications unit.

59

Page 71: Wifi RFID Scanner

APPENDIX E. PHOTOS AND SCREENSHOTS 60

Figure E.2: Screenshot of wifi configuration page.

Figure E.3: Screenshot of administration GUI.

Page 72: Wifi RFID Scanner

APPENDIX E. PHOTOS AND SCREENSHOTS 61

Figure E.4: Screenshot of secure interface webserver.

Page 73: Wifi RFID Scanner

Appendix F

Source Code

F.1 Secure Interface Webserver Prototype"""

@author: Carel van Wyk

@contact: [email protected]

@since: 14-10-2004

@revisions:

"""

import __version__ #Package Versioning information

import logging

from twisted.web import server, resource

from twisted.internet import reactor, ssl

import SOAPpy

#Set up logging:

logging.basicConfig(level=logging.DEBUG,

format=’%(asctime)-25s %(levelname)-8s %(message)s’,

filename=’secure-webserver.log’,

filemode=’a’)

console = logging.StreamHandler()

console.setLevel(logging.DEBUG)

formatter = logging.Formatter(’%(asctime)-25s: %(levelname)-8s %(message)s’)

console.setFormatter(formatter)

logging.getLogger(’’).addHandler(console)

class SecureWebInterface(resource.Resource):

isLeaf = True

def render_GET(self, request):

self.host = "127.0.0.1"

self.port = 9080

self.client = "127.0.0.1"

###

try:

logging.debug("Info: Connecting to " + self.host+":"+str(self.port))

self.headerdata = "username": "8001", "password":"aaBB33", "client":self.client

self.__header = SOAPpy.headerType(data = self.headerdata)

self.server = SOAPpy.SOAPProxy(self.host+":"+str(self.port), header=self.__header)

self.server.status()

logging.debug(’Info: Connected successfully to SOAPProxy @ %s:%s’ % (str(self.host), str(self.port)))

return "<html>Worked</html>"

except Exception, why:

logging.error(’Error: connect error: ’ + str(why))

62

Page 74: Wifi RFID Scanner

APPENDIX F. SOURCE CODE 63

return False

###

return "<html>Hello, world!</html>"

def render_POST(self,request):

print request.received_headers

print request.content.readlines()

print request.args

print request

return "<html></html>"

site = server.Site(SecureWebInterface())

try:

sslContext = ssl.DefaultOpenSSLContextFactory(’keys/ca.key’,’certs/ca.cer’)

reactor.listenSSL(8080, site, contextFactory = sslContext)

logging.debug("Starting server and waiting for connections...")

reactor.run()

except Exception, why:

logging.error("Unable to start server: %s" % (str(why),))

F.2 iWifi configuration page<html>

<head>

<title>Device Configuration Page</title>

<link REL="stylesheet" TYPE="text/css" href="style.css">

</head>

<body>

<div class="top">

<img src="img/logo.jpg" alt="Logo"/>

<div class="title">Wifi Scanner Device Configuration</div>

</div>

<div class="borders">

<div class="content">

<div class="heading">Device settings:</div>

<table>

<tr><td>Device ID:</td><td><input type="text"/><input type="submit" value="update"></td></tr>

<tr><td>Admin Username:</td><td><input type="text"><input type="submit" value="update"></td></tr>

<tr><td>Admin Password:</td><td><input type="text"><input type="submit" value="update"></td></tr>

</table>

<br/>

<div class="heading">Network settings:</div>

<table>

<tr><td>Device IP Address:</td><td><input type="text"/><input type="submit" value="update"></td></tr>

<tr><td>Server IP Address:</td><td><input type="text"><input type="submit" value="update"></td></tr>

</table>

<div class="heading">Time:</div>

<table>

<tr><td>Year:</td><td><input type="text"/><input type="submit" value="update"></td></tr>

<tr><td>Month:</td><td><input type="text"><input type="submit" value="update"></td></tr>

</table>

</div>

</div>

</body>

</html>

F.3 RFID and iWifi Communcations Handling

Module#include "sfr_r827.h"

#include "uart.h"

#include "lcd.h"

Page 75: Wifi RFID Scanner

APPENDIX F. SOURCE CODE 64

#include "rfid_scanner.h"

char dataReceived;

char data;

/**Initializes the USB-RS232 serial interface.*/

void uart_init(void)

//**************************************

// UART 0 Setting - iWifi

//**************************************

//Set TXD0 pin to output port direction, set RXD0 pin to input port direction

//Poll for the status of Ri(Receive complete flag) in your UART 0 routine to check whether reception has completed

smd0_u0mr=1;smd1_u0mr=0;smd2_u0mr=1; //UART mode transfer data 8 bits long selected(u0mr bit 0, 1 and 2)

ckdir_u0mr=0; //Internal clock selected(u0mr bit 3)

stps_u0mr=0; //1 stop bit selected(u0mr bit 4)

prye_u0mr=0; //Parity disabled(u0mr bit 6)

clk0_u0c0=0;clk1_u0c0=0; //BRG count source f1 selected(u0c0 bit 0 and 1)

uform_u0c0=0; //Transfer LSB first(u0c0 bit 7)

u0brg=32; //Setting UART0 baud rate generator(max 255). Calculated value is round to the

te_u0c1=1;

re_u0c1=1; //Reception enabled(u0c1 bit 2)

u0rrm_u0c1=0;

u0c0 = 0x00;

s0tic=0x00; //Set UART0 transmit interrupt piority level 0(s0tic)

s0ric=0x03; //Set UART0 receive interrupt piority level 2(s0ric)

//dataReceived = 0;*/

//**************************************

// UART 1 Setting - RFID READER

//**************************************

//Set TXD1 pin to output port direction, set RXD1 pin to input port direction

//By default, TXD1 is at P0_0 pin, RXD1 is at P3_7 pin

//Set uart1sel0 and uart1sel1 of pinsr1 register and u1pinsel, txd1sel and txd1en of pmr register to change TXD1 and RXD1

//Poll for the status of Ri(Receive complete flag) in your UART 1 routine to check whether reception has completed

//Set up control pin (default low - disable transmit)

uart1sel1 = 0;

uart1sel0 = 0;

u1pinsel = 0;

txd1sel=0;

txd1en=0;

smd0_u1mr=1;smd1_u1mr=0;smd2_u1mr=1;//UART mode transfer data 8 bits long selected(u1mr bit 0, 1 and 2, pmr bit 5)

ckdir_u1mr=0; //Internal clock selected(u1mr bit 3)

stps_u1mr=0; //1 stop bit selected(u1mr bit 4)

prye_u1mr=0; //Parity disabled(u1mr bit 6)

clk0_u1c0=0;clk1_u1c0=0; //BRG count source f1 selected(u1c0 bit 0 and 1)

uform_u1c0=0; //Transfer LSB first(u1c0 bit 7)

u1brg=64; //Setting UART1 baud rate generator(max 255). Calculated value is round to the

te_u1c1=1;

re_u1c1=1; //Reception enabled(u1c1 bit 2)

s1tic=0x00; //Set UART1 transmit interrupt piority level 0(s1tic)

s1ric=0x04; //Set UART1 receive interrupt piority level 2(s1ric)

void ch0_handle_input()

char received;

received = u0rb;

lcd_write_char(received);

void ch0_output_char(char msg)

Page 76: Wifi RFID Scanner

APPENDIX F. SOURCE CODE 65

while(ti_u0c1 == 0);

u0tb = msg;

/**Writes a string the to the UART0 channel.*/

void ch0_output_string (char * msg_string)

char i;

// This loop reads in the text string and puts it in the UART 0 transmit buffer

for (i=0; msg_string[i]; i++)

while(ti_u0c1 == 0);

u0tb = msg_string[i];

/**Function is called when data is received on UART1 channel called due to interrupt.*/

void ch1_handle_input()

char received;

received = u1rb;

//while (ri_u1c1); //Wait while data is read

rfid_handle_received(received);