Reference
MFRC522
13.56MHz RFID reader.
- Connects over
- SPI
- Made by
- NXP Semiconductors
- Datasheet
- nxp.com
Use it
hardware {
device mfrc522: MFRC522(cs: 16)
}
every 1s {
let value: int = mfrc522.is_card_present()
log("mfrc522", "is_card_present={value}")
}
The MFRC522 goes on the SPI bus; give it its cs pin as an argument.
Methods
-
mfrc522.is_card_present() -> int
1 if RFID card detected
-
mfrc522.read_uid() -> int
Read card UID, returns length
Wiring
| Pin | Connect to |
|---|---|
VCC | 3.3V or 5V |
GND | Ground |
SCK | SPI clock |
MOSI | Master Out / Slave In |
MISO | Master In / Slave Out |
CS | Chip select (active low) |
RST | Reset (active low — pull high for normal operation) |
IRQ | Optional interrupt on card detect |
Specifications
- Voltage
- 2.5V – 3.3V (NOT 5V tolerant)
- Current
- 13 – 26 mA active
- Frequency
- 13.56 MHz (NFC / MIFARE)
- Range
- Up to 50 mm (typical 25 mm)
- Supported cards
- MIFARE Classic 1K/4K, MIFARE Ultralight, NTAG2xx
Tips
- 3.3V logic — use level shifters on SPI lines if your MCU is 5V (Arduino UNO).
- MIFARE Classic crypto is broken — fine for hobby tags, not for security.
- Reading distance suffers if the antenna is near metal — mount on plastic / wood.
Alternatives worth knowing:
- PN532: Higher-end NFC controller, can emulate cards and do P2P.