You are on page 1of 4

CONSTRUCTION

DEEPAK GUPTA

RFID INTERFACE TO 8051


Radio frequency identification (RFID) is a generic term that is used to describe a system that transmits the identity (in the form of a unique serial number) of an object or person wirelessly, using radio waves. It's grouped under the broad category of automatic identification technologies. The concept is similar to traditional barcodes. A barcode represents information in a condensed format (usually lines) that takes little space and can be read by a machine. Compared to barcodes, RFID tags are "smarter": the information on the micro-chip can be read automatically, at a distance, by another wireless machine. This means RFID is easier to use and more efficient than barcodes: there is no need to pass

EM TESTED EM TESTED

TED EM TES

Deepak Gupta
each individual object/animal/person in front of a scanner to retrieve the information contained in each tag. The identification is done through a unique serial number. An RFID module basically consists of two parts, namely, a tag and a reader. A typical RFID system consists of an antenna, a transceiver and a transponder (RF tag). The radio frequency is read by the transceiver and the information is transferred to a device for further processing. The information (the unique serial number) to be transmitted is stored in the RF tag or transponder. A basic RFID system consists of three components: An antenna or coil A transceiver (with decoder)
+5V

RFID MODULE

LCD 16 15 14 13 12 11 10 9 8 7 31 10uF 25V 1uF/63V 1 2 MAX 232 12 6 15 10K 1uF/63V 9 RST 10 89C51 28
27 26 25 24 23 22 21

6 5

4 3 2 1

40

13 1uF/63V 3 4 1uF/63V 5

16

10K

12MHz

18 19 20

3 2 1

CONSTRUCTION
A transponder (RF tag) electronically programmed with unique information The antenna emits radio signals to activate the tag and to read and write data to it. The reader emits radio waves in ranges of anywhere from one inch to 100 feet or more, depending upon its power output and the radio frequency used. When a 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. The purpose of an RFID system is to enable data to be transmitted by a portable device, called a tag, which is read by an RFID reader and processed according to the needs of a particular application. The data transmitted by the tag may provide identification or location information, or specifics about the product tagged, such as price, color, date of purchase, etc. RFID technology has been used by thousands of companies for a decade or more. . RFID quickly gained attention because of its ability to track moving objects. As the technology is refined, more pervasive - and invasive - uses for RFID tags are in the works. A typical RFID tag consists of a microchip attached to a radio antenna mounted on a substrate. The chip can store as much as 2 kilobytes of data. To retrieve the data stored on an RFID tag, you need a reader. A typical reader is a device that has one or more antennas that emit radio waves and receive signals back from the tag. The reader then passes the information in digital form to a computer system. Different RFID tags work on different frequencies. Here low frequency, 125 kHz, RFID tags have been used. These tags work within a range of 10 cm. When an RFID tag comes in this range, the reader detects it and sends a unique code of the tag serially. This serial code, consisting of 12 bytes, is received by the microcontroller. the serial communication. The receiver pin of RFID reader is connected to R1IN (pin13) of MAX232. R1OUT (pin 12) of MAX232 is connected to RxD (P3.0) of microcontroller. In the program, Timer1 is configured for serial communication. The baud rate is set to 9600bps for data transmission. The LCD is initialized to display the code. When a card/tag comes in the proximity of RFID reader, the microcontroller reads the code and sends it to the LCD module.

Component Used
89c51 AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. AT89C51 has 4KB of Flash programmable and erasable read only memory and 128 bytes of RAM. It can be erased and program to a maximum of 1000 times. In 40 pin AT89C51, there are four ports designated as P1, P2, P3 and P0. All these ports are 8-bit bidirectional ports, i.e., they can be used as both input and output ports. Except P0 which needs external pull-ups, rest of the ports have internal pull-ups. When 1s are written to these port pins, they are pulled high by the internal pull-ups and can be used as inputs. These ports are also bit addressable and so their bits can also be accessed individually.

Circuit Explanation
89c51 cannot be directly connected to a RFID module, a serial converter is required. IC MAX232 has been used for this purpose. Pins 1-3 of port P1 (P1.0, P1.1 & P1.2 respectively) of AT89C51 are connected to the control pins 4-6 LCD. The unique identification code of RFID tag is displayed on the LCD. Receiver1 (R1) of MAX232 has been used for

