Arduino Uno MFRC522 RFID: Industrial Identification Controller
Professional NXP MFRC522 IC operates 13.56MHz ISO14443A protocol reading MIFARE Classic 1K/4K cards and keyfobs within 7cm envelope. SPI interface (SS pin 10, RST pin 9) delivers 106kbit/s data rate with integrated CRC, anti-collision, and authentication supporting 752-byte sector reads/writes.
3.3V operation requires level shifting from 5V Arduino SPI. Built-in antenna matches 50-100Ω impedance. UID extraction, sector authentication, and data block access enable secure access control and inventory applications.
Production RFID System Components
- Arduino UNO R3 SPI capable (pins 11-13)
- MFRC522 RFID-RC522 Module (13.56MHz)
- MIFARE Classic 1K cards/keyfobs
- Male-to-male jumper wires (7 pieces)
- MFRC522 Arduino library (Miguel Balboa)
- 3.3V-5V bi-directional level shifter
High-Speed SPI Interface Configuration
3.3V: Arduino 3.3V (critical!)
GND: Arduino GND
RST: Arduino Digital Pin 9
SS/SDA: Arduino Digital Pin 10
MOSI: Arduino Pin 11
MISO: Arduino Pin 12
SCK: Arduino Pin 13
/*
MFRC522 Access Control System
Install library: Arduino IDE → MFRC522 by GithubCommunity
*/
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);
// Authorized UIDs (add your cards)
String authorizedUIDs[] = {"A1B2C3D4", "04A7C2D1", "E8F9A0B1"};
int numAuthorized = 3;
const int relayPin = 7;
void setup() {
Serial.begin(9600);
SPI.begin();
mfrc522.PCD_Init();
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);
Serial.println("=== MFRC522 Access Control Terminal ===");
Serial.println("Present authorized card/keyfob (3cm range)");
}
void loop() {
if(!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) {
return;
}
String uid = "";
for(byte i=0; i<mfrc522.uid.size; i++) {
uid += String(mfrc522.uid.uidByte[i] < 0x10 ? "0" : "");
uid += String(mfrc522.uid.uidByte[i], HEX);
}
Serial.print("Card UID: ");
Serial.println(uid);
bool authorized = false;
for(int i=0; i<numAuthorized; i++) {
if(authorizedUIDs[i] == uid) {
authorized = true;
break;
}
}
if(authorized) {
Serial.println("*** ACCESS GRANTED ***");
digitalWrite(relayPin, LOW); // Unlock door
delay(3000);
digitalWrite(relayPin, HIGH);
} else {
Serial.println("*** ACCESS DENIED ***");
}
mfrc522.PICC_HaltA();
mfrc522.PCD_StopCrypto1();
}
MFRC522 Library Production Deployment
Library Manager → 'MFRC522' GithubCommunity. Verify SPI pins 10/9. Scan authorized cards adding UIDs to array.
Terminal grants relay access (3s unlock) for authorized UIDs only.
Advanced Data Block Read/Write & Anti-Collision
// Authenticate & read/write sector 1 block 4
byte sector = 1;
byte blockAddr = 4;
byte dataBlock[18];
MFRC522::StatusCode status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, blockAddr*4, &key, &(mfrc522.uid));
if(status == MFRC522::STATUS_OK) {
// Read 16 bytes
status = mfrc522.MIFARE_Read(blockAddr, dataBlock, &size);
dump_byte_array(dataBlock, 16);
}
MFRC522 RF Specifications
13.56MHz ISO14443A; 106kbit/s; 7cm range; MIFARE Classic/Ultralight; CRC16 hardware; anti-collision.
Secure Identification Applications
Door access control systems
Employee attendance tracking
Inventory asset management
// EEPROM UID logging
void logAttendance(String uid) {
// Write timestamp + UID to EEPROM/SD
Serial.print("ATTENDANCE: ");
Serial.print(millis()/1000);
Serial.print("s - UID: ");
Serial.println(uid);
}
Production RFID Specifications
- SPI 10MHz interface
- 3.3V only (level shift 5V)
- 7cm read range
- Multi-tag anti-collision
- MIFARE Classic 1K/4K
Reliable Deployment Protocol
3.3V power essential (5V damages IC). Antenna tuning 50Ω. Shielded enclosure EMI immunity. Key sector authentication production.