This is only a preview of the November 2010 issue of Silicon Chip. You can view 37 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Build A Hearing Loop Level Meter":
Items relevant to "Digital Lighting Controller For Christmas Light Shows, Pt.2":
Items relevant to "A High-Quality DAB+/FM Tuner, Pt.2":
Items relevant to "Ultrasonic Anti-Fouling Unit For Boats, Pt.2":
Purchase a printed copy of this issue for $10.00. |
RFID
Security
System
Here’s a high-security system that’s very easy to build but offers you
peace-of-mind for your home, car – in fact, anything where entry
needs allow the good guys in but reject the bad guys. Team it with
an electric lock and you can have a keyless entry system as well!
I
t’s a sad fact that in today’s world
the need for property security is
ever present. Our homes and business properties are a target for thieves
and other criminals.
We spend countless amounts of
money on systems that have been
designed to counter the would-be
bad guys.
The complexity of these systems
ranges from a simple sticker that
proclaims Batman will jump through
the window and zap any burglar
stupid enough to attempt robbing the
premises, all the way up to computer
controlled alarms systems that use
satellites to protect our property and
warn of a crime in progress.
Although the system presented here
does not quite communicate with satellites it will give a high level
of protection and control access to any structure that it is
monitoring.
RFID?
If you have an E-tag for the
tollway, a micro-chipped pet
or a late-model car with an
immobiliser key, then you’re
already using radio frequency
identification (RFID) technology. Although RFID is not a
44 Silicon Chip
new field and it has been written about
in this magazine in the past, it is now
available as a project for any person
who wants to protect their property
from unauthorised access.
This system will give control over
who has access to your home, car or
any other building you care to mention. The system is installed in a position that will allow the users access to
the protected building.
A tiny (keyring-sized) RFID tag is
held close to the sensor. The system
detects the tag and compares its “signature” with those stored in memory
(up to eight).
If, and only if, a match is found, an
on-board relay is enabled for one second. This relay could be used to disarm
a burglar alarm or unlock a door.
If the detected tag is not one of those
stored in memory then the system can
be used to trigger an alarm or to sound
a warning that an unauthorised access
has been attempted.
The advantage of this is that tags
can be changed and the system reprogrammed at will, so if a tag is stolen
or even if someone attempts entry who
is no longer allowed, that tag will have
no effect except to flag an unauthorised
entry attempt.
The operating principals of RFID
were explained in a previous article
(July 2003) so if you want to know how
the system works in detail you should
read that article. Copies are available
from SILICON CHIP.
Basically, RFID operates by generating a magnetic field then looking for
any modulation on that
field. RFID “tags”, when
bought within range of the
scanning coil will send out
a unique series of bits.
The on-board microprocessor decodes these bits
and outputs a data frame
from pin 1 which is sent to
RB0 (pin 6) of IC2.
The range of this system
Fig.1: a basic RFID setup consists of a reader
is around 4cm which, al(or interrogator) and transponder. Low frequency systems
though not a lot, is ideal for
rely on inductive coupling to provide transponder power.
siliconchip.com.au
The project is very easy to build – all the hard
parts (the RFID module and the detection
coil) are prebuilt, which leaves you with
only a handful of components
to solder onto the PC board.
The relay output can
switch an electric
door strike, a car
central locking
system, another
alarm or just
about anything
you want!
by Jeff Monegal
the application presented here.
Looking at the circuit diagram
shows that there is not much to the
system at all. The RFID part consists
of a pre-built module that generates
the necessary RF field used to scan the
tags as they are bought within range of
the scanning or detection coil.
As well as “reading” the data from
the tag, the coil also provides power
to the tag via inductive coupling. It’s a
minute amount of power but enough to
“wake up” the tag and cause it to transmit its unique code back to the coil.
The data frame consists of 42 bits
which is detected and fed to the
PIC16F628 microprocessor. The inter-
The “works” of the RFID tag is tiny, as
this photo shows. Very close to actual
size, this is the same tag that’s encased
on the keyring shown above left.
siliconchip.com.au
nal software strips
off the unwanted
bits of the frame to
leave the last 24.
If you think that this cuts down on
the number of different combinations
then consider this: 24 bits = 2 to the
power of 24, equals 16,777,216.
The circumference of Earth is
40075km... If you think of Earth as a
giant chocolate wheel you would need
a pin spacing of 2.4 meters around
the full circumference of the wheel to
equal this number of bit combinations.
Another way of looking at it is, if
each tag is randomly programmed
when manufactured, you could line
up 24 people and get each one to toss
a coin, “1” for heads “0” for tails...
the chance of one of the combinations being repeated again is one in
16,777,216... If the coins are tossed
once every minute the probability of
repeating the same combination again
would take 32 years...
I think you will agree that 24 bits
are more than enough to ensure
good security for this project!
Up to eight tags
When setting up the system the user
can make the system learn up to eight
separate tags. The unique code of each
of the tags is then
stored in memory. When
a tag is detected the micro compares
its code with those in memory. If a
match is found the relay is latched for
one second and the GO led is lit also
for one second. One of the eight user
LEDs will also light to indicate which
tag was detected.
After the relay unlatches, the system
goes back to standby, waiting for the
next tag to come by. That is really all
there is to the system. The relay can be
used to operate an electric door strike
to give controlled access to a room or
building.
Be careful when selecting the strike:
you can get “fail safe” where the lock
The heart of the project is this RFID
module, which comes pre-assembled
and tested, ready to solder into the PC
board.
November 2010 45
BR1 W04
REG1 7805
+5V
KEY
LED14
A
LEARN
K
560
LED1
100 F
K
100nF
4
14
560
Vdd
RB1
RA0
RA7
17
330
6
RB0
RB5
RB4
+5V
26
[PIN NOS ON RFID MODULE
ARE NOT MARKED BUT
PINS ALIGN WITH HOLES IN PCB]
1000 F
25V
CON2
~
RA2
10k
RA3
3
RB2
RA4
S2
Vss
RB3
K
USER 2
LED3
K
A
USER 3
K
USER 4
LED5
K
A
K
10
A
1
A
ERROR
LED13
K
A
A
560
560
K
DETECT
8
9
A
CON3
560
LED11
2
NC
COM
NO
USER 8
LED9
K
A
USER 7
K
LED10
D1
1N4004
USER 6
LED7
K
RLY1
K
USER 5
LED8
11 A
NO GO
SELECT
USER 1
A
LED6
RB6
1
K
15
IC1 RB7
PIC16F628A 12
28
LED4
16 A
13 A
16
4
RA6
S1
RFID
MODULE
100nF
LED2
MCLR
18 A
RA1
LEARN
27
IN
GND
POWER
IN
–
10k
100
15
+
10k
7
SENSING
COIL
(PREMADE)
OUT
A
~
10k
B
C
E
GO
LED12
Q1
BDX37
K
560
5
GND
SC
2010
RFID SECURITY SYSTEM
K
K
A
LEDS
A
B
1N4004
C
BDX37
E
IN
GND
OUT
7805
Fig.2: the RFID module detects any tag brought into close proximity, sending its code to IC1. This in turn determines
whether it is a valid code and if so, energises the relay for about a second.
The one-second
relay closure is
perfectly suited to
a central locking
controller, or
an electric door
strike, such as
this one (available
from Jaycar and
Altronics). Bear
in mind our
comments about
fail-safe and failsecure electric
strike models.
46 Silicon Chip
will be open if power is not applied,
or “fail secure” where the mechanism
will be locked if power is not applied.
You have the choice of wiring the
relay output so power is normally
applied and the lock opens when
the relay pulls in (wasteful of power
but important if emergency egress is
required) or using a fail-secure strike
which “opens” for the second power
is connected (much less wasteful
of power but can be a hazard in an
emergency).
The digital output from pin RB2 can
be interfaced to an existing security
system so that the RFID system can
trigger it, turn on lights and cameras,
sound a warning siren and so on. Just
keep in mind that the relay only pulls
in for a second, so any other device
will need to take this into account.
As the system will operate on 12V
DC it can be used to operate a car central locking system. The scanning coil
could be placed up against the inside
of the windscreen and the relay connected to the car’s locking system. This
would give a high level of security to
your vehicle.
I’m sure that readers will come up
with a few other applications for this
system.
Indeed, the 8-user LED outputs can
also be used to perform various functions – with some clever interfacing
the eight user LEDs can be used to give
varying levels of security.
As an example, user 1 may be given
full access to a secure building. Users
2 and 3 may only be allowed access
to certain rooms. Despite its apparent
simplicity, the project presented here
could form the basis of a very secure
personnel access control system.
How it works
The circuit diagram shows that
there are not a lot of components in
siliconchip.com.au
(TO COIL)
560
560
10k
560
100
10k
560
560
S1
10k
330
S2
NO NC
C
BDX37
5
CON3
RLY1
100nF
BR1
–
~
IC1 PIC16F628A
~
100 F
K291
+
+
© oatleyelectronics.com
1000 F
LED14 LED1 LED13 LED12 LED11 LED10 LED9 LED8 LED7 LED6 LED5 LED4 LED3
KEY LEARN
NO
GO
GO
REG1 7805 POWER
4
D1
+
3
10k
100nF
2
Q1
CON2
16 15
CR003
560
SELECT
1
LEARN
MODULE
4004
RFID
28 27 26
LED2
USER USER USER USER USER USER USER USER
DETECT
ERROR 8
2
1
7
6
3
4
5
Fig.3: follow this component overlay as you construct the RFID
Security System. Note LED 14 faces the opposite way to the other
LEDs. We suggest you use an IC socket for the PIC processor, as
seen in the photo below, as it makes checking simpler.
PARTS LIST –
RFID Security System
1 PC board 96 x 62mm, code K291
1 CR003 pre-built RFID receiver module
(supplied with pre-made sensing coil to suit)
1 2-way PC-mount screw terminal, 5.08mm spacing (POWER – CON2)
1 3-way PC-mount screw terminal, 5.08mm spacing (RELAY OUT – CON3)
1 SPDT 12V relay, PC-mounting
2 tactile switches, PC-mounting
1 18-pin DIL IC socket
Semiconductors
1 PIC16F628A microprocessor (programmed
with RFID_4.hex)
1 7805 5V three terminal regulator
1 W04 bridge rectifier
1 BDX37 NPN transistor
1 1N4004 silicon diode
14 5mm LEDs of any colour
Capacitors
1 1000µF 25V electrolytic
1 100µF 25V electrolytic
2 100nF monolithic.................... (code 104 or 100n)
Resistors (0.25W, 5%)
4 10kΩ (R3,R6,R7,R11).......... [brown-black-orange-gold]
6 560Ω (R1,R5,R8,R9,R10,R12)...[green-blue-brown-gold]
1 330Ω (R2)...................... [orange-orange-brown-gold]
1 100Ω (R4).......................... [brown-black-brown-gold]
WHERE DO YOU GET IT?
this system – if we take away the mandatory power supply
there is not much left. The actual receiving of the data is
done by a pre-built module. The output from this module
is a 42-bit data frame but as explained above we only use
the last 24 bits. The micro extracts this 24-bit data, then
compares this with the eight memory locations and if a
match is found the relay is latched for one second and the
activated user LED is turned on for 1 second.
The ERROR LED will light if a tag was detected but its
code was not complete or corrupted in some way. The DETECT LED lights to show a tag was detected and decoded.
The power supply is about as standard as you can get,
with a bridge rectifier followed by the standard big filter
capacitor, 3-terminal 5V regulator and then a 10µF output
filter capacitor. The two 100nF caps help to keep the supply
rail quiet and are placed near the microprocessor.
Pushbutton switch S1 and associated components, along
with the learn LED, are used in the tag storage function. Pin
7 (RB1) can be both an input and an output. Normally the
pin is an input and the learn LED is off. The micro polls
this pin looking to see if the push button PB1 is pressed
at any time. When it is pressed the input pin is changed
to an output which is then pulled low. What this does is
to hold the learn LED on after the button is released. This
siliconchip.com.au
This design and its operating software are copyright
© 2010 Oatley Electronics.
A kit of parts for this project, with all components listed
above, is available from Oatley Electronics (Cat K291).
www.oatleyelectronics.com or (02) 9584 3563,
for $40 including 10 keyring RFID tags. Extra tags are $1.50
each.
Any technical enquires for this project should be directed to
jeffmon<at>optusnet.com.au
Phone support is not available for this project. All enquires
and questions will be answered via this email address
within 48 hours (most will be answered within 12 hours).
now means that the system is in learn mode.
Learning the tags
Before this system can work effectively it must learn at
least one tag so that it will have something to compare any
detected tags with.
To learn tags the operator presses and releases the learn
button. The learn LED will now come on and stay on as
previously stated. The program is now in learn mode and
waiting for the next tag to come along. The operator now
simply places the tag to be stored near the receiving coil.
If the program successfully decodes this tag the learn LED
will go out and user 1 LED will come on.
The system is now waiting for the user to select a memory
location for the next tag.
November 2010 47
Pressing the USER SELECT button will cause the user LEDs to cycle
around. First press will turn user 1
LED off and user 2 LED on. Next press
will turn user 2 LED off and user 3
LED on. Each press of the select button
will shift along the LEDs. When LED
8 comes on the next press will cycle
back to user 1 LED.
When you are happy with the
memory location press the learn button again. The last decoded tag will
now be stored in the memory location indicated by the user LEDs. The
LEARN LED will now flash once. The
program now stores the unique tag ID
in EEPROM.
That’s it, the tag has been saved.
When the same tag is decoded next
time the system will respond and allow access to the user holding that tag.
To erase any memory location the
operator simply goes through the same
procedure and stores the new tag over
the top of what was stored in the old
memory location.
To summarise the tag learning
procedure users should consult the
following table:
ACTION
RESULT
Press and then release
Learn LED on
the LEARN button
Bring required RFID tag
in range of coil
Learn LED off
User 1 LED on
Select memory location
with SELECT button
User LEDs shift
along
When location selected
press LEARN button
Tag stored in
user location
The Tag has now been detected, decoded and stored in the User EEPROM
location.
Construction
Assembly of the project is fairly
straightforward. The PC board is of a
very high quality so as long as your
soldering is up to the task and the
components are placed in the correct
position you are virtually assured of
an operational project.
Start with the resistors and capacitors. Remember that the electroylitic
capacitors are polarised so be careful
when installing them. The same goes
for the LEDs.
There is a trap for young players
with the LEDs: all bar one mount
flat side (cathode) to the right, when
looking at the board with the terminal
blocks on the right. LED 14 mounts
48 Silicon Chip
The sensing coil (shown close-up at right) solders directly to the PC board
alongside the RFID module. This coil, which measures about 50 x 45mm, is
made from very fine wire so needs to be treated with all due care. The ends of
the coil wires pass through a protective spaghetti sleeve to protect them.
cathode to the left. You have been
warned!
It is recommended that an IC socket
be used for the microprocessor – again,
this must go in the right way around.
The RFID module should be installed next and again be careful when
handling this component.
The bridge rectifier, 3-terminal
regulator and transistor are next and
all three are polarised (no heatsink is
needed on the regulator). The relay is
the last on-board component and will
only go in one way.
Sensing coil
The sensing coil is supplied preassembled, which means you only
need to attach it to the PC board.
However, the wire which forms the
coil is quite fine and will be easily
damaged with any form of rough handling. There’s about 200mm of wire
emerging from the coil – this attaches
to the two points marked “COIL” on
the PC board (polarity is unimportant).
To protect this fine wire, we slid
on a piece of thin heatshrink tubing
over the two wires (which are in fact
loosely twisted together) and glued it
to the coil itself (the coil is actually
quite rigid).
To prevent stress on the opposite
ends of these wires (ie, the end where
they solder to the PC board), we anchored the heatshrink with a small
cable tie right around the RFID module
and heatshrink
You also need to decide whether
you’re going to have the coil close to
the PC board or some distance away.
If you mount it any further away
than the ~200mm allowed by the
connecting wires, you’ll need to extend them with either thin insulated
hookup wire or better still, two strands
of ribbon cable or some thin Figure-8
cable.
Note that we have not tested the
RFID unit with the coil any further
away than the 200mm. In theory, it
should be quite OK but . . .
Smoke test
At this stage do not install the microprocessor. Apply power and using
your multimeter measure the voltage
on pin 14 with respect to pin 5 of the
micro. You should read close to 5V
DC. If OK, then switch off the power,
wait for a short while and then install
the microprocessor.
This time when you switch on the
power the LEARN led should come
on for 500ms.
If this happens then the system is
alive and well and ready for work.
One of the first things the program
does is to load the eight user IDs from
EEPROM so it is ready to decode the
stored tags.
If no user data has been stored in
EEPROM the unit will ignore all tags.
Go through the learning tag procedure
to store at least one tag.
SC
ELNEC IC PROGRAMMERS
High quality
Realistic prices
Free software updates
Large range of adaptors
Windows 95/98/Me/NT/2k/XP
CLEVERSCOPE
USB OSCILLOSCOPES
2 x 100MSa/s 10bit inputs + trigger
100MHz bandwidth
8 x digital inputs
4M samples/input
Sig-gen + spectrum analyser
Windows 98/Me/NT/2k/XP
IMAGECRAFT C COMPILERS
ANSI C compilers, Windows IDE
AVR, TMS430, ARM7/ARM9
68HC08, 68HC11, 68HC12
GRANTRONICS PTY LTD
www.grantronics.com.au
siliconchip.com.au
|