RFID MFRC522 avec interface UART, SPI, I²C
Vue d’ensemble
Module lecteur RFID 13.56 MHz basé sur la puce NXP MFRC522 avec trois interfaces sélectionnables : SPI, I²C ou UART. Lit et écrit les tags ISO/IEC 14443 Type A — MIFARE Classic 1K, MIFARE Ultralight, NTAG21x. Portée typique : 30-50 mm. Idéal pour systèmes de contrôle d’accès, pointage, suivi d’inventaire et projets makers personnalisés.
Spécifications
| Spécification | Valeur |
|---|---|
| Reader IC | NXP MFRC522 |
| Operating Frequency | 13.56 MHz |
| Supported Protocols | ISO/IEC 14443 Type A (MIFARE Classic, Ultralight, NTAG21x) |
| Read Range | ~30–50 mm (depends on tag and antenna) |
| Interfaces | SPI (up to 10 Mbit/s), I²C, UART |
| Operating Voltage | 3.3 V (with onboard regulator from 5 V) |
| Logic Level | 3.3 V or 5 V tolerant |
| Pins | 8 (3.3V, RST, GND, IRQ, MISO, MOSI, SCK, SDA) |
| Card Memory (MIFARE Classic 1K) | 1 KB |
| Read/Write | Both (with appropriate authentication) |
| Package Contents | Module + 1× MIFARE Classic 1K card + 1× keychain tag |
Applications courantes
- Systèmes de contrôle d’accès (porte, casier)
- Pointage et présence (badges employés)
- Suivi d’inventaire et d’actifs
- Lecteurs NFC personnalisés
- Projets makers (coffrets RFID, déclencheurs musicaux)
Programmation
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN);
void setup() {
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
Serial.println("Tap a card...");
}
void loop() {
if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) return;
Serial.print("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();
rfid.PICC_HaltA();
}