BUILD
NOTES
The iConveyor
simple. Usman wrote the code as a single script,
easily editable with any text editor. This includes the
mapping of tag ID numbers to the applications and
URLs they launch. It means that I can add a new tag
to the system just by querying its ID number and
copying and pasting it to a new line in the block of
code where the bindings are defined (for example:
1300483518 “ http://www.makezine.com”). We briefly
considered writing a graphical user interface for
defining each tag’s behavior, and saving the mappings in a separate data file, but it was so easy to
hand-edit the data that we decided against it. You
can download our script RFIDtiles.tcl at makezine.
com/15/build_notes.
The script’s main launch functions are to initialize
the board, turn on the antenna, and wait for tag
events. When a tag is read, it’s compared to the
defined list of known tags. If it’s recognized, its
application or URL is launched. If not, a console
message delivers the bad news.
To prevent accidental duplicate reads of the same
tag, the most recent tag ID is ignored for a few
seconds. The RFID board’s 5V outputs are turned on
for 5 seconds, lighting the orange LED and closing
the motor relay — long enough to drive the tile off the
John Edgar Park ( jp@jpixl.net) is a character mechanic at
end of the conveyor belt and into the output tray. Walt Disney Animation Studios, and the DI Y Workshop host
We ran into a few snags along the way. For one, for the upcoming series Make:TV.
don’t try running multiple applications that access
the RFID board simultaneously. I had both the
Phidget sample application and our Tcl script running at the same time, which caused rapid blinking
of the LED and relay outputs. (That’s how I found
out that nothing is quite so unnerving at 2 in the
morning as a relay thrashing open and closed 100
times a second.)
We also began to implement the playing of sound
files based on tag reads, but had problems with the
Tcl sound extension (Snack) interfering with the
voltage outputs. While this incompatibility is probably addressed with newer versions of the library,
I decided that I’d prefer to skip the . wav files, and
add a real-world, solenoid-struck bell in the future.
I get such a kick out of using the iConveyor that
I’ve started to view everything through an anachronistic lens. Could I replace the TiVo remote with an
IR-emitting Underwood typewriter? Stay tuned ...
TICKLED WITH TCL
BY USMAN MUZAFFAR
From the smörgåsbord of
high-level languages available
today, including Perl, Python,
Java, and VB — some of these
already with bindings to the
Phidget SDK — why did we
choose the Tool Command
Language (Tcl)?
First, we wanted something
cross-platform. Our example
target is MS Windows, but Tcl
is also easily migrated to any
other operating system.
Second, our program
134 Make: Volume 15
simply hard-codes the RFID
constants, but it can be easily
extended to have a graphical
user interface. Tk is a cross-platform GUI library written
for Tcl that’s extremely easy
to use and flexible.
Finally, the unparalleled
elegance of its event model
makes Tcl a great match for
a project like this. In our
application, signals from
the RFID reader (events)
are being generated asynchronously. Handling this in
other languages might force
you to write the event loop
yourself, or require the use of
threads. But Tcl — available
everywhere, great UI tool kit,
easy event handling — needs
only the ability to connect
to the Phidget SDK to do
the job. That was trivially
accomplished on Windows
with the Tcom extension that
let us connect directly to
the Phidget COM interface.
On other platforms, it would
be easy enough to wrap the
Phidget C API with a Tcl layer.
In short, Tcl made it easy to
prototype a working solution,
and it’s a great platform on
which to build additional
features.