Interfacing EM-18 μRFID reader TTL protocol with AT89S52
µRFID Reader used to read our RFID cards. Using the module with microcontrollers to read a card’s data is very simple and required just a serial connection.The module should be powered at 3.3 – 5.5 VDC, and it requires a direct connection to the microcontroller’s Serial Rx pin. The card data is transmitted over the serial line when the card is brought near the module.
RFID is Radio Frequency Identification. An RFID reader is used to read RFID tags (which contain certain unique data stored in a chip). An RFID reader and an RFID tag, both have a coil surrounding them. When an RFID tag is shown near an RFID Reader, it collects the unique tag data (a combination of digits and characters) from the RFID tag. Power the μRFID reader; when an RFID tag is shown near the reader, electromagnetic induction will take place between the coils and this powers the chip inside tag. This chip will send data electromagnetically to the reader. The reader will receive this electromagnetically transferred data and outputs it serially. Every RFID reader comes with Serial output pins. We can collect the read data through these serial pins using AT89S52.
- When a high value is sent to the SEL pin of the reader, TTL Serial communication is enabled.
- The output in this mode is the 10 digit card no (ASCII) + 2 digit XOR result (ASCII)
Communication parameters are-For eg: If the RFID tag number is 500097892E, output of µRFID reader will be 500097892E60 where 60 is 50 xor 00 xor 97 xor 89 xor 2E
Interfacing μRFID reader TTL protocol with AT89S52
A TTL compatible output pin can be connected directly to AT89S52. Make sure you connect Ground Pin of RFID reader to Ground Pin of AT89S52.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
/***************************************************************************************************** * Header file * *****************************************************************************************************/ #include<REGX52.H> #include<string.h> #define LCD_PORT P0 #define EN P1_0 #define RS P1_2 /***************************************************************************************************** * Function Decleration * *****************************************************************************************************/ void lcd_Initial(); void lcd_command(char value); void lcd_data(char value); void delay_ms(unsigned long int Delay); void delay_us(int Delay); void uart_initial(void); void lcd_display(unsigned char locn,const char *dat); /***************************************************************************************************** * Variable Decleration * *****************************************************************************************************/ char Rec_Data; char Rec_Array[17]; char rx_flg=0,j=0,i=0; volatile char stored_ID[13]="02000E6897F3"; /***************************************************************************************************** * Main code * *****************************************************************************************************/ void main() { uart_initial(); /* UART Initialization */ lcd_Initial(); /* LCD Initialization */ lcd_display(0x80,"RFID Based Login"); lcd_display(0xC0," System "); delay_ms(1000); lcd_display(0x80,"Use Your Tag to "); lcd_display(0xC0,"Login "); while(1) { if(RI==1) { RI=0; Rec_Data=SBUF; /* Intake of received data to variable */ Rec_Array[j]=Rec_Data; /* RFID card no stored into array */ j++; /* Increment array index */ if (j==12) /* Checking 12 digit no. rx complete */ { Rec_Array[j]='\0'; /* Adding null character */ j=0; lcd_command(0x01); delay_us(200); lcd_display(0x80,"Found "); delay_ms(500); lcd_display(0x80,"ID: "); lcd_display(0X83,Rec_Array); delay_ms(1000); delay_ms(1000); if(!strcmp(Rec_Array,stored_ID)) /* Comparing with Stored ID */ { lcd_display(0x80,"Login Succeeded "); /* Login sucess */ delay_ms(1000); lcd_display(0x80,"Use your Tag to "); lcd_display(0xC0,"Login "); } else { lcd_display(0x80,"Login Failed "); /* Login failed */ delay_ms(1000); lcd_display(0x80,"Use your Tag to "); lcd_display(0xC0,"Login "); } } } } } /*=================================================================================================== * Function : uart_initial * Description : Function to initialise UART * Parameters : None ====================================================================================================*/ void uart_initial(void) { TMOD=0X21; SCON=0X50; TF1=0; TR1=0; TH1=0XFD; TL1=0XFD; TR1=1; } /*===================================================================================================== * Function : lcd_Initial * Description : Function to Initialize LCD * Parameters : None ====================================================================================================*/ void lcd_Initial() { /* ---LCD Intialization Commands----- */ lcd_command(0x30); delay_us(5); /* LCD Specification Command */ lcd_command(0x30); delay_us(5); /* LCD Specification Command */ lcd_command(0x30); delay_us(5); /* LCD Specification Command */ lcd_command(0x38); /* LCD Double Line Display Command */ lcd_command(0x06); /* LCD Auto Increment Location cmmd */ lcd_command(0x0C); /* LCD Display ON Command */ lcd_command(0x01); delay_us(200); /* LCD Display Clear Cmdmand */ } /*===================================================================================================== * Function : lcd_command * Description : Function to send a command to LCD * Parameters : value, contains the command to be send ====================================================================================================*/ void lcd_command(char value) { RS=0; EN=1; LCD_PORT=value; delay_us(5); EN=0; } /*==================================================================================================== * Function : lcd_data * Description : Function to send a data to LCD * Parameters : value, contains the data to be send ====================================================================================================*/ void lcd_data(char value) { RS=1; EN=1; LCD_PORT=value; delay_us(5); EN=0; } /*=================================================================================================== * Function : delay_us * Description : Function to provide delayin us for LCD * Parameters : Delay, provide delay needed ====================================================================================================*/ void delay_us(int Delay) { while((--Delay)!=0); } /*=================================================================================================== * Function : delay_ms * Description : Function to provide delayin MS for LCD * Parameters : Delay, provide delay needed ====================================================================================================*/ void delay_ms(unsigned long int Delay) { Delay=Delay*15; while(--Delay!=0); } /*=================================================================================================== * Function : lcd_display * Description : Function to send a string of data in to LCD * Parameters : dat, contains the adddress of a string ====================================================================================================*/ void lcd_display(unsigned char locn,const char *dat) { lcd_command(locn); while(*dat!='\0') { lcd_data(*dat); dat++; } } /**************************************************************************************************** * END of Micro RFID Program * *****************************************************************************************************/ |
Resources
- Software
- Data sheet
- Example Projects
- Interfacing μRFID reader TTL protocol with AT89S52
- Interfacing μRFID reader Wiegand26 with AT89S52
- Interfacing μRFID reader TTL protocol with Arduino Uno
- Interfacing μRFID reader Wiegand26 with Arduino Uno
How to Buy?
- Click here to buy µRFID Reader (EM-18 compatible)
- Click here to buy the rhydoLABZ AT89S52 Mni Development Board (Mini) V1.01
- Click here to buy the rhydoLABZ AT89S52 Development Board
- Click here to buy the rhydoLABZ ATMEL 89SXX ISP Programmer (RS232)
Support
Please share your ideas with us, visit our forum for discussion
Frequently Asked Questions(FAQ):
Q. What is the frequency range of μRFID reader?
Ans. The operating frequency range of RFID card is 125kHz.
Q. What are the protocols μRFID reader supported?
Ans. There are two supported protocols namely TTL Serial & Wiegand 26 as per the system design.
Leave a Reply
You must be logged in to post a comment.