The RFID-RC522 is a popular RFID (Radio Frequency Identification) module that operates at 13.56 MHz. It is widely used for contactless communication and is capable of reading and writing to various RFID tags and cards. This module is commonly utilized in applications such as access control systems, attendance systems, and identification tasks where a secure and quick method of data exchange is required.
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 module in a circuit, follow these steps:
#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 with the PC
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 module write to RFID tags? A: Yes, the RFID-RC522 can write to compatible RFID tags that support the MIFARE protocol.
Q: What is the maximum range of the RFID-RC522 module? A: The maximum range is approximately 50mm, but this can vary based on the antenna design and environmental conditions.
Q: Is the RFID-RC522 module compatible with all RFID tags? A: No, it is designed to work with tags that operate at 13.56 MHz and support the MIFARE protocol.
Q: Can I use the RFID-RC522 module with a 5V microcontroller? A: While the module itself requires 3.3V, level shifters can be used to interface with 5V logic levels on a microcontroller. However, direct connection without level shifting can damage the module.