Overview
The nfc_pn532 node interfaces with the NXP PN532 NFC/RFID reader, a versatile
chip that supports I2C, SPI, and UART communication interfaces. It reads MIFARE, NTAG, and FeliCa cards, supports
NDEF message parsing, and can operate in card emulation mode. Ideal for advanced NFC projects requiring
flexible connectivity and protocol support.
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| interface | select | Yes | "i2c" | Communication interface: "i2c", "spi", "uart" |
| i2cBus | select | No | "/dev/i2c-1" | I2C bus device path (I2C mode) |
| i2cAddress | string | No | "0x24" | I2C device address (I2C mode) |
| serialPort | string | No | "/dev/ttyS0" | Serial port path (UART mode) |
| spiBus | number | No | 0 | SPI bus number (SPI mode) |
| spiDevice | number | No | 0 | SPI chip select (SPI mode) |
| irqPin | number | No | -1 | GPIO pin for IRQ interrupt (-1 to disable) |
| resetPin | number | No | -1 | GPIO pin for hardware reset (-1 to disable) |
Inputs
{
"payload": {
"command": "scan",
"timeout": 5000
}
} {
"payload": {
"command": "readNdef"
}
} Outputs
{
"uid": "04:A1:B2:C3:D4:E5:F6",
"type": "NTAG215",
"ndef": {
"type": "uri",
"value": "https://example.com"
},
"data": [4, 161, 178, 195, 212, 229, 246],
"interface": "i2c",
"timestamp": "2025-01-15T10:30:00.000Z"
} {
"uid": "A1:B2:C3:D4",
"type": "MIFARE 1KB",
"ndef": null,
"data": [161, 178, 195, 212],
"interface": "i2c",
"timestamp": "2025-01-15T10:30:01.000Z"
} Wiring Diagram
PN532 I2C Mode (Default)
PN532 Module Raspberry Pi +------------+ +--------------+ | VCC (3.3V)|--------| 3.3V (Pin 1)| | GND |--------| GND (Pin 6)| | SDA |--------| SDA1 (Pin 3)| | SCL |--------| SCL1 (Pin 5)| | IRQ |--------| (optional) | | RSTO |--------| (optional) | +------------+ +--------------+ DIP Switch: SEL0=ON, SEL1=OFF (I2C mode)
Interface DIP Switch Settings
I2C Mode (recommended):
SEL0: ON SEL1: OFF
SPI Mode:
SEL0: OFF SEL1: ON
UART Mode:
SEL0: OFF SEL1: OFF
Note: Power cycle the PN532 after changing the DIP switch settings for the new interface to take effect.
Example Use Cases
NFC URL Reader and Web Launcher
Read NDEF URI records from NFC tags and trigger web actions via HTTP request.
[
{
"id": "nfc-reader",
"type": "nfc_pn532",
"interface": "i2c",
"i2cBus": "/dev/i2c-1",
"i2cAddress": "0x24"
},
{
"id": "check-ndef",
"type": "switch",
"property": "ndef.type",
"rules": [
{ "t": "eq", "v": "uri" },
{ "t": "eq", "v": "text" }
]
},
{
"id": "fetch-url",
"type": "http-request",
"method": "GET"
}
] Multi-Zone Access Control
Use NFC cards for multi-zone building access with per-zone permission checks via database lookup.
[
{
"id": "nfc-scan",
"type": "nfc_pn532",
"interface": "i2c",
"i2cAddress": "0x24",
"irqPin": 16
},
{
"id": "lookup-permissions",
"type": "postgresql",
"query": "SELECT zones FROM users WHERE nfc_uid = $1"
},
{
"id": "check-zone",
"type": "function",
"name": "Verify Zone Access"
},
{
"id": "unlock-door",
"type": "gpio-out",
"pin": 18
}
] Smart Jukebox with NFC
Tap NFC tags to trigger specific actions or play specific content via MQTT.
[
{
"id": "nfc-tap",
"type": "nfc_pn532",
"interface": "uart",
"serialPort": "/dev/ttyS0"
},
{
"id": "map-action",
"type": "switch",
"property": "uid"
},
{
"id": "play-cmd",
"type": "mqtt-out",
"topic": "media/play"
}
] Common Use Cases
Smart Access Control
Multi-zone NFC badge and card entry systems
NDEF URL Triggers
Read NFC URLs and trigger web-based automations
Interactive Kiosks
NFC tap-to-interact for museum, retail, and info displays
Student/Staff Check-In
Tap-based attendance and time tracking systems