RFID Reader EM18 Interface with 8051

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.

14k views2 min readUpdated Aug 9, 2023

RFID EM18

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 UART 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 UART in 8051 and how to use it, refer to the topic on UART in 8051 in the 8051 inside section.

RFID Reader

Photo of EM18 RFID Reader
EM18 RFID Reader

 

8051 RFID Reader Connection Diagram

 RFID Reader Pin connection with 8051
8051 RFID Reader Connection Diagram

 

RFID Interface with 8051

  • Connect LCD data pins to PORT2 sequentially.
  • Connect LDC RS pin to P1.5, RW pin to P1.6, and E to P1.7 of the microcontroller.
  • RFID TX pin connects to the P3.0(RXD) of the microcontroller.

 

Example

Read the RFID tags using an EM-18 RFID reader and send this data serially to the 8051 microcontroller. Then, display the 12 Byte unique ID on the LCD16x2 display.

Programming Step

  • Initialize UART communication.
  • Initialize the LCD16x2 display.
  • Now, wait for 12-byte to receive and then display it on LCD16x2.

RFID EM18 Reader Code 8051

/*
 * 8051_RFID_project_file.c
 *
 * http://www.electronicwings.com
 */

#include<reg51.h>
#include<string.h>
#include <stdio.h>
#include"UART_H_file.h"	/* Add UART Library */
#include"LCD_8_BIT.h"	/* Add LCD16x2 Library */

void main()
{
	int l;
	char RFID[15];
	memset(RFID,0,15);
	UART_Init();	/* Initialize UART communication  */
	LCD_Init();	/* Initialize LCD16x2 display */
	LCD_String_xy(0,0);/* Set row and column position at 0,0 location */
	LCD_String("RFID:");
	while(1)
	{
		for(l=0;l<12;l++)
		{ 
			RFID[l]=UART_RxChar();
		}
		LCD_String_xy(0,1);
		LCD_String(RFID);  /* Print 12 digit tag on LCD */	 
	}	
}

 

Video of RFID Tag Reading using RFID Reader and 8051

 

Components Used

Powered byMouser Electronics
  • RFID Reader EM18

    RFID Reader EM18

    × 1

    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.

  • 8051 AT89c51

    8051 AT89c51

    AT89C5115-TISUM

Downloads

Comments10

Join the discussion — share a question or tip.

  • TR
    traderiam934

    Sir can you provide me the library of EM-18 Rafid Mudul's Proteus

  • SU
    SUBHASHNELAMANGALA

    is there any library file for the EM-18 reader module ? if it is there can you please share that zip file

    • JH
      jhansichapala

      if you got that can you please send me

  • RJ
    rj5547884

    how can i print the card no. on lcd using usart interrupt. i tried to use interrupt but the random values started displaying on the lcd .please help me as soon as possible. if possible please provide the code using interrupt.

  • SA
    Sagar

    Hi sir, Do you have any idea how to read rfid 522 with atmega32.

    • LO
      lokeshc

      RFID 522 is an SPI based module. To read its data, check datasheet which will give you a better idea about how to read its data.

  • UT
    utsav111

    how to get rfid tag data

    • LO
      lokeshc

      Just hold tag in front of rfid module and it will read that tag. Then it will automatically send data serially.

    • AU
      authorized· edited

      i think above document self explains that you are asking about. if still its not please be specific with your question so that someone can help with specific point that you did not understand.