Samuel Sjöberg's weblog

Skip to navigation

Phidgets and Java

In the course Design of Emergent Interaction Systems we worked on a project which would enhance the visitors experience on the Swedish music festival Hultsfredsfestivalen.

I will write more about the project later on, but this entry is related to the project since we used something called Phidgets when we built our physical user interface.

Phidgets are physical widgets which can be controlled and programmed by a computer. There are numerous sensors and effectors ready to be plugged in, e.g. light sensors, digital switches and servo engines.

Phidgets where originally made for use with Visual Basic, but 2004 a Java library was made available.

The Java library has been easy to work with. The only negative part is that there is absolutely no documentation. The best way to start is to look at the provided examples and build your application on top of them.

Phidgets and RFID

Our program used RFID-readers to make it easy to log on to the system. One major drawback with the PhidgetRFID is how it reads RFID-tags. The default event is simply to report as soon as a tag is detected. This means you will be flooded with events as soon as a tag is present. The only way to detect when a tag is removed is the absence of these messages.

When we designed our program we only wanted to know when a tag was first detected and when it was removed. The solution to this is to use a timer.

When a tag is first detected a flag is set and a timer is started. Every time the timer runs, it checks if and how long the flag has been unset. If it has been unset for some particular time, the tag must have been removed. If this condition is not satisfied, the flag is unset.

The default onTag event keeps detecting tags after the timer has been started. Now, every time a tag is detected the flag is set. Thus, the timer and the onTag-event works against each other until the onTag-event stop firing.

Our solution was to build a wrapper class which converts the onTag events into a tagEntered and tagRemoved event. The wrapper class is called RFID and can be used to initiate a PhidgetRFID, hook a RFIDEventListener to it and start reading tags. The RFIDEventListener is an interface we defined which contains the tagEntered and tagRemoved events.

Hopefully these classes can be helpful for someone else who also works with PhidgetRFID. The only thing we didn't succeed with was to attach two PhidgetRFIDs at the same time.

Pages linking to this entry

Pingback is enabled on all archived entries. Read more about pingback in the Pingback 1.0 Specification.

About this post

Created 27th March 2005 13:59 CET. Filed under Java.

0 Pingbacks