RFID Basics


RFID stands for radio frequency identification and it basically uses the radio waves to read the information on the tag. The RFID tags contains the embedded transmitter and receiver attached to an object.

RFID is fast and does not require any contact between the reader and the tag and they can be read from feet’s away.

An RFID system consists of two parts: Tag and Reader



An RFID tag contains a chip for storing information about physical object and an antenna to receive and transmit a signal. A RFID tag can usually store 1KB of data but it is enough for storing the name, credit card number, unique identification number, birth date and some more information.

RFID Tags can be passive or active


  • Passive taghas no battery and it uses the energy transmitted by the reader.
  • An Active tagcontains a built in battery which makes it able to send a stronger signal and the range increases to 100 feet. Other features are same as the passive tags.


RFID Reader


The RFID reader performs two functions: Transmit and receive. So you can also say it a transceiver. The RFID reader contains an antenna, radio frequency module and a control unit

How RFID works

The RFID reader generates a high frequency electromagnetic field and when the tag comes near it, a voltage is induced in tags antenna coil due to induction. This induced voltage acts as power for the tag. The tag in return converts the signal in power and responds to the reader

RFID Arduino Interfacing

Now let’s interface the RFID reader module with Arduino. The RFID reader we are going to use is MFRC522 reader module and it communicates with the Arduino through SPI protocol. It operates at 13.56 MHz frequency.

The tags are based on MIFARE protocol and they have 1kb of memory. They also have a microchip that can perform arithmetic operations.

For RFID Arduino interfacing, you are going to require the following parts

  • Arduino Uno or any other Arduino
  • MFRC 522 RFID Module
  • I2C LCD Display
  • Three LED’s (Green, Red, Blue)
  • Sg90 servo motor
  • 3 X 220 ohm resistors
  • Buzzer



Now open the serial monitor and bring the RFID card in front of the reader, it will show you the information of the RFID tag. Save the UID number, we are going to use it in the second example.

In the above image, you can see the UID number of the tag and also the 1kb of memory which is divided into 16 sectors. Each sector has 4 blocks and each block can store 4 bytes.


// Include required libraries

#include <LiquidCrystal_I2C.h>

#include <SPI.h>

#include <MFRC522.h>

#include <Servo.h>


// Create instances

LiquidCrystal_I2C lcd(0x27, 16, 2);

MFRC522 mfrc522(10, 9); // MFRC522 mfrc522(SS_PIN, RST_PIN)

Servo sg90;


// Initialize Pins for led’s, servo and buzzer

// Blue LED is connected to 5V

constexpr uint8_t greenLed = 7;

constexpr uint8_t redLed = 6;

constexpr uint8_t servoPin = 8;

constexpr uint8_t buzzerPin = 5;


String tagUID = “29 B9 ED 23”; // String to store UID of tag. Change it with your tag’s UID


void setup() {

// Arduino Pin configuration

pinMode(buzzerPin, OUTPUT);

pinMode(redLed, OUTPUT);

pinMode(greenLed, OUTPUT);


sg90.attach(servoPin); //Declare pin 9 for servo

sg90.write(0); // Set initial position at 90 degrees


lcd.begin(); // LCD screen


SPI.begin(); // Init SPI bus

mfrc522.PCD_Init(); // Init MFRC522





void loop() {

lcd.setCursor(0, 0);

lcd.print(” RFID Door Lock”);

lcd.setCursor(0, 1);

lcd.print(” Show Your Tag “);


// Look for new cards

if ( ! mfrc522.PICC_IsNewCardPresent()) {




// Select one of the cards

if ( ! mfrc522.PICC_ReadCardSerial()) {




//Reading from the card

String tag = “”;

for (byte i = 0; i < mfrc522.uid.size; i++)


tag.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? ” 0″ : ” “));

tag.concat(String(mfrc522.uid.uidByte[i], HEX));




//Checking the card

if (tag.substring(1) == tagUID) //change here the UID of the card/cards that you want to give access


// If UID of tag is matched.


lcd.setCursor(0, 0);

lcd.print(“Access Granted”);

lcd.setCursor(0, 1);

lcd.print(“Door Opened”);


digitalWrite(greenLed, HIGH);


digitalWrite(greenLed, LOW);







// If UID of tag is not matched.


lcd.setCursor(0, 0);

lcd.print(“Wrong Tag Shown”);

lcd.setCursor(0, 1);

lcd.print(“Access Denied”);

digitalWrite(buzzerPin, HIGH);

digitalWrite(redLed, HIGH);


digitalWrite(buzzerPin, LOW);

digitalWrite(redLed, LOW);





String tagUID = “29 B9 ED 23”; // String to store UID of tag. Change it with your tag’s UID

The Arduino code is as follows


  • Payments in means of transport: public transports and tolls. …
  • Asset management: Location, identification and transport trace. …
  • Inventories and warehouses. …
  • Identification of animals. …
  • Access control: sports facilities, buildings, tourism. …