You are on page 1of 17

PURDUE UNIVERSITY

MOBILE COMMUNICATIONS PROJECTS


EE 495M

R F I D P RO J E C T R E P O RT

NOUMAN KHALID
ERIC AMBACK
MU QIAO
KENNY KUNTZ

Faculty Advisor: JAMES V KROGMEIER


Teaching Assistant: MARIBEL FIGUERA
VENKATA VANJARI
INDEX

1) Introduction

2) What is RFID?

3) Library Application

4) RFID Website

5) RFID Software Application

6) Future Tasks

7) References
INTRODUCTION

RFID (Radio Frequency Identification) is one of the new emerging

technologies. The purpose of RFID group was to investigate this technology and try

to develop an understanding of it. The project was sponsored by P&G labs and

their purpose was to have our team investigate and try to improve their current

RFID tag system.

In order to achieve our project partners demands it was necessary to learn this

technology and try to develop a small application to get a better understanding. The

group came up with some of the following Applications that can be used to better

the campus life for students at Purdue University.

a) Locating Books in the Library using RFID

b) Indoor navigating/Locating Classrooms

c) Using it as an entry card in Parking Lots


What is RFID?
A basic RFID system consist of three components:

a) An antenna or coil

b) A transceiver (with decoder)

c) A transponder (RF tag) electronically programmed with unique information

There are many different types of RFID systems out in the market. The are categorized

according to there frequency ranges. Some of the most commonly used RFID kits are as

follows:

1) Low-frequency (30 KHz to 500 KHz)

2) Mid-Frequency (900KHz to 1500MHz)

3) High Frequency (2.4GHz to 2.5GHz)

These frequency ranges mostly tell the RF ranges of the tags from low-

frequency tag ranging from 3m to 5m, mid-frequency ranging from 5m to 17m and

high frequency ranging from 5ft to 90ft. The cost of the system is based according

to there ranges with low-frequency system ranging from a few hundred dollars to a

high-frequency system ranging somewhere near 5000 dollars.

Library Application

As mentioned above our group was mainly interested in developing an

application that can be used for the betterment of student life at Purdue University.

Finding books in the Purdue Libraries can sometimes be a challenge, especially if

someone puts the book in a different shelf. Our team decided to put RF tags inside
the books and create an application for the PDA devices that can be used to track

down those RF tags and thus finding the books we are seeking.

The creation of this project was divided into following parts:

a) Website to access the Application

b) Software Program to search the database and scan the RF tags

Both these parts are discussed below in detail

RFID Website

To obtain information from Purdue University’s Library web page, THOR, we decided

the easiest way to extract call numbers of books from Purdue’s website, is through

our own web page. What we hoped to achieve was to create the RFID Software

application to interface with our web page in order to access the call numbers from

the search results page provide by THOR. We learned that the library was not

going to give us access to their databases and therefore had to find a way to gain the

necessary data. A web page was to be developed that would search the database, via

commands similar to the source code of http://www1.lib.purdue.edu/ . After some

manipulation of their code and copying portions of it into our own, it was

eventually discovered that it would be impossible to use this method to get results

returned into our own web page. Purdue has a server-side cgi script that searches

through their database for the requested books and generates its’ own html code to

display the results on a separate browser window. Therefore, an alternate solution

was to extract the source code for this results web page and save it into a local file.
At this point, the contents of the file would be searched and individual call numbers

could be pulled from the file and into our won database where we would be able to

display them on our own generated web page. Unfortunately, this step in the

process has not been completely figured out. Bits of code have been found that

demonstrate how to view source code from a button on a web page. The following

example was coded in PerlScript :

<%@ LANGUAGE = PerlScript%>

<html>

<head>
<!-- This PerlScript file enable you to read the source code on your brower directly -->

<title> PerlScript utility to view source code</title>


</head>

<table CELLPADDING="3" BORDER="0" CELLSPACING="0">


<tr VALIGN="TOP">
<td WIDTH="400"><a NAME="TOP"><img SRC="PSBWlogo.gif" WIDTH="400" HEIGHT="48"
ALT="ActiveState PerlScript" BORDER="0"></a></td>
</tr>
</table>

<h2>A PerlScript utility to view Server Side Source</h2>


<%
require "db_subs.pl";
$istat = &Load_Variables();
$filename = $Request->querystring('filename')->item;
$URL= $Request->querystring('URL')->item;
$URL =~ /$vir_site_root(.+)/;
$path_from_root = $1;
$path_from_root =~ s/\//\\\\/g;
%>

<hr>

<h3>HTML Source for: <b><%=$URL%> </b></h3>

