by Jon Williams
Putting the Spotlight on BASIC Stamp Projects, Hints, and Tips
You Can’t Touch That — Non-contact Access Control
Today, I had a bit of a headache and was
feeling cramped in my office, so I decided to
escape to the treadmill in the complex’s private gym for a half hour or so. To keep it private, members gain access by waving a security card in front of a small plate adjacent to
the front door. If the card is a match, cha-ching, the door unlocks and you’re in.
NUTS & VOLTS
Okay, what’s going on with the card? You’ve probably seen them — they’re everywhere. The cards in
question contain technology called radio frequency
identification (RFID). Even if you haven’t heard of RFID, you
may have been unknowingly exposed to it. RFID tags can be
as small and nearly as thin as a postage stamp and are often
used to track package movement in retail stores (big companies like Wal-Mart, Target, and others are adopting the
technology). Drug companies are even putting RFID tags
into their packaging to prevent piracy of expensive medicines. RFID is big news and now you can get in on it, too.
There are two essential components in an RFID system: a transceiver (reader) and a transponder (tag). If it
were only that simple. Tags can be active (contain their
own power source) or passive (create parasitic power from
the reader’s RF field). Further, tags can be read-only or
read-write. Zoiks. Let’s just keep things simple, shall we?
Parallax worked with world-famous hardware hacker
and engineer extraordinaire, Joe Grand (owner of Grand
Idea Studio), to create a low-cost RFID
reader that would
be simple to use in
hobbyist and professional projects.
The result is a fully
board that contains the required
to work with pas-
Figure 1. A handful of RFID tags.
sive, read-only RFID tags. Note that the reader is specifically designed for tags that contain low-frequency (125 kHz)
RFID components from EM Microelectronic. Parallax carries a couple of tag types (disc and ISO card) that are manufactured by Sokymat and meet the requirements of the
reader. Figure 1 shows a few sample tags from Sokymat
that I played with; you can clearly see the disc tag (far left)
and ISO card tag (far right).
Is it Magic?
Okay, how does it work? It’s not magic; in fact, it’s not
terribly complicated. When power ( 5 VDC) is applied to
the reader, a green LED will indicate that it’s ready to function. By pulling the ENABLE pin low, the reader becomes
active (LED changes to red) and the antenna broadcasts
a modulated signal. If a tag is within range (up to four
inches with the Parallax reader), it will harvest the RF
energy with its own antenna and modulate its unique identification code in a manner that can be detected by the
reader. A microcontroller on the reader tests the bits from
the RFID tag to make sure the information is valid and
then the tag number is converted to an ASCII stream to
be transmitted on the SOUT pin at 2400 baud.
Keep in mind that, when the antenna is active (red LED),
the device is broadcasting and consuming about 200 mA
from the power supply. If you’re going to do a project that
involves batteries, you may want to add a physical button to
activate the reader only when a card is actually present or
use a timeout with SERIN (BS2 family only) to disable the
reader periodically to reduce the load on the power supply.
Since RFID is so common in controlled-access and
security systems, let’s go that direction. And just for fun,
let’s build a super-simple, single-tag, access-control device
with a BS1. Can we do it? Absolutely. In fact, the code is
so simple, we can look at the whole thing in one shot:
SERIN RX, T2400, ($0A, “0F0184F20B”)