Getting Started with RFIDPhidgets

abashedwhimsicalΛογισμικό & κατασκευή λογ/κού

2 Νοε 2013 (πριν από 3 χρόνια και 8 μήνες)

232 εμφανίσεις

Human Computer Interaction

Getting Started with
RFIDPhidgets

Equipment


Visit phidgets.com


Look up specifications for each sensor


Online documentation:
http://www.phidgets.com/documentation/web/javadoc/index.html



Order additional
phidgets



http://www.phidgets.com


http://www.trossenrobotics.com


Company ships from USA, competitive pricing

Installation Procedure (1 of 5)


Computer must have


Java Installed


JGrasp

or
TextPad

Installation Procedure (2 of 5)


Go to location for
Phidget

Windows Downloads


www.phidgets.com


Downloads


Windows






Installation Procedure (3 of 5)

1.
Download
Phidget

Framework (
Phidget

21.MSI)




2.
Install
Phidget

Framework

1.
Microsoft.NET should be installed on your computer,

2.

After installing Microsoft
.net
., install
Phidget

2.1 MSI. This will
create the folder Program Files/
Phidget

on your computer.

3.
You will see a PH icon on status bar to indicate success


Installation Procedure (4 of 5)


Create a
Phidget

Files Folder on your C Drive


Download “Java Files” and save in your
Phidget

Files Folder


Examples
: Java (Zip file)


Additional Files:
phidget21.jar


Java API Manual
: javadoc.zip

New RFID files posted in June

Installation Procedure (5 of 5)


Unzip Files


Use
UnZip

to extract files from .zip


The
phiget21.jar

is a compressed java file. You can use
JGrasp

to
extract all files (Tools/Jar). Ultimate Zip is another program to
extract the java files.


2 folders will be created. (com and meta
-
inf
)





All source files you create must be in the
Phidget

Files folder. They
will import data from the
com

folder

RFID
Phidget

Product Features:



Cost: $65.00 (Canadian
money) from
www.phidget.com


Reads tags brought within 3
inches of the reader


Reads any tag with EM4102
protocol


Returns the unique number
contained in the tag


Provides 2 Digital Outputs to
drive LEDs, relays, etc.


RFID Tags Price : $3.00 each


Connects to USB port


Testing the
RFIDPhidget


Double Click on the icon to activate the
Phidget

Control Panel and make
sure that
PhidgetRFID

is properly
attached to your PC.










If you do not see the device listed


Go to
WebService

Tab


Set [Start up Type] Automatic and Press [Start]


You may have to detach the RFID
Phidget

from USB port and reattach after
WebService

status is
Running


WebService

Tab

General Tab

Testing the
RFIDPhidget


When you double click on
the device name, GUI
appears that allows you to
interact with the device


Remember to close this
interface before executing
your program.


The interface kit may be
“connected” to one program
at a time.

Wave a tag in front of the
reader to see the Tag Data

Using
Phidget

Classes


Source code must be saved in folder that contains the
com

folder.


Your program is looking for this structure.


Refer to
Phidget

Instructions on vista


Import required classes


import
com.phidgets
.*;


import
com.phidgets.event
.*;

Several
RFIDPhidget

Classes & Methods

RFIDPhidget


void
addTagGainListener

(
TagGainListener

listener)


Adds a tag gained listener.



void
addTagLossListener

(
TagLossListener

listener)


Adds a tag lost listener.


TagGainListener



void
tagGained

(
TagGainEvent

ae
)


This method is called with the event data when a new event arrives.

TagLossListener



void
tagLost

(
TagLossEvent

ae
)


This method is called with the event data when a new event arrives.

TagGainEvent




String
getValue

()


Returns the gained tag.


Similar to
JTextField

Similar to
ActionListener

Similar to
ActionEvent

Open
RFIDPhidget

//
Declare instance variable

privateRFIDPhidget

rfid
;


//Code Segment that opens an
RFIDPhidget


try


{


rfid
= new
RFIDPhidget

();



//Add a listener to fire when tag is read




rfid.addTagGainListener

(new
MyTagGainListener

());




//Open an interface kit without a serial number. If you had more than two



// kit connected use open(
int

serialNumber
) and pass the serial number





rfid.openAny
();



//Wait for the device to be attached




System.out.println
("waiting for
InterfaceKit

attachment...");




rfid.waitForAttachment
();




System.out.println
(
ik.getDeviceName
());



}//end try


catch

(
PhidgetException

e)


{

System.out.println
("
Phidget

Exception Generated");



e.printStackTrace
();


}

Create your own Listener class

An
exception

may be
thrown. You must
have code in
try/catch block

Create a Listener Class for the Interface

class
MyTagGainListener

implements
TagGainListener

{




{

public void
tagGained
(
TagGainEvent

ae
)



// Get value of the tag.



String
tagID

=
ae.getValue
();




System.out.println
("Tag id: " +
tagID
);


}

}

Protect your RFID reader and RFID tags


Do not attach the RFID tags directly to your objects


Insert each tag in an envelope or wrap it in plastic before taping
to objects


Be careful when placing reader and tags in book back


Avoid long exposure to sun, water etc.