Security Access Using RFID Reader © GPL3+

This tutorial will illustrate the working of an RFID reader.

  • 250 respects

Components and supplies

Apps and online services

About this project

What is an RFID reader?

RFID tagging is an ID system that uses small radio frequency identification devices for identification and tracking purposes. An RFID tagging system includes the tag itself, a read/write device, and a host system application for data collection, processing, and transmission.

In simple words an RFID uses electromagnetic fields to transfer data over short distances. RFID is useful to identify people, to make transactions, etc…

You can use an RFID system to open a door. For example, only the person with the right information on his card is allowed to enter. An RFID system uses:

>> tags attached to the object to be identified, in this example we have a keychain and an electromagnetic card. Each tag has his own identification (UID).

>> two-way radio transmitter-receiver, the reader, that sends a signal to the tag and read its response

Basic Specifications:

  • Input voltage: 3.3V
  • Frequency: 13.56MHz

Now, before typing out the necessary code, you need to download the necessary library for this sensor from this repository.

Extract the contents from the zip folder "rfid-master" and add this library folder under the existing libraries of Arduino.

After doing so, restart your ArduinoIDE.

Now, our Arduino is ready to take commands and execute accordingly.

The Arduino Code has been uploaded at the end of this tutorial. Compile the code and eliminate "typo" errors (if any).

Now, its time to connect our Arduino with the RFID reader. Refer to the PIN wiring below,as well as the Connection schematic diagram for easy reference.

PinWiring to Arduino Uno

SDA------------------------Digital 10

SCK------------------------Digital 13

MOSI----------------------Digital 11

MISO----------------------Digital 12



RST------------------------Digital 9

3.3V------------------------3.3V (DO NOT CONNECT TO 5V) 

Reading data from an RFID tag

After having the circuit ready, go to File > Examples > MFRC522 > DumpInfo and upload the code. This code will be available in Arduino IDE (after installing the RFID library).

Then, open the serial monitor. You should see something like the figure below:

Approximate the RFID card or the keychain to the reader. Let the reader and the tag closer until all the information is displayed.

This is the information that you can read from the card, including the card UID that is highlighted in yellow. The information is stored in the memory that is divided into segments and blocks as you can see in the previous picture.

You have 1024 bytes of data storage divided into 16 sectors and each sector is protected by two different keys, A and B.

Write down your UID card because you’ll need it later.

Upload the Arduino code that has been suffixed here.


Approximate the card you’ve chosen to give access and you’ll see:

If you approximate another tag with another UID, the denial message will show up:

In case of any queries please comment below.


Arduino code for RFID readerArduino
In the piece of code above you need to change the if (content.substring(1) == “REPLACE WITH YOUR UID”) and type the UID card you’ve written previously.
 * All the resources for this project:
 * Modified by Aritro Mukherjee
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
void setup() 
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  Serial.println("Approximate your card to the reader...");

void loop() 
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  Serial.print("Message : ");
  if (content.substring(1) == "BD 31 15 2B") //change here the UID of the card/cards that you want to give access
    Serial.println("Authorized access");
 else   {
    Serial.println(" Access denied");


Connection schematic diagram
Mifare bb


Similar projects you might like

Arduino Bluetooth Basic Tutorial

by Mayoogh Girish

  • 236 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 672 respects

Security Access Using RFID Reader

by Aritro Mukherjee

  • 236 respects


Project in progress by Team Petoi

  • 1,361 respects
Add projectSign up / Login