Interface RFID Shield With Arduino

Interface RFID Shield With Arduino © Apache-2.0

Working with RFID is so much fun, you can do alot with these tags like controlling relay, turing lights on off, access control, door lock.

  • 3,439 views
  • 0 comments
  • 13 respects

Components and supplies

Apps and online services

About this project

Working with RFID is so much fun, you can do alot with these tags like controlling relay, turing lights on off, access control, door lock and many more. Although there are so many RFID reader in the market but in this article I will be using an Arduino RFID Shield from controleverything.com.

Why this shield

This shield is so easy to use, all you need to do is plug your Arduino into it and you are good to go. The RFID reader comes with a 6 inch cable so you can mount this out side a door or on wall.

1. Arduino RFID Shield

2. Arduino Nano

Step 1: RFID Working

This RFID kit comes pre assembled so all you will need to do is plug your Arduino in it and you will be good to go.

This RFID works on UART protocol so to read the RFID tag we will need to read the UART data. In this sample code we will read the RFID tag and will display it on the serial monitor.

int count = 0;                                          // count = 0char input[11];                                         // character array of size 12 
                               
void setup()
{
 Serial.begin(9600);                                  // begin serial port with baud rate 9600bps
}
void loop()
{
 if(Serial.available())
 {
    count = 0;
    while(Serial.available() && count < 12)          // Read 12 characters and store them in input array
    {
       input[count] = Serial.read();
       count++;
       delay(5);
    }
    Serial.print(input);                             // Print RFID tag number 
    Serial.print("\n");   
 }
}

Whenever the user will bring a RFID tag near the RFID reader it will display the RFID tag number. For RFID wiring diagram please check this RFID Sch.

Step 2: RFID Tag matching

Using the earlier code we will read the RFID tags we have and then we will save them in a data base and then when the next time user brings his card near the RFID reader we will read and will compare it with the existing database.

# Arduino-RFID-Shied
#How to interface RFID Reader with arduino
#https://www.controleverything.com/content/RFID-Reader?sku=ANI2CU_EM18_RFID
int count = 0;                                          // count = 0
char input[11];                                         // character array   
void setup()
{  
Serial.begin(9600);               // begin serial port with baud rate 9600bps
}
void loop()
{     
if(Serial.available()) 
{ 
count = 0;  
while(Serial.available() && count < 12) // Read 12 characters and store them in input array      
{        
input[count] = Serial.read(); 
count++; 
delay(5);     
}      
Serial.print(input);                             // Print RFID tag number       Serial.print("\n");      
if ( strcmp(input,"0A006FBE33E9") == 0)      
{        
Serial.print("Tag One");        
Serial.print("\n");      
}     
if ( strcmp(input,"0E004560173D") == 0)      
{        
Serial.print("Tag Two");        
Serial.print("\n");      
}
if ( strcmp(input,"0A00706AF0E1") == 0)      
{        
Serial.print("Tag Three");        
Serial.print("\n");      
}
if ( strcmp(input,"28018389B696") == 0)      
{        
Serial.print("Tag Four");        
Serial.print("\n");      }
}
}

This code will read the RFID tag and will compare with the existing tag. You can also find the code over here.

RDIF Arduino Code

Step 3: RFID Projects

There is a lot which can be done with Arduino and this RFID shield.

1. RFID controlled gate

2. RFID controlled Door lock

3. RFID controlled lights

4. RFID attendance system

There is no soldering required in this kit so this is an ideal kit for schools, kids, software developers and all the people who doesn't want to do soldering.

This kit can be purchased from here: Arduino RFID kit

Code

Code snippet #1Plain text
int count = 0;                                          // count = 0char input[11];                                         // character array of size 12 
                                 
void setup()
{
   Serial.begin(9600);                                  // begin serial port with baud rate 9600bps
}
void loop()
{
   
   if(Serial.available())
   {
      count = 0;
      while(Serial.available() && count < 12)          // Read 12 characters and store them in input array
      {
         input[count] = Serial.read();
         count++;
         delay(5);
      }
      Serial.print(input);                             // Print RFID tag number 
      Serial.print("\n");   
   }
}
Github
https://github.com/bhaskar-anil429/Arduino-RFID-Shied/blob/master/Arduino_RFID.ino

Schematics

Arduino RFID shield wiring duagram

Comments

Similar projects you might like

Security Access Using RFID Reader

by Aritro Mukherjee

  • 260,291 views
  • 42 comments
  • 281 respects

Arduino RFID Keycard Access

Project tutorial by Brian Carbonette

  • 11,619 views
  • 1 comment
  • 25 respects

Arduino RFID Garage Door Opener

Project tutorial by Team RobotGeek Projects Team

  • 2,139 views
  • 1 comment
  • 6 respects

RFID Desk Lamp

Project tutorial by Kutluhan Aktar

  • 1,230 views
  • 0 comments
  • 3 respects

Arduino Ethernet Rfid card reader

Project tutorial by David Smerkous

  • 30,694 views
  • 15 comments
  • 50 respects

RFID Door Unlock

Project tutorial by Kirby G

  • 21,981 views
  • 1 comment
  • 53 respects
Add projectSign up / Login