<pre>
<%
# make sure filename does not contain any path info
$_ = $filename;
if (/[\/\\]/) {
%> Error in filename <%= $filename %> <%
}
else {
# get path of this file
$path = $Request->ServerVariables('PATH_TRANSLATED')->item;
$path =~ s/[\/\\](\w*\.asp\Z)//m;
# make path to look at
$filename = substr $path.$path_from_root, 0, 100;

open(SOURCE, $filename);
while(<SOURCE>) {
s/</</g;
s/>/>/g;
s/<%/<%<b>/g;
s/%>/<\/b>%>/g;
$Response->write($_);
}
close(SOURCE);
} # else valid filename
%>
</pre>

<hr>
<a HREF="<%=$URL%>">

<p>Return </a></p>

<p><%
$url = $Request->ServerVariables('PATH_INFO')->item;
$params = 'filename=showsource.asp&URL='."$url";
$params =~ s#([^a-zA-Z0-9&_.:%/-\\]{1})#uc '%' . unpack('H2', $1)#eg;
%> <a HREF="showsource.asp?<%=$params%>"></p>

<h4><i>view showsource.asp itself</i></h4>


</a>
</body>
</html>

This code was found at http://atlas.physics.lsa.umich.edu/aspdb/showsource.asp?PerlPars

A sample of JavaScript has also been found that will display the source code of the current

web page in a separate window. This was found at: http://www.web-

source.net/javascript_view_source2.htm

The code is as follows:

Place this code between your <HEAD> and </HEAD> tags.

<script language=JavaScript>
function ViewSource() {
window.location = "view-source:" + window.location.href }
</script>

Place this code where you would like your link to appear.
<a href=javascript:ViewSource()>View Source</a>
JavaScript required a lot less lines but at the same time, it displayed the results in yet another

window. The problem of these samples of code is it is not yet understood how to either

search through the code to extract the call numbers or how to save the source code into a

local file and then search through it.

For the following semester, it would be desired to find a way to access these call

numbers without having to create an entire separate database using methods similar

to the ones described above or by other means. Ideally, it would be better to be

able to access these call numbers through our PDA developed application.

RFID Software Application

In order to make a software application we needed to understand how the 13.56

MHZ kit by RFID INC worked, plan out how to write out the application and what

kind of interface should our application have. This whole process was divided into

two parts

a) Creating a database and search books using the application

b) Communicating with the serial port and get the RF tag data input into application

We also had the source code available from the RFID INC for their reader,

which was used as a guideline in writing out our application. We decided to use

Visual Basic 6.0 since it allows us to build an interface as well as program according

to our needs. Below is the VB code for the entire application designed by the RFID

team. The code is broken up into parts and discussed:


Database

We needed to build a test database since the Purdue Library database was not

available to us. We used Microsoft Access to build our database. The database was

created in a table format where each table represented a category. We decided the

categories according to the Purdue libraries search page. Below are the categories

made in the MS Access.

i) Authors

ii) BookAuthors

iii) BookCategories

iv) Books

v) Categories

Authors: This category contained Authors First and Last names with an AuthorID

assigned as a number.

BookAuthors: This category contained AuthorID from above category and matched it

with the BookID for a comparison and linking the two categories.

BookCategories: This category had a comparison of a BookID with CategoryID for

comparison in a search and linking the above categories with this one.

Books: This category contained the BookID, Title, CallNumber, RFID number and

description of the book. This is where we enter all the book information for our

program to come and look.


Categories: This particular category links CategoryID with the Title and Name ID to

compare during a search.

The reason why we create different categories when making a database is

because there are many different way people perform search operation. A search can

be done using author’s name, call number, RFID number or even title of the book.

A good database should have all these categories created and linked with each other

using at least one common category ID (e.g. BookID linked with RFID number) so

when writing the code we can create search queries based on these different ID’s.

VB Code for Search Queries:

Below is the VB code written in order to search the database using Authors first

name, last name, book title, RFID number and call number.

VB code:

