How to interface RFID with AVR ATmega32 microcontroller

circuit-kit-rfid-interface-with-avr-microcontroller

RFID is most arguably a evolutionary wireless technology which boosted working of embedded devices up to great mark.And there is plenty of systems and devices working based on this technology.This article is focused to teach you how to interface RFID with AVR microcontroller.Before moving on to that interfacing part let's begin with what RFID exactly is and how it works?

PRINCIPLE OF RFID:

rfid-working-principle

Radio Frequency identification describes the system in which the identity of an individual or object is transmitted by means of a unique serial number through radio waves.Usually RFID system consists of two basic components they are

  • Tag
  • Reader

RFID tags consists of a simple Microchip which stores 12 byte unique ID and an antenna through which the unique ID is read by the reader.Whereas Reader is nothing but a specifically designed hardware module that senses the tag whenever it brought within a specific range say for example 10cms.The reader emit radio waves and receive signals back from the tag which comes with different operating frequency and sensing distance.

When a RFID tag is brought within the specific range of the reader the unique ID is sensed.After reading the ID from the tag is read by the reader and then that unique id is passed onto a controller/processor.The controller in turn performs specific action using that ID based on the written code.

rfid-reader-module-tag

SCHEMATIC DESIGN OF RFID INTERFACE WITH AVR:

rfid-interface-with-avr-atmeag32-microcontroller

RFID module works at RS232 logic levels hence ATmega32 is connected to RFID module by means of a level converter IC MAX232.The unique ID from the RFID tag is converted into serial mode by means of the reader module and then transmitted to controller via MAX232.The baud rate is set to 9600bps for data transmission.The code was written in such a way when a card/tag comes in the proximity of RFID reader, the microcontroller reads the code and sends it to the LCD module for displaying.

CODE:

#include
         
          #include
          
           #include
           
            #define ctrl PORTA  #define en PA5  #define rw PA6  #define rs PA7  void lcd_cmd(unsigned char cmd)!void init_lcd(void)!void usartinit()!void lcd_write(unsigned char data)!void lcd_write_string()!unsigned char a!unsigned char value[15]!unsigned int b!unsigned int k=0,i=0,j,l!unsigned char value1[]={"140071D1A612"}!//Unique ID  unsigned char value2[]={"51005D6899FD"}!unsigned char value3[]={"MASTER"}!//Names assigned to ID  unsigned char value4[]={"STUDENT"}!unsigned char value5[]={"Unknown number"}!int main ()  {   DDRB=0xFF!DDRA=0xE0!init_lcd()!_delay_ms(50)!lcd_write_string("Show your TAG")!usartinit()!while(1)    {     while((UCSRA)&(1<
            
             

NOTE:

  • In the above code the unique ID's are identified and some specific individual name was assigned to it for better understanding.
  • If your RFID reader works with TTL logic you can eliminate the MAX232 IC in the schematic design.

7 Comments

  1. viranga

    what are the components inU2 and J2

    Reply
  2. Omedul Islam

    Code is not works for atmeha32

    Reply
    1. Frank Donald Frank Donald

      Omedul,
      May I know what problem you are facing ?

      Reply
  3. Alii

    hey i have a AVR dragon wiht Atmega16 and also i Arduino RFID reader.can they both work in VR studio ?would i have to import Arduino libraries ?
    need help asap!

    Reply
  4. Gauravraj Sah

    Can you please list all the softwares required during this process…Please… Its Urgent.?
    and I also want to display the result on my laptop too… so please suggest the software for that also.

    Reply
    1. Frank Donald Frank Donald

      Hi Gauravraj Sah,

      I don't think there is any software to run the simulation of this project.You should build one to showcase this as a project

      Reply

Leave a Comment

Your email address will not be published.Required fields are marked*

Baidu
map