CONSTRUCTION
Port P0 and P2 are also used to provide low byte and high byte addresses, respectively, when connected to an external memory. Port 3 has multiplexed pins for special functions like serial communication, hardware interrupts, timer inputs and read/write operation from external memory. AT89C51 has an inbuilt UART for serial communication. It can be programmed to operate at different baud rates. Including two timers & hardware interrupts, it has a total of six interrupts. The main features of 8051 microcontroller are: I. RAM 128 Bytes (Data memory) Ii. ROM 4Kbytes (ROM signify the on chip program space) Iii. Serial Port Using UART makes it simpler to interface for serial communication. Iv. Two 16 bit Timer/ Counter V. Input/output Pins 4 Ports of 8 bits each on a single chip. Vi. 6 Interrupt Sources Vii.8 bit ALU (Arithmetic Logic Unit) viii. Harvard Memory Architecture It has 16 bit Address bus (each of RAM and ROM) and 8 bit Data Bus. Ix. 8051 can execute 1 million one-cycle instructions per second with a clock frequency of 12MHz. MAX 232 The MAX232 IC is used to convert the TTL/CMOS logic levels to RS232 logic levels during serial communication of microcontrollers with PC. The
Pin No 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Output pin; outputs the serially transmitted data at RS232 logic level; connected to receiver pin of PC serial port Input pin; receives serially transmitted data at RS 232 logic level; connected to transmitter pin of PC serial port Output pin; outputs the serially transmitted data at TTL logic level; connected to receiver pin of controller. Input pins; receive the serial data at TTL logic level; connected to serial transmitter pin of controller. Output pin; outputs the serially transmitted data at TTL logic level; connected to receiver pin of controller. Input pin; receives serially transmitted data at RS 232 logic level; connected to transmitter pin of PC serial port Output pin; outputs the serially transmitted data at RS232 logic level; connected to receiver pin of PC serial port Ground (0V) Supply voltage; 5V (4.5V 5.5V) Capacitor connection pins Function

C1

16 Vcc

C3+

15 GND

C1-

14 T1 Out

C2+

4 MAX232

13 R1 In

C2-

12 R1 Out

C4-

11 R1 Out

T2 Out

10 T2 In

R2 In

9 R2 Out

controller operates at TTL logic level (0-5V) whereas the serial communication in PC works on RS232 standards (-25 V to + 25V). This makes it difficult to establish a direct link between them to communicate with each other. The intermediate link is provided through MAX232. It is a dual driver/receiver that includes a capacitive voltage generator to supply RS232 voltage levels from a single 5V supply. Each receiver converts RS232 inputs to 5V TTL/CMOS levels. These receivers (R1 & R2) can accept 30V inputs. The drivers (T1 & T2), also called transmitters, convert the TTL/CMOS input level into RS232 level. The
Name Capacitor 1 + Capacitor 3 + Capacitor 1 Capacitor 2 + Capacitor 2 Capacitor 4 T2 Out R2 In R2 Out T2 In T1 In R1 Out R1 In T1 Out Ground Vcc

CONSTRUCTION
transmitters take input from controllers serial transmission pin and send the output to RS232s receiver. The receivers, on the other hand, take input from transmission pin of RS232 serial port and give serial output to microcontrollers receiver pin. MAX232 needs four external capacitors whose value ranges from 1F to 22F. } lcd_string(unsigned char *disp) send string { int x; for(x=0;disp[x]!=0;x++) { lcd_data(disp[x]); } } //Function to

Pin Description:
USES detect counterfeit pharmaceuticals track the lifecycle of dangerous chemicals identify the location of a container in a warehouse, etc.

Program Code
#include<reg51.h> unsigned int data_out,command=0x80,temp; sfr lcd_data_pin=0xA0; //P2 port sbit rs=P1^0; //Register select sbit rw=P1^1; //Read/Write sbit en=P1^2; //Enable pin unsigned char card_id[12]; void delay(unsigned int count) //Function to provide delay { int i,j; for(i=0;i<count;i++) for(j=0;j<1275;j++); } void lcd_cmd(unsigned char comm) //Lcd command funtion { lcd_data_pin=comm; en=1; rs=0; rw=0; delay(1); en=0; } void lcd_data(unsigned char disp) function { lcd_data_pin=disp; en=1; rs=1; rw=0; delay(1); en=0; //Lcd data

void lcd_init() //Function to initialize the LCD { lcd_cmd(0x38); delay(5); lcd_cmd(0x0F); delay(5); lcd_cmd(0x80); delay(5); } void recieve() //Function to recieve data serialy from RS232 { unsigned char k; for(k=0;k<12;k++) { while(RI==0); card_id[k]=SBUF; RI=0; } } void main() { int l; TMOD=0x20; //Enable Timer 1 TH1=0XFD; SCON=0x50; TR1=1; // Triggering Timer 1 lcd_init(); lcd_cmd(0x81); //Place cursor to second position of first line lcd_string("UNIQUE ID:"); delay(200); while(1) { recieve(); lcd_cmd(0xC1); //Place cursor to second position of second line for(l=0;l<12;l++) { lcd_data(card_id[l]); } }

You might also like