Private Sub cmdSearch_Click()


Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strQuery As String
conn.CursorLocation = adUseClient
conn.Open strConnection
strQuery = "SELECT Book.Title, Author.FirstName, Author.LastName,
Book.CallNumber, Book.RFID, Book.Description " & _"FROM Books AS Book,
Authors AS Author, BookAuthors " & _"WHERE"
If txtTitle.Text > "" Then strQuery = strQuery & " Book.Title LIKE '%" & txtTitle.Text &
"%' AND"
If txtCallNumber.Text > "" Then strQuery = strQuery & " Book.CallNumber LIKE '%" &
txtCallNumber.Text & "%' AND"
If txtRFID.Text > "" Then strQuery = strQuery & " Book.RFID LIKE '%" &
txtRFID.Text & "%' AND"
If txtFirstName.Text > "" Then strQuery = strQuery & " Author.FirstName LIKE '%" &
txtFirstName.Text & "%' AND"
If txtLastName.Text > "" Then strQuery = strQuery & " Author.LastName LIKE
'%"& txtLastName.Text & "%' AND"
If UCase(Right(strQuery, 5)) = "WHERE" Then
strQuery = strQuery & " Author.AuthorID=[BookAuthors].[AuthorID] AND
BookAuthors.BookID=[Book].[BookID];"
Else
strQuery = strQuery & " Author.AuthorID=[BookAuthors].[AuthorID] AND
BookAuthors.BookID=[Book].[BookID];"
End If
Label8.Caption = strQuery
rs.Open strQuery, conn
Dim strBook As String
Dim bFound As Boolean
Do Until rs.EOF
strBook = rs("callnumber") & Space(3) & "RFID {" & rs("rfid") & "}" & Space(3)
& rs("FirstName") & Space(3) & rs("LastName") & Space(3) & rs("Title")
If lstresult.ListCount = 0 Then
lstresult.AddItem strBook
'txtCommPort.Text = rs("rfid")
Else
For x = 0 To lstresult.ListCount - 1
If lstresult.List(x) = strBook Then bFound = True
Next x
If bFound = False Then
lstresult.AddItem strBook
txtCommPort.Text = rs("rfid")
End If
End If
If Not rs.EOF Then rs.MoveNext
Loop
'Set dbgResult.DataSource = rs
'dbgResult.Refresh

Code Explainaion:

This code is written so that when a user enters either a title, author name, RFID

number or call number the above code takes that entry and matches it with the

information stored in the database. It goes through each category created in

database and compares one at a time until it finds a result and then returns it in a

query box. I have made the strquery bold so that you know that these are the

different ways I uses to scan out the data from the database.

For example:

strQuery = strQuery & " Author.AuthorID=[BookAuthors].[AuthorID] AND


BookAuthors.BookID=[Book].[BookID];"
This particular query goes into the database and performs a search to compare the

entered Author first or last name with the matching Book titles and when it finds the

two to match it gives a result from the database.

If lstresult.List(x) = strBook Then bFound = True


Next x
If bFound = False Then
lstresult.AddItem strBook
txtCommPort.Text = rs("rfid")
End If

This is an example of an IF statement from the code. This purpose of this statement is

that if someone performs a search it first goes into the database and does a search to

match that word with Book names and if it finds a match it considers that as a true

result and returns that match otherwise if its not true it consider that to be a false and

moves to the next category and looks in it for a match.

The above code consist of the comparison using the query statements and then

using IF statements for checking if our search matches that particular category in the

database and if it doesn’t it sends that query to be compared in the next category.

VB Code for Serial Communication

The code to communicate with the communication port is given below. The fist block

of code ran when a user clicks the start button.

Private Sub cmdStart_Click() 'Comm Port Data Handling


Dim strOut As String
Dim strBuf As String
Dim strB As String

strB = MSComm1.InBufferCount
If MSComm1.InBufferCount = 40 Then
strOut = MSComm1.Input
lblCommPort.Caption = strOut

ElseIf MSComm1.InBufferCount = 31 Then


strOut = MSComm1.Input
Buffer = Left(strOut, 29)
strOut = Right(Buffer, 8)
txtCommPort.Text = strOut
txtCommPort.Text = Left(txtCommPort.Text, Len(txtCommPort.Text) - 2)
MSComm1.InputLen = 0

ElseIf MSComm1.InBufferCount = 30 Then


strOut = MSComm1.Input

Buffer = Left(strOut, 29)


strOut = Right(Buffer, 8)
txtCommPort.Text = strOut
txtCommPort.Text = Left(txtCommPort.Text, Len(txtCommPort.Text) - 2)
MSComm1.InputLen = 0
End If
End Sub

The code starts by identifying the local variables as character strings of data. StrB equals
the amount of space in the buffer that is being used by the communication port. The reader
sends in 40 characters when it is first turned on to the communication port. These 40
characters describe the reader as the RFIDInc reader. If the buffer is equal to 40 then it
dumps the buffer into the label above the communication port text box. The next if
statement comes from the size of the of the TI RFID tags. When a TI tag is identified the
reader sends 30 characters to the buffer and a prompt waiting for the program to tell the
reader what to do next. The 30 characters and the prompt equal 31 buffer spots. The first
time a tag is scanned the buffer will equal 31. When the buffer equals 31 the port dumps the
31 characters into the variable strOut. The RFID number is only 8 characters long. The
other characters are there to identify the tag as a TI tag since the readers can read tags from
many other manufactures. The code then manipulates the string into the 8 digit code and
displays it in the text box. MSComm1.InputLen = 0 empties the buffer. The 3rd if
statement is the same as above. The reason the buffer size is 30 is incase there is no prompt
in given from the communication port.

