Integrating Nfc/Rfid Readers Like RC522 With Arduino for Access Control Systems
You connect the RC522’s VCC to 3.3V, RST to D9, SS to D10, and SPI pins-SCK, MOSI, MISO-to D13, D11, D12, grounding both modules. Use the MFRC522 library to scan MIFARE 1KB tags at 13.56 MHz, pulling UIDs in hex via PICC_ReadCardSerial() at 115200 baud. Authenticate with default key 0xFFFFFFFFFFFF, then trigger a BC547 transistor through a 220Ω resistor to switch USB power on match. It’s reliable, low-cost, and field-tested for secure access-many users have streamlined setup using pre-coded UID whitelists and noise-filtered power lines. There’s more to fine-tuning response speed and range with antenna gain adjustments.
We are supported by our audience. When you purchase through links on our site, we may earn an affiliate commission, at no extra cost for you. Learn more. Last update on 28th May 2026 / Images from Amazon Product Advertising API.
Notable Insights
- Connect RC522 VCC to 3.3V and use voltage logic shifters if interfacing with 5V Arduino boards.
- Wire RC522 SCK, MOSI, MISO, and SS to Arduino D13, D11, D12, and D10 for proper SPI communication.
- Use the MFRC522 library to read MIFARE card UID via PICC_IsNewCardPresent() and PICC_ReadCardSerial() functions.
- Authenticate MIFARE sectors using PCD_Authenticate with correct keys before accessing or writing tag data.
- Implement access control by comparing stored UIDs and triggering outputs like transistors or relays on a match.
Wire the RC522 to Arduino
While getting your RC522 RFID reader working with an Arduino might seem tricky at first, wiring it correctly guarantees stable, long-term performance you can count on. To wire the RC522 to Arduino properly, connect the RC522 RFID reader’s VCC to the Arduino’s 3.3V-never 5V-to avoid damaging the module. The RST and SS pins go to D9 and D10 on the Arduino UNO R, which the MFRC522 library uses by default. For reliable SPI communication, link SCK, MOSI, and MISO to D13, D11, and D12-these are the communication pins that let the reader transfer data at up to 10 Mbit/s. Always make certain the GND of both the RFID module and Arduino are connected to the Arduino. If using a 5V board, use logic level shifters on MOSI, SCK, and SS. This setup keeps your RC522 RFID reader safely connected to the Arduino for consistent operation.
Read RFID Tags With Arduino Code
Since you’ve got the RC522 wired up right-3.3V to VCC, RST to D9, SS to D10, and SPI lines on D13, D11, and D12-you’re ready to start reading RFID tags with confidence. Use the MFRC522 Arduino library to write Arduino code that reads the UID from any MIFARE card. You’ll rely on `PICC_IsNewCardPresent()` and `PICC_ReadCardSerial()` to securely read RFID tags at 13.56 MHz. The UID appears as a hex string via serial communication at 115200 baud. Always verify connections: SCK pin (D13), MOSI (D11), MISO (D12), and RST_PIN (D9) must match the SPI interface.
| Pin | Arduino | Function |
|---|---|---|
| SCK | D13 | Clock |
| RST | D9 | Reset |
| SS | D10 | Chip Select |
Authenticate MIFARE Cards Using Keys
You’ve already got your RC522 reading MIFARE tag UIDs reliably, but if you want to go further and access or modify the actual data blocks-say, for door access logs or user-specific settings-you’ll need to authenticate first. MIFARE Classic cards store 1KB across 16 sectors, each locked behind an authentication key. Your RFID module uses the MFRC522 library’s PCD_Authenticate function to gain entry. Pass Key A (or Key B), the target block address, and the card’s UID to the function. Default keys like `0xFFFFFFFFFFFF` work on factory cards, but always change them for secure access control. Each sector’s trailer block holds access bits and keys-misconfigure them, and you’ll lock yourself out. Failed attempts return codes like STATUS_TIMEOUT or STATUS_ERROR, so include error checks and retry loops. Real testers confirm that correct key handling makes PCD_Authenticate reliable, even in noisy environments. Proper authentication is essential for any serious project using block-level data.
Build a PC Access Control System
When you’re ready to secure your PC with something more reliable than passwords, building an access control system around an Arduino Nano or Uno and an RC522 RFID reader makes a practical, real-world solution. The RC522 operates at 13.56 MHz and reads MIFARE Classic 1KB tags, pulling each RFID card’s unique Card UID for authentication. Wire the RC522 using SS_PIN 10 and RST_PIN 9, connecting SCK, MOSI, and MISO to D13, D11, and D12, and power it with 3.3V to avoid damage. Program the Arduino Nano to compare incoming UIDs-like 39C3BB99-against stored ones. On match, trigger a BC547 transistor via a 220Ω resistor to switch a USB hub’s 5V line, enabling keyboard and mouse access. Add a push button with a pull-down resistor for manual override, giving you full, flexible control.
On a final note
You’ve wired the RC522 to your Arduino, read tags accurately at 13.56 MHz, authenticated MIFARE cards using default keys, and built a responsive PC access system. Testers confirm reliable reads within 5 cm, with code compiling in under 30 seconds using the MFRC522 library. The setup draws just 13 mA, making it efficient, while breakout pins simplify prototyping. For under $10, it’s a precise, scalable solution-ideal for DIY access control that works the first time, every time.





