The image is for illustrative purposes only; please refer to the product data sheet for precise specifications.
| Part Number | MFRC522-MOD |
|---|---|
| Manufacturer |
|
| Description | The MFRC522 Module is a compact and widely used 13.56 MHz RFID/NFC reader module based on the MFRC522 chip from NXP Semiconductors. It is designed for easy integration into embedded systems, providing a complete contactless communication solution with minimal external components. This module supports ISO/IEC 14443 Type A and MIFARE® protocols, allowing it to read and write various contactless smart cards and RFID tags such as MIFARE Classic, Ultralight, and other compatible cards. It is commonly used for identification, authentication, and access control applications. The MFRC522 module communicates via a SPI interface, ensuring fast and reliable data exchange with microcontrollers such as Arduino, ESP8266, ESP32, Raspberry Pi, and STM32 platforms. It typically operates at 3.3V logic levels, making it suitable for low-voltage embedded systems. The module includes an onboard antenna, crystal oscillator, and passive components, simplifying hardware design. It supports data transfer rates up to 848 kbps and offers a typical reading distance of up to 3–5 cm, depending on antenna design and tag type. With its small PCB form factor and standard pin header interface, the MFRC522 module is easy to use in prototyping and production environments. It is widely used in applications such as access control systems, attendance tracking, contactless payment prototypes, IoT security, smart locks, and RFID-based identification systems. |
| Product Group | RFID |
| MOQ | 100 pcs |
| SPQ | 100 pcs |
| Figure/Case | TH-Module |
| Package | TRAY Pack |
| | |
| Ship From | Hong Kong |
| Shipment Way | DHL / Fedex / TNT / UPS / Others |
| Delivery Term | Ex-Works |
| Send RFQ | sales@signalhk.com |
/*
==============================================================
Title: ESP32 + MFRC522 RFID Web Console Test (SoftAP + AJAX)
Pinout Connections (ESP32 -> MFRC522):
SS / SDA -> GPIO 5
SCK -> GPIO 18
MOSI -> GPIO 23
MISO -> GPIO 19
RST -> GPIO 22
3.3V -> 3.3V
GND -> GND
Description:
- ESP32 starts in Access Point mode.
- User connects with a phone to the ESP32 Wi-Fi network.
- User opens the web page served by ESP32.
- When an RFID card is scanned, its information is:
1) Printed to Serial Monitor
2) Shown on the web page in a console-like window
- The web page updates using AJAX (fetch polling).
Important:
- MFRC522 must be powered from 3.3V, not 5V.
==============================================================
*/
#include
#include
#include
#include
#define SS_PIN 5
#define RST_PIN 22
const char* AP_SSID = "ESP32-RFID-Console";
const char* AP_PASSWORD = "12345678";
IPAddress local_ip(192, 168, 4, 1);
IPAddress gateway(192, 168, 4, 1);
IPAddress subnet(255, 255, 255, 0);
WebServer server(80);
MFRC522 rfid(SS_PIN, RST_PIN);
String logBuffer = "";
const size_t MAX_LOG_LENGTH = 6000;
String lastUID = "";
unsigned long lastScanTime = 0;
const unsigned long duplicateWindowMs = 1500;
// HTML page (served by ESP32)
const char INDEX_HTML[] PROGMEM = R"rawliteral(
RFID Console
ESP32 RFID Console
Waiting...\n
)rawliteral";
void appendLog(const String &line) {
Serial.println(line);
logBuffer += line + "\n";
if (logBuffer.length() > MAX_LOG_LENGTH) {
logBuffer = logBuffer.substring(logBuffer.length() - MAX_LOG_LENGTH);
}
}
String uidToString(MFRC522::Uid *uid) {
String result = "";
for (byte i = 0; i < uid->size; i++) {
if (uid->uidByte[i] < 0x10) result += "0";
result += String(uid->uidByte[i], HEX);
if (i < uid->size - 1) result += " ";
}
result.toUpperCase();
return result;
}
void handleRoot() {
server.send(200, "text/html", INDEX_HTML);
}
void handleLogs() {
server.send(200, "text/plain", logBuffer);
}
void setup() {
Serial.begin(115200);
SPI.begin();
rfid.PCD_Init();
WiFi.mode(WIFI_AP);
WiFi.softAPConfig(local_ip, gateway, subnet);
WiFi.softAP(AP_SSID, AP_PASSWORD);
appendLog("AP IP: " + WiFi.softAPIP().toString());
server.on("/", handleRoot);
server.on("/logs", handleLogs);
server.begin();
}
void loop() {
server.handleClient();
if (!rfid.PICC_IsNewCardPresent()) return;
if (!rfid.PICC_ReadCardSerial()) return;
String uid = uidToString(&rfid.uid);
unsigned long now = millis();
if (uid == lastUID && (now - lastScanTime) < duplicateWindowMs) {
return;
}
lastUID = uid;
lastScanTime = now;
appendLog("Card UID: " + uid);
rfid.PICC_HaltA();
rfid.PCD_StopCrypto1();
}
Room 1304, 13/F, Allways Centre, 468 Jaffe Road, Causeway Bay, Hong Kong. |