Sie sind auf Seite 1von 4

cONSTRU c TION

RFiD-BaSeD SecURitY SYStem

BikRamjeet waRaich

A radio-frequency identification

(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

 

PArts List

Semiconductors:

IC1

- AT89C52 microcontroller - 7812, 12V regulator - 7805, 5V regulator - RFID reader module - BC558 pnp transistor - BC547 npn transistor - 1N4007 rectifier diode - 5mm LED - 16-character, 2-line

IC2

IC3

IC4

T1

T2

D1-D5

LED1-LED3

LCD

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

- 1000μF, 25V electrolytic - 0.1μF ceramic disk - 10μF, 16V electrolytic - 22pF ceramic disk

C2, C3

C4

C4, C5

Miscellaneous:

X1

- 230V AC primary to 15V, 500mA secondary transformer - Push-to-on switch - 11.0592MHz crystal - 12V, 1C/O relay - Piezobuzzer

S1

X TAL

RL1

PZ1

- RFID tag

- 12V DC door lock actuator

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

such things as an identity code, personal medical Fig. 1: A user is trying to open

Fig. 1: A user is trying to open the door by placing an RFID tag near the RFID reader

Sunil Kumar
Sunil Kumar

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 field. Commonly, at the heart of each tag is a microchip. When the tag enters the generated RF field, it is able to draw enough power from the field 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 fields 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 field 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-

transceiver field rfid transponder rfid reader received data passive transceiver tag tag modulates rf field
transceiver field
rfid
transponder
rfid reader
received data
passive
transceiver
tag
tag modulates
rf field WitH data
modulated rf field

Fig. 2: A typical RFID system

102

December

2010

electronics

for

you

www.efymag.com

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 system’s 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 configured either as a handheld or a fixed-mount device. The reader emits radio waves in ranges

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 reader’s activation signal. The reader decodes the data encoded in the tag’s 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-

Wire

cHip

pad Bonding cHip primer encapsulation silicon antenna encapsulation
pad
Bonding
cHip
primer
encapsulation
silicon
antenna
encapsulation
material material cHip cHip primer pad
material
material
cHip
cHip
primer
pad

Fig. 3: Internal diagram of a typical RFID antenna

pad Fig. 3: Internal diagram of a typical RFID antenna F i g . 4 :

Fig. 4: Internal structure of a typical RFID tag

cONSTRUc TION

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 identifier, or licence plate number, that uniquely identifies 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 field 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 field 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

its battery. As a result, active tags can be detected at a Fig. 5: Circuit of

Fig. 5: Circuit of the RFID-based security system

www.efymag.com

electronics

for

you

December

2010

103

cONSTRU c TION

cONSTRU c TION Fig. 6: An actual-size, single-side PCB for the RFID-based security system Fig. 7:

Fig. 6: An actual-size, single-side PCB for the RFID-based security system

single-side PCB for the RFID-based security system Fig. 7: Component layout for the PCB greater range

Fig. 7: Component layout for the PCB

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 field 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 filters and amplifies 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 significant 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 field 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.

104

December

2010

electronics

for

you

www.efymag.com

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 doesn’t open. LED2 and LED3 show presence of the tag in the RFID reader’s electromagnetic field. 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 rectified by a full-wave rectifier comprising diodes D1 through D4, filtered 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.

cONSTRUc TION

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 finally 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 month’s EFY-CD and is also available on www.efymag.com website. The complete kit of this project is available with Kits’n’Spares.

The author is founder & CEO of HBeonLabs, Greater Noida

RFID.C

#include<reg51.h>

bz=0;

DelayMs(250);

 

sbit RS=P3^7;

DelayMs(1000);

}

sbit EN=P3^6;

R=0;

//--------------------------------

 

sbit R=P3^2;

// for relay // for piezo buzzer

 

bz=1;

// Lcd data display

 

sbit bz=P1^7;

DelayMs(1000);

//--------------------------------

 

void Rxmsg(void);

lcdinit();

void lcdData(unsigned char l)

void lcdinit(void);

DelayMs(100);

{

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()

 

welcome();

P2=l;

goto back;

RS=1;

}

EN=1;

}

DelayMs(1);

 

unknown();

EN=0;

DelayMs(2000);

return;

bz=0;

}

DelayMs(2000);

//---------------------------------

 

{

bz=1;

// Lcd command

 

unsigned char i=0; unsigned int j=0; unsigned char c[15];

 

DelayMs(1000);

//---------------------------------

 

lcdinit();

void lcdcmd(unsigned char k)

DelayMs(100);

{

TMOD=0x20;

// Config-

welcome();

P2=k;

ure the serial port to 9600 baud rate

 

}

RS=0;

TH1=0xFD;

}

EN=1;

SCON=0X50;

void sucessRx()

DelayMs(1);

 

TR1=1;

{

EN=0;

R=0;

unsigned int i=0;

return;

lcdinit();

unsigned char c[]=”ACCESS GRANTED “;

}

welcome();

lcdcmd(0x01);

//---------------------------------

 

bz=1;

DelayMs(10);

// Delay mS function

 

while(1)

lcdcmd(0x80);

//---------------------------------

 

{

DelayMs(10);

void DelayMs(unsigned int count)

back:

while(c[i]!=’\0’)

// mSec Delay 11.0592 Mhz unsigned int i; // Keil v7.5a while(count) { i = 115; 115 exact value

{

for(i=0;i<15;i++)

{

//command to recv data

 

lcdData(c[i]);

{

i++;

c[i]=0xFF;

}

//

}

}

void unknown(void)

 

while(i>0)

while(RI==0);

{

i--;

for(i=0;i<15;i++)

unsigned int i=0;

 

count--;

//command to recv data

 

unsigned char c[]=”ACCESS DENIED”;

}

{

lcdcmd(0x01);

}

j=0;

DelayMs(10);

void welcome(void)

 

while(RI==0)

lcdcmd(0x80);

{

{

DelayMs(10);

unsigned int i=0; unsigned char c[]=”WELCOME TO RFID”;

 

if(j>=1000)

while(c[i]!=’\0’)

goto timeout;

{

unsigned char d[]=”SECURITY SYSTEM”;

j++;

lcdData(c[i]);

lcdcmd(0x01);

 

}

i++;

DelayMs(10);

c[i]=SBUF;

}

lcdcmd(0x80);

RI=0;

}

DelayMs(10);

}

//-------------------------------

while(c[i]!=’\0’)

timeout:

// Lcd initialization subroutine

{

for(i=0;i<15;i++)

//-------------------------------

lcdData(c[i]);

 

{

void lcdinit(void)

i++;

if(c[i]==’1’

&&

c[i+1]==’E’

{

}

&& c[i+2]==’0’ && c[i+3]==’0’

&&

lcdcmd(0x38);

lcdcmd(0xc0);

 

c[i+4]==’7’

&&

c[i+5]==’C’

DelayMs(250);

i=0;

&& c[i+6]==’A’ && c[i+7]==’0’ c[i+8]==’3’ && c[i+9]==’C’) // RFID code

&&

lcdcmd(0x0E);

while(d[i]!=’\0’)

 

DelayMs(250);

{

lcdcmd(0x01);

lcdData(d[i]);

 

{

DelayMs(250);

i++;

sucessRx();

lcdcmd(0x06);

}

DelayMs(1000);

DelayMs(250);

}

R=1;

lcdcmd(0x80);

 

www.efymag.com

electronics

for

you

December

2010

105