Anda di halaman 1dari 4

CONSTRUCTION

RFID-BASED SECURITY SYSTEM

BIKrAMJEET WArAICH

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 microcontroller 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.

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 information. 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

SUNIL KU

MAR

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 IC2 - 7812, 12V regulator IC3 - 7805, 5V regulator IC4 - RFID reader module T1 - BC558 pnp transistor T2 - BC547 npn transistor D1-D5 - 1N4007 rectifier 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 C2, C3 C4 C4, C5 - 1000F, 25V electrolytic - 0.1F ceramic disk - 10F, 16V electrolytic - 22pF ceramic disk
Fig. 1: a user is trying to open the door by placing an RFID tag near the RFID reader

information or literally any type of information that can be stored in digital binary format. The RFID transceiver communicates 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 information. 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 READER

RFID TRANSPONDER

RECEIVED DATA

TRANSCEIVER

PASSIVE TAG

Miscellaneous: X1 - 230V AC primary to 15V, 500mA secondary transformer S1 - Push-to-on switch - 11.0592MHz crystal XTAL RL1 - 12V, 1C/O relay PZ1 - Piezobuzzer - RFID tag - 12V DC door lock actuator

TAG MODULATES RF FIELD WITH DATA

MODULATED RF FIELD

Fig. 2: A typical RFID system

1 0 2 D E C E M B E R 2 0 1 0 E L E C T RO N I C S F O R YO U

W W W. E F Y M AG . CO M

ConstruCtion
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 control the systems data acquisition and communication. These are available in a variety of shapes and sizes. Often, 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
WIRE BONDING PRIMER CHIP PAD CHIP

of anywhere from 2.54 cm (one inch) to 30 metres or more, depending upon its power output and the radio frequency 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-

ENCAPSULATION MATERIAL

ENCAPSULATION SILICON ANTENNA MATERIAL

CHIP

CHIP PAD

PRIMER

Fig. 3: Internal diagram of a typical RFID antenna

Fig. 4: internal structure of a typical RFID tag

chip containing identifying information 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: active, passive and semi-passive. Passive tags have no internal power source. These draw their power from the electromagnetic field generated 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

Fig. 5: Circuit of the RFID-based security system W W W. E F Y M AG . CO M e l e c t ro n i c s f o r yo u D E C E M B E R 2 0 1 0 1 0 3

CONSTRUCTION
circuitry is built around Atmel AT89C52 microcontroller. The AT89C52 is a low-power, highperformance CMOS 8-bit microcomputer with 8 kB of Flash programmable and erasable readonly memory (PEROM). It has 256 bytes of RAM, 32 input/output (I/O) lines, three 16-bit timers/ counters, a six-vector two-level interrupt 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 microcontroller. An 11.0592MHz quartz crystal 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 microcontroller 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 enable 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 (RXD) and P3.1 (TXD) of the microcontroller 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 communicates through RXD and TXD pins of the microcontroller for further processing.
W W W. E F Y M AG . CO M

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

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 encoding 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 production 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 equipment, 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 RFIDbased security system. The compact

1 0 4 D E C E M B E R 2 0 1 0 E L E C T RO N I C S F O R YO U

ConstruCtion
Thus on identifying the authorised person, 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 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.

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 microcontroller 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

RFID.C
bz=0; #include<reg51.h> DelayMs(1000); sbit RS=P3^7; R=0; sbit EN=P3^6; bz=1; sbit R=P3^2; // for relay DelayMs(1000); sbit bz=P1^7; // for piezo buzzer lcdinit(); void Rxmsg(void); DelayMs(100); void lcdinit(void); welcome(); void lcdData(unsigned char l); goto back; void lcdcmd(unsigned char k); } void DelayMs(unsigned int count); } void sucessRx(void); unknown(); void unknown(void); DelayMs(2000); void display(unsigned char s, t); bz=0; void welcome(void); DelayMs(2000); void main() bz=1; { DelayMs(1000); unsigned char i=0; lcdinit(); unsigned int j=0; DelayMs(100); unsigned char c[15]; welcome(); TMOD=0x20; // Config} ure the serial port to 9600 baud rate } TH1=0xFD; void sucessRx() SCON=0X50; { TR1=1; unsigned int i=0; R=0; unsigned char c[]=ACCESS GRANTED ; lcdinit(); lcdcmd(0x01); welcome(); DelayMs(10); bz=1; lcdcmd(0x80); while(1) DelayMs(10); { while(c[i]!=\0) back: { for(i=0;i<15;i++) lcdData(c[i]); //command to recv data i++; { } c[i]=0xFF; } } void unknown(void) { while(RI==0); unsigned int i=0; for(i=0;i<15;i++) unsigned char c[]=ACCESS DENIED; //command to recv data lcdcmd(0x01); { DelayMs(10); j=0; lcdcmd(0x80); while(RI==0) DelayMs(10); { while(c[i]!=\0) if(j>=1000) { goto timeout; lcdData(c[i]); j++; i++; } } c[i]=SBUF; } RI=0; //------------------------------} // Lcd initialization subroutine timeout: //------------------------------for(i=0;i<15;i++) void lcdinit(void) { { if(c[i]==1 && c[i+1]==E lcdcmd(0x38); && c[i+2]==0 && c[i+3]==0 && DelayMs(250); c[i+4]==7 && c[i+5]==C lcdcmd(0x0E); && c[i+6]==A && c[i+7]==0 && DelayMs(250); c[i+8]==3 && c[i+9]==C) lcdcmd(0x01); // RFID code DelayMs(250); { lcdcmd(0x06); sucessRx(); DelayMs(250); DelayMs(1000); lcdcmd(0x80); R=1; 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++; } }

W W W. E F Y M AG . CO M

e l e c t ro n i c s f o r yo u D E C E M B E R 2 0 1 0 1 0 5

Anda mungkin juga menyukai