RC522 RFID Module: Raspberry Pi

 Model Picture

1. Introduction

The RC522 RFID Module is a popular low-cost module used for reading RFID cards and tags. It communicates using the SPI protocol and is widely used in security and automation systems with the Raspberry Pi.


2. Components

  • Raspberry Pi 4 Model B
  • RC522 RFID Module
  • RFID card/tag
  • Jumper wires
  • Breadboard (optional)

3. Circuit and Connections

Raspberry Pi Pinout Diagram
Raspberry Pi Pinout Diagram

RC522 RFID Module Pinout Diagram
RC522 RFID Module Pinout Diagram
SPI Connection Table

RC522 PinRaspberry Pi
VCC        3.3V
GND        GND
SDA (SS)    GPIO8 (CE0)
SCK    GPIO11 (SCLK)
MOSI       GPIO10
MISO        GPIO9
RST        GPIO25

4. Detailed Step By Step Circuit Working

  1. RFID card comes near the reader
  2. RC522 generates electromagnetic field
  3. Card transmits its unique ID (UID)
  4. Data is sent to Raspberry Pi via SPI
  5. Pi processes and displays card ID

5. Libraries to be Included

sudo apt update
pip3 install spidev mfrc522

Enable SPI:

sudo raspi-config

→ Interface Options → SPI → Enable


6. Code (Python)

from mfrc522 import SimpleMFRC522

reader = SimpleMFRC522()

try:
while True:
print("Place your card")
id, text = reader.read()
print("Card ID:", id)
print("Text:", text)
print("----------------------")

except KeyboardInterrupt:
pass

7. Detailed Step By Step Code Working

  • Initializes RFID reader
  • Waits for card detection
  • Reads unique card ID
  • Displays ID and stored text
  • Runs continuously

8. Tips

  • Always use 3.3V (NOT 5V)
  • Keep card close to reader
  • Avoid metal interference
  • Enable SPI before running
  • Use proper wiring

9. Uses

  • RFID attendance system
  • Door lock security
  • Access control systems
  • Smart payment systems
  • Inventory tracking

10. Conclusion

The RC522 RFID module is perfect for security and identification projects. It is easy to interface with Raspberry Pi using SPI and widely used in real-world applications.

തുടക്കക്കാർക്കായുള്ള ഇലക്ട്രോണിക്സ് ലളിതമായി പഠിക്കാം.

Empowering students in Kerala with hands-on technical skills.