The RFID-RC522 is a compact and cost-effective RFID reader/writer module that operates at a frequency of 13.56 MHz. It is designed for reading and writing RFID tags and cards, making it an essential component for wireless communication in various applications. The module is widely used in access control systems, inventory management, and identification systems due to its reliability, affordability, and ease of integration.
The RFID-RC522 module is built around the MFRC522 IC, which supports ISO/IEC 14443A/MIFARE protocols. Below are the key technical details and pin configurations:
Parameter | Specification |
---|---|
Operating Voltage | 2.5V to 3.3V (logic level: 3.3V) |
Power Supply Voltage | 3.3V |
Operating Current | 13-26mA |
Operating Frequency | 13.56 MHz |
Communication Interface | SPI, I2C, UART |
Maximum Data Rate | 10 Mbps |
Reading Distance | Up to 5 cm (depending on tag type) |
Dimensions | 40mm x 60mm |
The RFID-RC522 module has an 8-pin interface for communication and power. Below is the pinout:
Pin Name | Pin Number | Description |
---|---|---|
VCC | 1 | Power supply input (3.3V) |
RST | 2 | Reset pin (active LOW) |
GND | 3 | Ground connection |
IRQ | 4 | Interrupt pin (optional, used for advanced applications) |
MISO | 5 | Master In Slave Out (SPI data output) |
MOSI | 6 | Master Out Slave In (SPI data input) |
SCK | 7 | Serial Clock (SPI clock signal) |
SDA/SS | 8 | Slave Select (SPI chip select) or I2C address selection (depending on mode) |
MISO
to Arduino pin 12MOSI
to Arduino pin 11SCK
to Arduino pin 13SDA/SS
to Arduino pin 10RST
to Arduino pin 9#include <SPI.h>
#include <MFRC522.h>
// Define pins for the RFID-RC522 module
#define RST_PIN 9 // Reset pin connected to Arduino pin 9
#define SS_PIN 10 // Slave Select pin connected to Arduino pin 10
MFRC522 rfid(SS_PIN, RST_PIN); // Create an instance of the MFRC522 class
void setup() {
Serial.begin(9600); // Initialize serial communication
SPI.begin(); // Initialize SPI bus
rfid.PCD_Init(); // Initialize the RFID module
Serial.println("Place your RFID card near the reader...");
}
void loop() {
// Check if an RFID card is present
if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
return; // Exit if no card is detected
}
// Print the UID of the detected card
Serial.print("Card UID: ");
for (byte i = 0; i < rfid.uid.size; i++) {
Serial.print(rfid.uid.uidByte[i], HEX); // Print each byte in hexadecimal
Serial.print(" ");
}
Serial.println();
// Halt the card to stop further communication
rfid.PICC_HaltA();
}
Module Not Responding:
Card Not Detected:
Incorrect UID Output:
Q: Can the RFID-RC522 module write data to RFID tags?
A: Yes, the module supports both reading and writing operations for compatible RFID tags.
Q: Can I use the module with a 5V microcontroller?
A: Yes, but you must use a level shifter or voltage divider for the SPI pins to avoid damaging the module.
Q: What is the maximum range of the RFID-RC522?
A: The maximum reading distance is approximately 5 cm, depending on the tag type and environmental conditions.
By following this documentation, you can effectively integrate the RFID-RC522 module into your projects and troubleshoot common issues.