Overview of RFID
EM18 RFID reader module is used to read RFID cards that work at 125 kHz.
When an RFID card comes in the range of the reader, the unique data in the card is received by the reader in the form of an RF signal.
The reader then transmits this data in byte form on its serial transmit pin.
This data can be read by a microcontroller using USART communication or can be viewed on the PC terminal.
For more information on the EM18 RFID reader and how to use it, refer to the topic RFID Reader EM18 in the sensors and modules section.
For information on USART in PIC18F4550 and how to use it, refer to the topic on USART in PIC18F4550 in the PIC inside section.
Connection Diagram of RFID EM-18 to PIC18F4550
Read RFID EM-18 using PIC18F4550
Read the RFID tags using an EM-18 RFID reader and send this data serially to the PIC18F4550 microcontroller. Then, display the 12 Byte unique ID on the LCD16x2 display.
RFID EM-18 Code for PIC18F4550
- Initialize USART communication.
- Initialize the LCD16x2 display.
- Now, wait for 12-byte to receive and then display it on LCD16x2.
Program
/*
* 125 kHz RFID interface with PIC18F4550
* http://www.electronicwings.com
*
*/
#include <string.h>
#include <stdio.h>
#include <pic18f4550.h>
#include "Configuration_Header_File.h"
#include "LCD_16x2_8-bit_Header_File.h"
#include "USART_Header_File.h"
void main(void)
{
unsigned char i;
unsigned char ID[13];
OSCCON=0x72; /* select internal oscillator freq = 8 Mhz */
LCD_Init(); /* initialize LCD16x2 */
USART_Init(9600); /*initialize USART Communication with 9600 baud rate */
memset(ID,0,13);
LCD_String_xy(0,0,"RFID: ");
while(1)
{
for(i=0;i<12;i++)
{
ID[i]=USART_RxChar(); /* Receiving Data and Storing it in data_in */
}
LCD_String_xy(1,0,ID); /* Send Received data to LCD */
memset(ID,0,13);
}
}
Video of RFID Reader EM-18 using PIC18F4550
Components Used |
||
---|---|---|
RFID Reader EM18 EM18 RFID reader module is used to read 125 kHz RFID card wirelessly for a very short distance. It is generally used in applications like attendance system, access management, tracking of goods etc. |
X 1 | |
LCD16x2 Display LCD16x2 Display |
X 1 | |
PIC18f4550 PIC18f4550 |
X 1 | |
PICKit 4 MPLAB PICKit 4 MPLAB |
X 1 |
Downloads |
||
---|---|---|
|
PIC18F4550 RFID Interface Project File | Download |