RFID Tags and Readers.

RFID Tags and Readers.

RFID tags is an ID system that uses small radio frequency identification devices for identification and tracking process. The RFID tagging system includes the tag is self, a read/write device, and a host system allocation for data collection, processing and transmission. 

I used this technology for my smart toy. Using this identification technology I improved my smart car toy when its hit any object while moving, it will recognize the object with RFID readers and tags. RFID tag will be in the object and reader is in the car circuit. Talking about positioning the tags it will be in lower range from the floor, where reader of the RFID can detect the range according to its radio frequency. 

Below you can see my code which is coded in Arduino IDE platform.

#include <SPI.h> //Serial Port connection enable
#include <MFRC522.h> //RFID module import  


#define RST_PIN         5          // Configurable, see typical pin layout above 
#define SS_PIN          53         // Configurable, see typical pin layout above  


MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance  


void setup() 
{
 Serial.begin(9600); 
 BTserial.begin(9600); //start the bluetooth connection 
 SPI.begin();      // Init SPI bus 
 mfrc522.PCD_Init();   // Init MFRC522 
 mfrc522.PCD_DumpVersionToSerial();  // Show details of PCD - MFRC522 Card Reader details

  
digitalWrite(45, HIGH); //Start RFID. 
void loop() 
  // Look for new cards (This Method is only to detect a tag)   
     if ( (! mfrc522.PICC_IsNewCardPresent()) || ( ! mfrc522.PICC_ReadCardSerial()))   
    {  
       /*       
        *Here the code to control car       
       */  
     } else   

   { 
      /*If any RFID tag is detected then the id of the tag will send via  
            Bluetooth to Mobile serial*/ 


         String s = ""; 

        for (byte i = 0; i < mfrc522.uid.size; i++)     
       {  
           //prasing the int into String       

          Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");       
          Serial.print(mfrc522.uid.uidByte[i], HEX);
          s += (String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));      
          s += (String(mfrc522.uid.uidByte[i], HEX));     
   } 
      s = "";//Reset the string value. 
}       


 This module working in 13.5KHz frequency and able to recognise tags within very short distance.

This module can communicate with Arduino in two ways. One is I2C method and the other one is SPI communication. I have tried both ways but SPI is easy and fast than the I2C. So I have recommended to my team the SPI. Then we had to face for another problem. There are two SPi devices. So they both sharing the same pins.finally we came up with a solution to communicate with two devices using one Arduino. Therefore, Slave Select (SS)  pin must be at HIGH state to active the module and the other module’s  SS pin should be keep LOW state. 

Comments