The RFID-RC522 is a versatile and cost-effective RFID (Radio Frequency Identification) reader/writer module that operates at a frequency of 13.56 MHz. It is based on the NXP MFRC522 RFID chip and is capable of reading and writing to a wide range of RFID tags and cards compliant with the ISO/IEC 14443 A/MIFARE standard. Common applications of the RFID-RC522 include access control, contactless payment systems, and identification tracking.
Pin Name | Description |
---|---|
SDA | Serial Data Signal (SPI SS) |
SCK | Serial Clock Signal (SPI SCK) |
MOSI | Master Out Slave In (SPI MOSI) |
MISO | Master In Slave Out (SPI MISO) |
IRQ | Interrupt Request (active low) |
GND | Ground |
RST | Reset Signal |
3.3V | Supply Voltage (3.3V) |
To use the RFID-RC522 with a microcontroller, such as an Arduino UNO, follow these steps:
MFRC522
library available for Arduino.#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
void setup() {
Serial.begin(9600); // Initialize serial communications
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
Serial.println("Scan a MIFARE Classic card");
}
void loop() {
// Look for new cards
if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) {
delay(50);
return;
}
// Show UID on serial monitor
Serial.print("Card UID:");
for (byte i = 0; i < mfrc522.uid.size; i++) {
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
}
Serial.println();
// Halt PICC
mfrc522.PICC_HaltA();
// Stop encryption on PCD
mfrc522.PCD_StopCrypto1();
}
Q: Can the RFID-RC522 write to all types of RFID tags? A: The RFID-RC522 can write to tags that are compatible with the ISO/IEC 14443 A/MIFARE standard.
Q: What is the maximum reading distance of the RFID-RC522? A: The maximum reading distance is up to 50 mm, but this can vary depending on the tag type and environmental conditions.
Q: Can the RFID-RC522 be used with a 5V microcontroller? A: While the RFID-RC522 operates at 3.3V, level shifters can be used to interface with 5V microcontrollers. However, care must be taken to ensure that the RFID-RC522 module itself is powered with 3.3V.
Q: Is it necessary to use the IRQ pin? A: The IRQ pin is not required for basic RFID reading and writing operations but can be used for more advanced applications that require interrupt-driven events.