You are on page 1of 4

cONSTRUcTION

102 December 2010 electroni cs for you www. e f y ma g . c o m


A
radio-frequency identifcation
(RFID) based access-control
system allows only authorised
persons to enter a particular area of an
establishment. The authorised persons
are provided with unique tags, using
which they can access that area.
The system is based on microcon-
troller AT89C52 and comprises an
RFID module, an LCD module for
displaying the status and a relay for
opening the door. Fig. 1 shows a user
trying to open the door by placing an
RFID tag near the RFID reader.
Radio-frequency
identification
You might be familiar with RFID
systems as seen in access control,
contactless payment systems, product
BikRamjeet waRaich
RFiD-BaSeD SecURitY SYStem
Sunil Kumar
tracking and inventory control, etc.
Basically, an RFID system consists
of three components: an antenna or
coil, a transceiver (with decoder) and
a transponder (RF tag) electronically
programmed with unique information.
Fig. 2 shows a typical RFID system.
In every RFID system, the transponder
tags contain unique identifying infor-
mation. This information can be as
little as a single binary bit or a large
array of bits representing such things
as an identity code, personal medical
information or literally any type of in-
formation that can be stored in digital
binary format.
The RFID transceiver communi-
cates with a passive tag. Passive tags
have no power source of their own and
instead derive power from the incident
electromagnetic feld. Commonly, at
the heart of each tag is a microchip.
When the tag enters the generated RF
feld, it is able to draw enough power
from the feld to access its internal
memory and transmit its stored in-
formation. When the transponder tag
draws power in this way, the resultant
interaction of the RF felds causes the
voltage at the transceiver antenna to
drop in value. This effect is utilised by
the tag to communicate its information
to the reader. The tag is able to control
the amount of power drawn from the
feld and by doing so it can modulate
the voltage sensed at the transceiver
according to the bit pattern it wishes
to transmit.
Antenna. Fig. 3 shows the internal
diagram of a typical RFID antenna. An
RFID antenna consists of a coil with
one or more windings and a matching
network. It radiates the electromag-
Fig. 2: A typical RFID system
Fig. 1: A user is trying to open the door by
placing an RFID tag near the RFID reader
RFD READER
RFD
TRANSPONDER
PASSVE
TAG
TRANSCEVER
TRANSCEVER FELD
RECEVED DATA
MODULATED RF FELD
TAG MODULATES
RF FELD WTH DATA
PArts List
Semiconductors:
IC1 - AT89C52 microcontroller
IC2 - 7812, 12V regulator
IC3 - 7805, 5V regulator
IC4 - RFID reader module
T1 - BC558 pnp transistor
T2 - BC547 npn transistor
D1-D5 - 1N4007 rectifer diode
LED1-LED3 - 5mm LED
LCD - 16-character, 2-line
Resistors (all -watt, 5% carbon unless
stated otherwise):
R1 - 10-kilo-ohm
R2, R3 - 330-ohm
R4, R5 - 1-kilo-ohm
R6 - 33-ohm
Capacitors:
C1 - 1000F, 25V electrolytic
C2, C3 - 0.1F ceramic disk
C4 - 10F, 16V electrolytic
C4, C5 - 22pF ceramic disk
Miscellaneous:
X1 - 230V AC primary to 15V,
500mA secondary
transformer
S1 - Push-to-on switch
X
TAL
- 11.0592MHz crystal
RL1 - 12V, 1C/O relay
PZ1 - Piezobuzzer
- RFID tag
- 12V DC door lock actuator
cONSTRUcTION
electroni cs for you December 2010 103 www. e f y ma g . c o m
of anywhere from 2.54 cm (one inch)
to 30 metres or more, depending upon
its power output and the radio fre-
quency used. When an RFID tag passes
through the electromagnetic zone, it
detects the readers activation signal.
The reader decodes the data encoded
in the tags integrated circuit (silicon
chip) and the data is passed to the host
computer for processing.
Tags (transponders). Fig. 4 shows
the internal structure of a typical RFID
tag. An RFID tag comprises a micro-
chip containing identifying informa-
tion and an antenna that transmits
this data wirelessly to the reader. At
its most basic, the chip will contain a
serialised identifer, or licence plate
number, that uniquely identifes that
item, similar to the way many bar
codes are used today.
There are three types of tags: ac-
tive, passive and semi-passive.
Passive tags have no internal
power source. These draw their power
from the electromagnetic feld gener-
ated by the RFID reader and then the
microchip can send back information
on the same wave. The reading range
is limited when using passive tags.
Active transponders have their
own transmitters and power source,
usually in the form of a small battery.
These remain in a low-power idle
state until they detect the presence of
the RF feld being sent by the reader.
When the tag leaves the area of the
reader, it again powers down to its
idle state to conserve its battery. As a
result, active tags can be detected at a
Fig. 5: Circuit of the RFID-based security system
Fig. 3: Internal diagram of a typical RFID antenna Fig. 4: Internal structure of a typical RFID tag
WRE
BONDNG
CHP
PAD
CHP
PAD
CHP
CHP
ANTENNA
PRMER
PRMER
SLCON ENCAPSULATON
MATERAL
ENCAPSULATON
MATERAL
netic waves generated by the reader
to activate the tag and read/write data
from it.
Antennae are the conduits between
the tag and the transceiver which con-
trol the systems data acquisition and
communication. These are available
in a variety of shapes and sizes. Of-
ten, the antenna is packaged with the
transceiver and decoder to become a
reader, which can be confgured either
as a handheld or a fxed-mount device.
The reader emits radio waves in ranges
cONSTRUcTION
104 December 2010 electroni cs for you www. e f y ma g . c o m
greater range than passive tags.
Semi-passive tags have their own
power source that powers only the
microchip. These have no transmitter.
They rely on altering the RF feld from
the transceiver to transmit their data.
There are three ways for data en-
coding into tags:
1. Read-only tags contain data,
which is pre-written onto them by the
tag manufacturer or distributor.
2. Write-once tags enable a user to
write data to the tag one time in pro-
duction or distribution processes.
3. Full read-write tags allow new
data to be written to the tag as needed
and later other data can be rewritten
over the original data.
RF transceiver. The RF transceiver
is the source of the RF energy used to
activate and power the passive RFID
tags. It may be enclosed in the same
cabinet as the reader or it may be a
separate piece of equipment. When
provided as a separate piece of equip-
ment, the transceiver is commonly
referred to as an RF module. The RF
transceiver controls and modulates
the radio frequencies that the antenna
transmits and receives. The transceiver
flters and amplifes the back-scatter
signal from a passive RFID tag.
circuit description
Fig. 5 shows the circuit of the RFID-
based security system. The compact
circuitry is built around Atmel
AT89C52 microcontroller. The
AT89C52 is a low-power, high-
performance CMOS 8-bit mi-
crocomputer with 8 kB of Flash
programmable and erasable read-
only memory (PEROM). It has 256
bytes of RAM, 32 input/output
(I/O) lines, three 16-bit timers/
counters, a six-vector two-level in-
terrupt architecture, a full-duplex
serial port, an on-chip oscillator
and clock circuitry. The system
clock also plays a signifcant role
in operation of the microcon-
troller.
An 11.0592MHz quartz crys-
tal connected to pins 18 and
19 provides basic clock to the
microcontroller. Power-on reset
is provided by the combination
of electrolytic capacitor C4 and
resistor R1. Switch S1 is used
for manual reset. Port pins P2.0
through P2.7 of the microcon-
troller are connected to data port
pins D0 through D7 of the LCD,
respectively. Port pins P3.7 and
P3.6 of the microcontroller are
connected to register-select (RS)
and enable (E) pins of the LCD,
respectively. Read/write (R/W)
pin of the LCD is grounded to en-
able for write operation.
All the data is sent to the LCD
in ASCII format for display. Only
the commands are sent in hex form.
Register-select (RS) signal is used to
distinguish between data (RS=1) and
command (RS=0). Preset VR1 is used
to control the contrast of the LCD.
Resistor R6 limits the current through
the backlight of the LCD. Port pins P3.0
(R
XD
) and P3.1 (T
XD
) of the microcon-
troller are used to interface with the
RFID reader.
When an authorised person having
the tag enters the RF feld generated by
the RFID reader, RF signal is generated
by the RFID reader to transmit energy
to the tag and retrieve data from the
tag. Then the RFID reader communi-
cates through R
XD
and T
XD
pins of the
microcontroller for further processing.
Fig. 6: An actual-size, single-side PCB for the RFID-based security system
Fig. 7: Component layout for the PCB
cONSTRUcTION
electroni cs for you December 2010 105 www. e f y ma g . c o m
RFID.C
#include<reg51.h>
sbit RS=P3^7;
sbit EN=P3^6;
sbit R=P3^2; // for relay
sbit bz=P1^7; // for piezo buzzer
void Rxmsg(void);
void lcdinit(void);
void lcdData(unsigned char l);
void lcdcmd(unsigned char k);
void DelayMs(unsigned int count);
void sucessRx(void);
void unknown(void);
void display(unsigned char s, t);
void welcome(void);
void main()
{
unsigned char i=0;
unsigned int j=0;
unsigned char c[15];
TMOD=0x20; //Confg-
ure the serial port to 9600 baud rate
TH1=0xFD;
SCON=0X50;
TR1=1;
R=0;
lcdinit();
welcome();
bz=1;
while(1)
{
back:
for(i=0;i<15;i++)
//command to recv data
{
c[i]=0xFF;
}

while(RI==0);
for(i=0;i<15;i++)
//command to recv data
{
j=0;
while(RI==0)
{
if(j>=1000)
goto timeout;
j++;
}
c[i]=SBUF;
RI=0;
}
timeout:
for(i=0;i<15;i++)
{
i f ( c [ i ] = = 1 & & c [ i + 1 ] = = E
&& c[i+2]==0 && c[i+3]==0 &&
c [ i + 4 ] = = 7 & & c [ i + 5 ] = = C
&& c[i+6]==A && c[i+7]==0 &&
c[i+8]==3 && c[i+9]==C)
// RFID code
{
sucessRx();
DelayMs(1000);
R=1;
bz=0;
DelayMs(1000);
R=0;
bz=1;
DelayMs(1000);
lcdinit();
DelayMs(100);
welcome();
goto back;
}
}
unknown();
DelayMs(2000);
bz=0;
DelayMs(2000);
bz=1;
DelayMs(1000);
lcdinit();
DelayMs(100);
welcome();
}
}
void sucessRx()
{
unsigned int i=0;
unsigned char c[]=ACCESS GRANTED ;
lcdcmd(0x01);
DelayMs(10);
lcdcmd(0x80);
DelayMs(10);
while(c[i]!=\0)
{
lcdData(c[i]);
i++;
}
}
void unknown(void)
{
unsigned int i=0;
unsigned char c[]=ACCESS DENIED;
lcdcmd(0x01);
DelayMs(10);
lcdcmd(0x80);
DelayMs(10);
while(c[i]!=\0)
{
lcdData(c[i]);
i++;
}
}
//-------------------------------
// Lcd initialization subroutine
//-------------------------------
void lcdinit(void)
{
lcdcmd(0x38);
DelayMs(250);
lcdcmd(0x0E);
DelayMs(250);
lcdcmd(0x01);
DelayMs(250);
lcdcmd(0x06);
DelayMs(250);
lcdcmd(0x80);
DelayMs(250);
}
//--------------------------------
// Lcd data display
//--------------------------------
void lcdData(unsigned char l)
{
P2=l;
RS=1;
EN=1;
DelayMs(1);
EN=0;
return;
}
//---------------------------------
// Lcd command
//---------------------------------
void lcdcmd(unsigned char k)
{
P2=k;
RS=0;
EN=1;
DelayMs(1);
EN=0;
return;
}
//---------------------------------
// Delay mS function
//---------------------------------
void DelayMs(unsigned int count)
{ // mSec Delay 11.0592 Mhz
unsigned int i;
// Keil v7.5a
while(count) {
i = 115; //
115 exact value
while(i>0)
i--;
count--;
}
}
void welcome(void)
{
unsigned int i=0;
unsigned char c[]=WELCOME TO RFID;
unsigned char d[]=SECURITY SYSTEM;
lcdcmd(0x01);
DelayMs(10);
lcdcmd(0x80);
DelayMs(10);
while(c[i]!=\0)
{
lcdData(c[i]);
i++;
}
lcdcmd(0xc0);
i=0;
while(d[i]!=\0)
{
lcdData(d[i]);
i++;
}
}

