Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino MFRC522 RFID: Build Access Control System | ShillehTek

April 18, 2026 68 views

Arduino MFRC522 RFID: Build Access Control System | ShillehTek
Project

Build an Arduino Uno + MFRC522 (RC522) RFID access control system that reads card UIDs and prints authorized or denied results for simple security projects by ShillehTek.

30 hr Beginner3 parts

Project Overview

Arduino MFRC522 RFID Access Control: Build a simple RFID-based security access system with an Arduino Uno and the MFRC522 (RC522) RFID reader module that reads tag UIDs and grants or denies access.

RFID (Radio-Frequency Identification) uses electromagnetic fields to wirelessly identify tagged objects over short distances, making it useful for door locks, access control, and authentication projects.

  • Time: 30 minutes to 1 hour
  • Skill level: Beginner
  • What you will build: An RFID access control system that reads tag UIDs and grants or denies access based on a pre-programmed card.
RFID keychain fob and RFID card tags used with an Arduino and MFRC522 reader
RFID tags (a keychain fob and a card), each with a unique UID for identification.

Parts List

From ShillehTek

External

  • Arduino Uno R3 (or compatible Uno-form-factor board) - ShillehTek does not sell Arduino boards; use any standard Uno for this tutorial
  • USB cable - to program the Arduino and provide power
  • Computer with Arduino IDE installed

Note: The MFRC522 module operates at 3.3V. Make sure you connect it to the Arduino's 3.3V pin, not the 5V pin, to avoid damaging the module.

Step-by-Step Guide

Step 1 - Understanding RFID technology

Goal: Learn the basics of how RFID works and what components make up an RFID system.

What to do: An RFID system consists of two main parts: tags (transponders) and a reader (transceiver). Each tag contains a tiny chip with a unique identification number called a UID. When you bring a tag close to the reader, the reader emits a radio signal that powers the tag and reads its UID, with no batteries required in the tag.

Common applications include building access cards, inventory tracking, contactless payments, and pet identification microchips. In this project, you will use the MFRC522 reader module which operates at 13.56MHz and communicates with the Arduino over SPI.

MFRC522 (RC522) RFID reader module used with an Arduino Uno over SPI
The MFRC522 RFID reader module, a compact 13.56MHz SPI-based reader.

Key specifications of the MFRC522 module:

  • Operating voltage: 3.3V
  • Frequency: 13.56MHz
  • Interface: SPI
  • Read range: approximately 5cm

Expected result: You understand how RFID works and what the MFRC522 module does.

Step 2 - Wire the MFRC522 to the Arduino

Goal: Connect the RFID reader to your Arduino Uno using the correct SPI pins.

What to do: Wire the MFRC522 module to your Arduino Uno using this pin mapping:

  • SDA - Digital Pin 10
  • SCK - Digital Pin 13
  • MOSI - Digital Pin 11
  • MISO - Digital Pin 12
  • IRQ - Not connected
  • GND - GND
  • RST - Digital Pin 9
  • 3.3V - 3.3V
Wiring diagram of Arduino Uno connected to an MFRC522 (RC522) RFID module on a breadboard
Wiring diagram for connecting the MFRC522 RFID reader to an Arduino Uno.

Expected result: The MFRC522 module is wired to your Arduino and ready for programming.

Step 3 - Install the MFRC522 library and read tag data

Goal: Install the required library and use the DumpInfo example to read your RFID tag's UID and stored data.

What to do: Download and install the MFRC522 library by miguelbalboa. You can find it in the Arduino Library Manager by searching for "MFRC522", or download it from GitHub. After installation, restart your Arduino IDE.

Open the built-in example sketch: File > Examples > MFRC522 > DumpInfo. Upload it to your Arduino and open the Serial Monitor at 9600 baud. Hold your RFID tag near the reader and keep it close until all the data is displayed.

Arduino Serial Monitor running MFRC522 DumpInfo example and waiting for an RFID card
The Serial Monitor waiting for you to present an RFID tag to the reader.
Arduino Serial Monitor showing MFRC522 DumpInfo output with RFID card UID and memory sector data
Full data dump from an RFID card. Note the UID at the top and the 16 memory sectors.

The output displays the card's UID and its full memory contents divided into 16 sectors, each protected by two keys (A and B). Write down the UID; you will need it in the next step to program the access control logic.

Expected result: You can see your RFID tag's UID and memory contents in the Serial Monitor.

Step 4 - Build the access control sketch

Goal: Write and upload a sketch that grants or denies access based on the scanned tag's UID.

What to do: Create a new sketch in the Arduino IDE and paste the code below. It reads the UID from a presented tag and compares it against a pre-authorized UID. If it matches, access is granted. Otherwise, access is denied.

Code:

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup()
{
  Serial.begin(9600);
  SPI.begin();
  mfrc522.PCD_Init();
  Serial.println("Approximate your card to the reader...");
  Serial.println();
}

void loop()
{
  if ( ! mfrc522.PICC_IsNewCardPresent())
  {
    return;
  }
  if ( ! mfrc522.PICC_ReadCardSerial())
  {
    return;
  }

  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.println();
  Serial.print("Message : ");
  content.toUpperCase();

  if (content.substring(1) == "BD 31 15 2B")  // Replace with YOUR tag UID
  {
    Serial.println("Authorized access");
    Serial.println();
    delay(3000);
  }
  else
  {
    Serial.println("Access denied");
    delay(3000);
  }
}

Before uploading, replace the UID string "BD 31 15 2B" with the UID you recorded from your tag in Step 3. Keep the format with spaces between each hex byte pair and use uppercase letters.

Expected result: The sketch compiles and uploads successfully to your Arduino.

Step 5 - Test the access control system

Goal: Verify that your system correctly identifies authorized and unauthorized tags.

What to do: Open the Serial Monitor at 9600 baud after uploading the sketch. Present the authorized RFID tag (the one whose UID you programmed in the code) to the reader. You should see the "Authorized access" message.

Arduino Serial Monitor showing Authorized access after scanning the programmed RFID tag with an MFRC522 reader
The Serial Monitor confirms authorized access when the registered tag is detected.

Now scan a different tag that does not match the UID in your code. The system should display the "Access denied" message.

Arduino Serial Monitor showing Access denied after scanning an unregistered RFID tag with an MFRC522 reader
Access denied when an unrecognized tag is presented to the reader.

Expected result: Your authorized tag triggers "Authorized access", and any other tag shows "Access denied".

Conclusion

You built an RFID-based access control system using an Arduino Uno and the MFRC522 (RC522) reader module. You wired the module over SPI, read tag data using the DumpInfo example, and wrote a sketch that grants or denies access based on a tag UID.

Photo credit: Images in this tutorial are credited to Random Nerd Tutorials.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.