The RC522 is a highly integrated RFID reader/writer module designed by MH-ET LIVE. Operating at a frequency of 13.56 MHz, it is widely used for reading and writing RFID tags and cards. This module supports various RFID protocols, including ISO/IEC 14443A/MIFARE, making it a versatile choice for wireless communication applications.
The RC522 module is compact, efficient, and easy to interface with microcontrollers like Arduino. Below are its key technical details:
Parameter | Specification |
---|---|
Operating Voltage | 2.5V to 3.3V (logic level: 3.3V) |
Operating Current | 13-26mA |
Operating Frequency | 13.56 MHz |
Communication Interface | SPI, I2C, UART |
Maximum Data Rate | 10 Mbps |
Supported Protocols | ISO/IEC 14443A/MIFARE |
Reading Distance | Up to 5 cm (depending on tag type) |
Dimensions | 40mm x 60mm |
The 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. Used to reset the module. |
GND | 3 | Ground connection |
IRQ | 4 | Interrupt pin. Can be used to signal events (optional, not always needed). |
MISO | 5 | SPI Master-In-Slave-Out (data output from RC522 to microcontroller) |
MOSI | 6 | SPI Master-Out-Slave-In (data input from microcontroller to RC522) |
SCK | 7 | SPI Clock signal |
SDA/SS | 8 | SPI Slave Select (chip select) or I2C address selection |
The RC522 module is commonly used with microcontrollers like Arduino. Below are the steps to use it in a circuit:
Wiring the Module: Connect the RC522 module to the Arduino UNO as follows:
RC522 Pin | Arduino UNO Pin |
---|---|
VCC | 3.3V |
GND | GND |
RST | Pin 9 |
IRQ | Not connected |
MISO | Pin 12 |
MOSI | Pin 11 |
SCK | Pin 13 |
SDA/SS | Pin 10 |
Install Required Libraries: Download and install the MFRC522
library from the Arduino Library Manager.
Upload Example Code: Use the following example code to read RFID tags:
#include <SPI.h>
#include <MFRC522.h>
// Define RC522 pins
#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 RC522 class
void setup() {
Serial.begin(9600); // Initialize serial communication
SPI.begin(); // Initialize SPI bus
rfid.PCD_Init(); // Initialize the RC522 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 card
Serial.print("Card UID: ");
for (byte i = 0; i < rfid.uid.size; i++) {
Serial.print(rfid.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(rfid.uid.uidByte[i], HEX);
}
Serial.println();
// Halt the card to stop communication
rfid.PICC_HaltA();
}
The module is not detected by the microcontroller.
The RFID tag is not being read.
The module resets unexpectedly.
Q: Can the RC522 read multiple tags simultaneously?
A: No, the RC522 can only read one tag at a time. If multiple tags are present, it may fail to detect any.
Q: Can I use the RC522 with a 5V microcontroller?
A: Yes, but you must use a level shifter to convert the 5V logic signals to 3.3V to avoid damaging the module.
Q: What is the maximum reading distance of the RC522?
A: The maximum reading distance is approximately 5 cm, depending on the size and type of the RFID tag.
Q: Does the RC522 support writing to RFID tags?
A: Yes, the RC522 can write data to compatible RFID tags, such as MIFARE cards.
By following this documentation, you can effectively integrate the RC522 module into your projects for reliable RFID-based communication.