Is PN532 NFC RFID Reader-Writer Compatible with Home Assistant (ESPHome)?
Electrical Specifications
Always confirm pin assignments against the manufacturer datasheet before wiring.
Compatibility Overview
13.56MHz NFC and RFID reader module supporting card reading phone emulation and secure access badge verification.
Wiring PN532 NFC RFID Reader-Writer to ESP32
| Module pin | ESP32 | Note |
|---|---|---|
| VCC | 3V3 | The common red V3 module regulates internally and takes 3.3–5V; its signal pins are 3.3V either way. |
| GND | GND | |
| SDA | GPIO21 | |
| SCL | GPIO22 | |
| IRQ / RSTO | unconnected | ESPHome polls the reader; neither pin is needed. |
| Mode switches | SEL0 on, SEL1 off | I2C. Both off is HSU (serial), SEL0 off / SEL1 on is SPI. Solder-jumper boards use the same table. |
Host pins are the ones the configuration on this page uses. Move a pin here and change it in the YAML — they are documented together so they cannot disagree.
Technical Specification Matrix
| Feature / Attribute | Specification / Status |
|---|---|
| Hardware Protocol | I2C / SPI / 3.3V |
| Bridge Required | NO |
| Border Router Needed | None |
| Hardware Capabilities & Peripherals | NFC Card ID Tag Emulation Scanner State Note: these entities come from the ESPHome configuration you flash — each one needs its matching component in that YAML before it appears. |
| Pairing Complexity | Intermediate |
| Factory Reset Instruction | Hold BOOT button for 3s. |
Wire, Flash, Adopt, Check
Wire it up
Follow the wiring table above. The ESP32 pins there are the ones the configuration uses, so if you move one, change it in both places.
Flash the configuration
Create a new device in the ESPHome dashboard (the Home Assistant add-on) and paste the configuration below into it, or save it as emb_esp32_pn532_esphome.yaml and run esphome run emb_esp32_pn532_esphome.yaml. The first flash goes over USB. If it is not detected, hold BOOT button for 3s to put it in download mode. Every update after that is over the air.
Adopt it in Home Assistant
Settings → Devices & Services. A node on the same network shows up as a discovered ESPHome device within a minute of joining Wi-Fi; choose Configure and enter the API encryption key from your secrets.yaml. If discovery does not find it, add the ESPHome integration by hand with the node's IP address.
Check it works
The setup log names the PN532 firmware version, and holding a card on the antenna produces a tag_scanned event in Home Assistant's Tags page within a second. A boot log reporting no PN532 found is almost always the mode switches.
ESPHome Configuration
Starting configuration for PN532 NFC RFID Reader-Writer on ESP32. Untested on hardware — verify wiring and pins against your own board.
# ESPHome configuration for PN532 NFC RFID Reader-Writer
# Host: ESP32. Pin numbers below are host-side defaults — any free
# GPIO will do, and you should change them to match your own wiring.
esphome:
name: emb_esp32_pn532_esphome
friendly_name: "PN532 NFC RFID Reader-Writer"
esp32:
board: esp32dev
framework:
type: esp-idf
logger:
api:
encryption:
key: !secret api_encryption_key
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
i2c:
id: i2c_main
sda: GPIO21
scl: GPIO22
scan: true
pn532_i2c:
address: 0x24
update_interval: 1s
on_tag:
then:
- homeassistant.tag_scanned: !lambda 'return x;'
Before you flash:
the !secret values come from your
secrets.yaml, and the GPIO numbers are host-side
defaults rather than properties of this part — change them to match how you actually wired it.
If the device is not found:
it is usually the I2C address, not the config. Many breakouts strap their address with
solder jumpers, so two boards of the same part can differ. This config leaves
scan: true on — the boot log lists every address
actually present on the bus, and you can copy the right one from there.
What Appears in Home Assistant
Each read fires tag_scanned in Home Assistant with the card's UID. Tags show up under Settings → Tags, and automations trigger on them.
Optional: binary_sensor: platform: pn532 with a uid: gives a sensor that is on while that one card is in range.
Known Problems and Fixes
The switches decide whether it exists
Two DIP switches (or solder jumpers) select HSU, I2C or SPI, and a reader left in the factory HSU position answers nothing on I2C. The config is for pn532_i2c; there is a pn532_spi platform for the other setting.
Phones do not have a stable UID
Modern phones randomise the UID they present, so "tap my phone to unlock" through UID matching works once and then stops. Use a sticker tag, or write the Home Assistant tag URL to an NTAG with pn532.write so the phone's Companion app and this reader trigger the same HA tag.
Only fires while the API is up
homeassistant.tag_scanned is a call into Home Assistant. With the node disconnected, reads are logged and nothing else happens. If the reader is gating a door, put the decision in an on_tag lambda on the node rather than in an HA automation.
Metal kills the antenna
The PCB antenna reads at up to about 5cm in free air and nearly nothing when mounted flat on a metal box or beside a relay module. Give it a few centimetres of clear plastic.
What it reads
MIFARE Classic and Ultralight, NTAG213/215/216 and other ISO 14443A tags. Not 125kHz EM4100 fobs — those are a different frequency and need an RDM6300-class reader.
Report a Pinout Error or Submit Tested Code Snippets
Found a pin mapping quirk or built a custom ESPHome YAML driver for PN532 NFC RFID Reader-Writer? Submit a pull request or report corrections to our index.