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 |
| RC522 RFID Module Pinout Diagram |
| RC522 Pin | Raspberry 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
- RFID card comes near the reader
- RC522 generates electromagnetic field
- Card transmits its unique ID (UID)
- Data is sent to Raspberry Pi via SPI
- 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.