Private Sub cmdSelect_Click()


Dim str As String
If MSComm1.PortOpen = False Then
UMSComm1.PortOpen = True

End If
str = "S"
Call ParseString(str, 10)
End Sub
This code above is for the Select button. This button is used to talk to the reader. After
the reader sends the program the tag info it prompts the user to give it the next command;
read, write or select tag. Since we just want to see the tag number we send the select
command. The read command could be used as well. The write tag command might be
used for an administrator type program, but we don’t want users to write to pre-assigned
tags and/or changing their ID numbers. It opens the port if it was closed and sends the
values S and 10 to the function ParseString. The value S can be replaced by R and W if you
want to read or write respectively.

Public Sub ParseString(str As String, k As Integer)


Dim i As Long
Dim j As String
For i = 0 To Len(str) - 1
j = Mid(str, i + 1, 1)
MSComm1.Output = j

Next i
txtCommPort.Text = ""
End Sub

The function ParseString was modified from the RFID source code. The function is

used to send commands to the reader when prompted by the reader. The command it

sends is a character string S, R or W. For this application S is all that is needed.

VB Code for matched RF tags with Searched RFID Numbers

Private Function LookForMatches(strRfID As String)


Dim strComparisonID As String
For x = 0 To lstresult.ListCount - 1
strComparisonID = Mid(lstresult.List(x), InStr(lstresult.List(x), "{") + 1,
InStr(lstresult.List(x), "}") - InStr(lstresult.List(x), "{") - 1)
If strComparisonID = strRfID Then
For t = 0 To lstresult.ListCount - 1
If lstMatchedBooks.List(x) = lstresult.List(x) Then bFound = True
Next t
If bFound = False Then
lstMatchedBooks.AddItem lstresult.List(x)
End If
lblFound.Caption = "Found"
Else
lblFound.Caption = "Not Found"
End If
Next x
End Function
Code Explanation:

This code is written so that the input from RFID reader is compared with the RFID
numbers stored in data base and assigns the value of lblFound.Caption according to the
result of comparison. If a match is found, the lstMatchedBooks is updated with the
book’s title, author name, RFID number and call number. The program also notifies
the user that the book is found by updating the lblFound.Caption to "Found". If no
match is found, the lblFound.Caption will be updated to "Not Found".

Texas Instrument RFID Mid-range Evaluation Kit:

We also obtained RFID Mid-range evaluation kit in the middle of this semester. The

TI RFID read is more complex but also more powerful that the RFID Inc. reader.

For this semester our team focused on the simple reader because of the time

constrain.

TI RFID reader responses to the request from a host (computer) and sends back a

string of hex number. More details can be found in the documentation at

http://www.ti.com/tiris/docs/products/readers/RI-STU-TRDC.shtml

Bugs & Problems in the Code

The Program has some bugs in it. One of the bugs is that every time

the application is started the reader has to be off and turned on after

the program is running.

Another problem is that when performing searches for information

from database after getting one result and comparing it with Reader

information the application needs to be closed and restarted to do a

new search.
Reasons for Using RFID INC Reader

The reason why we used RFID INC reader and kit was because the

company was very helpful. We had the open source code for there

reader available to us.

For future teams below is the contact information for RFID INC

Contact Information RFID INC

Name: James Heurich (President)

E-mail: james@rfidinc.com

Website: www.rfidinc.com

Tech Support: 1-888-WWW-RFID EXT: 107

Future Tasks

For future teams who will be working on this project need to fix

following problems:

a) Replace Scan button. The application needs to run continuously without pushing

the scan button every time a tag is in the area.


b) Fix the bug in the database finding code so that we don’t have to

restart the application to do a new search and comparison.

c) Work on the Texas Instrument Reader since its better and can

read continuously. Only problem is that we do not have any

source code available for their program.

d) Create a website and be able to link to our application.

e) Replace Database with Purdue THOR library database

f) Research RFID readers from Pocket PCs.

g) Research EE 270 Room Finder Project.

References
These websites and books are good references about programming Visual Basic and learning
about RFID. Everything that the RFID group used for reference can be found on the CD given to
Maribel.

SAMS Teach Yourself Visual Basic 6 in 21 days by Greg Perry, Macmillan Computer Publishing
1998

www.rfidinc.com

http://shay.ecn.purdue.edu/~mobility/RFID/

http://www.ti-rfid.com

http://www.amtech.com

khalid_nouman@hotmail.com

qiaom@purdue.edu

eamback1@purdue.edu

You might also like