EM18 RFID Reader Interface with AVR ATmega16/ATmega32.

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 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 ATmega 16 and how to use it, refer to the topic on USART in AVR Atmega16/ATmega32 in the ATmega inside section.                                        

EM18 RFID Reader
EM18 RFID Reader

 

Connection Diagram of RFID with ATmega16/32

Interfacing EM18 RFID Reader With ATmega 16/32
Interfacing EM18 RFID Reader With ATmega 16/32

 

Read RFID Tag and display on LCD16x32 using Atmega16/32

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

RFID Reader Code for ATmega16/32

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

Program

/*
 * ATmega16_RFID_Project_File.c
 *
 * http://www.electronicwings.com
 */ 

#define F_CPU 8000000UL
#include <avr/io.h>
#include <string.h>
#include "USART_RS232_H_file.h"  /* add USART library */
#include "LCD16x2_4bit.h"  /* add LDC16x2 library */
#include <util/delay.h>

int main()
{
	char RFID[15];
	USART_Init(9600);  /* initialize USART with 9600 baud rate */
	lcdinit();  /* initialize LCD16x2 display */
	lcd_clear();
	lcd_gotoxy(0,0);  /* Set row and column position at 0,0 */		
	memset(RFID,0,15);
	lcd_print("RFID:");
	while(1)
	{	
		for (int i=0;i<12;i++)
		{
			RFID[i]=USART_RxChar();
		}
		_delay_us(10);
		lcd_gotoxy(0,1);
		lcd_print(RFID);  /* print 12 digit tag number on LCD */
	}  
}

 

Video of RFID reader using ATmega16/32


Components Used

ATmega 16
ATmega 16
1
Atmega32
Atmega32
1
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.
1
LCD16x2 Display
LCD16x2 Display
1

Downloads

ATmega16 / 32 RFID Project File Download
Ad