The MFRC522 is a highly integrated RFID reader/writer IC that operates at a frequency of 13.56 MHz. It is designed for contactless communication with RFID tags and cards, making it a versatile component for a wide range of applications. The MFRC522 is widely used in systems requiring secure identification, data exchange, or access control. Its compact design and low power consumption make it ideal for embedded systems and portable devices.
Parameter | Value |
---|---|
Operating Frequency | 13.56 MHz |
Operating Voltage | 2.5V to 3.3V (logic level) |
Supply Voltage (VCC) | 3.3V |
Current Consumption | 13-26 mA (typical) |
Communication Interface | SPI, I2C, UART |
Maximum Data Rate | 424 kbit/s |
Supported Protocols | ISO/IEC 14443 A/MIFARE |
Operating Temperature | -20°C to +85°C |
Dimensions | 40mm x 60mm (module size) |
The MFRC522 module typically comes with an 8-pin header for interfacing. 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, not always used) |
MISO | 5 | SPI Master-In-Slave-Out (data output) |
MOSI | 6 | SPI Master-Out-Slave-In (data input) |
SCK | 7 | SPI Clock |
SDA/SS | 8 | SPI Slave Select (chip select) |
Below is an example of how to use the MFRC522 with an Arduino UNO to read RFID tags. This code uses the popular MFRC522
library.
#include <SPI.h>
#include <MFRC522.h>
// Define MFRC522 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 MFRC522 class
void setup() {
Serial.begin(9600); // Initialize serial communication
SPI.begin(); // Initialize SPI bus
rfid.PCD_Init(); // Initialize the MFRC522 module
Serial.println("Place your RFID card near the reader...");
}
void loop() {
// Check if a new card is present
if (!rfid.PICC_IsNewCardPresent()) {
return; // Exit if no card is detected
}
// Check if the card can be read
if (!rfid.PICC_ReadCardSerial()) {
return; // Exit if the card cannot be read
}
// 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], HEX); // Print each byte in hexadecimal
Serial.print(" ");
}
Serial.println();
// Halt the card to stop communication
rfid.PICC_HaltA();
}
MFRC522
library from the Arduino Library Manager before running the code.SS_PIN
and RST_PIN
definitions match your wiring.Module Not Responding:
Card Not Detected:
Incorrect UID Read:
Q: Can the MFRC522 read NFC tags?
A: The MFRC522 supports ISO/IEC 14443 A/MIFARE protocols, which are compatible with many NFC tags. However, it does not support all NFC standards.
Q: What is the maximum range of the MFRC522?
A: The typical range is 2-5 cm, depending on the tag and environmental conditions.
Q: Can I use the MFRC522 with a 5V microcontroller?
A: Yes, but you must use a level shifter to convert the 5V logic levels to 3.3V to avoid damaging the module.