Thus on identifying the authorised per-


son, port pin P3.2 goes high, transistor
T2 drives into saturation, and relay
RL1 energises to open the door for
the person. Simultaneously, the LCD
shows access granted message and
port pin P1.7 drives piezobuzzer PZ1
via transistor T1 for aural indication.
If the person is unauthorised, the
LCD shows access denied and the
door doesnt open. LED2 and LED3
show presence of the tag in the RFID
readers electromagnetic feld.
To derive the power supply, the
230V, 50Hz AC mains is stepped
down by transformer X1 to deliver a
secondary output of 15V, 500 mA. The
transformer output is rectifed by a
full-wave rectifer comprising diodes
D1 through D4, fltered by capacitor
C1 and regulated by ICs 7812 (IC2) and
7805 (IC3). Capacitor C2 bypasses the
ripples present in the regulated supply.
LED1 acts as the power indicator and
R2 limits the current through LED1.
An actual-size, single-side PCB for
RFID-based security system is shown
in Fig. 6 and its component layout in
Fig. 7. Assemble the circuit on a PCB as
it minimises time and assembly errors.
Carefully assemble the components and
double-check for any overlooked error.
Software
The software for this project is given
at the end of this article. It is written in
C language and compiled using Keil
Vision4 compiler. The fnally obtained
.hex code is burnt into the microcon-
troller using a suitable programmer.
The program is easy to understand.
EFY note. The source code of
this project has been included in this
months EFY-CD and is also available
on www.efymag.com website.
The complete kit of this project is
available with KitsnSpares.
The author is founder & CEO of HBeonLabs,
Greater Noida

You might also like