Reference
PN532 NFC Module Complete Guide
The PN532 reads and writes NFC tags, including the kind your phone already uses for tap-to-pay and tap-to-share, not just the 13.56MHz RFID cards the already-published RC522 handles. This guide covers its three interfaces, wiring it to an ESP32 over I2C, and when you actually need NFC over plain RFID.
The PN532 is an NFC (Near Field Communication) controller IC from NXP, sold on breakout boards (commonly the Elechouse PN532 NFC/RFID module V3/V4) that support three different host interfaces on the same board: I2C, SPI, and UART (HSU). It reads and writes NFC tags at 13.56MHz, including NDEF-formatted tags, and can also read a phone’s NFC in card-emulation or peer-to-peer mode.
PN532 vs. RC522: which do you need?
Both chips operate at 13.56MHz and can read common MIFARE cards, but they aren’t the same thing:
| PN532 | RC522 | |
|---|---|---|
| Protocol | Full NFC Forum stack (NDEF, card emulation, peer-to-peer) | 13.56MHz RFID (MIFARE) only |
| Reads phone NFC (tap-to-share) | Yes | No |
| Interfaces | I2C, SPI, UART, selectable on one board | SPI only |
| Cost | Higher | Lower, more common in beginner kits |
Pick the RC522 for simple access-control/attendance projects reading plain MIFARE cards, it’s cheaper and simpler. Pick the PN532 if you need to read/write phone NFC, NDEF tags (like the kind used for “tap to open a URL”), or need a peer-to-peer NFC link.
Interfaces and Pinout
Most PN532 breakout boards have a physical switch to select the interface. The pins used for I2C and UART (HSU) modes are shared and printed on the front of the board, SPI mode uses separate pins printed on the back.
| Mode | Pins used |
|---|---|
| I2C | VCC, GND, SDA, SCL |
| SPI | VCC, GND, SCK, MISO, MOSI, SS, (RSTPDN optional) |
| UART (HSU) | VCC, GND, TXD, RXD |
Default I2C address is 0x24 (7-bit). Supply voltage is 3.3V–5.5V depending on the board, most breakouts include their own regulator.
Wiring to an ESP32 (I2C mode)
| PN532 Pin | ESP32 Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| SDA | GPIO21 |
| SCL | GPIO22 |
Arduino code (Adafruit PN532 library)
#include <Wire.h>
#include <Adafruit_PN532.h>
Adafruit_PN532 nfc(-1, -1); // I2C mode, no IRQ/reset pins wired
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
nfc.begin();
if (!nfc.getFirmwareVersion()) {
Serial.println("Didn't find PN532 board");
while (1) delay(10);
}
nfc.SAMConfig();
}
void loop() {
uint8_t uid[7];
uint8_t uidLength;
if (nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength)) {
Serial.print("Found card, UID: ");
for (uint8_t i = 0; i < uidLength; i++) {
Serial.print(uid[i], HEX);
Serial.print(" ");
}
Serial.println();
}
delay(500);
}Install “Adafruit PN532” via the Arduino Library Manager, or the elechouse/PN532 library which also supports SPI and UART modes with the same board.
Practical Applications
- Phone-tap automation: trigger a smart-home scene when a phone with NFC enabled taps the reader.
- Writable NDEF tags: program a physical tag to open a URL or trigger an action on tap.
- Access control: read MIFARE card/keyfob UIDs, same use case the RC522 covers.
- Device-to-device pairing: peer-to-peer NFC mode for two NFC-capable devices to exchange data.
Conclusion
The PN532 covers everything the RC522 does and adds real NFC support for phones and NDEF tags, at a higher price and with a slightly more involved setup across its three switchable interfaces. Either pairs cleanly with an ESP32 over I2C.
Related
Reference
HC-SR04 Ultrasonic Distance Sensor
A cheap trigger/echo distance sensor for parking aids, water-level monitors and obstacle-avoiding robots. Covers the 5V echo pin that can damage a 3.3V-only ESP32 GPIO, and the safe ways to level-shift it.
Read more
Guide
HC-05 Bluetooth Module Pinout
The complete pin reference for the HC-05: a UART-to-Bluetooth bridge available as a bare 34-pin module or a simple 6-pin breakout board.
Read more
Guide
ESP32-C5 Pinout
The complete pin reference for the ESP32-C5: the first RISC-V Espressif chip with dual-band Wi-Fi 6, plus the exact pins you can safely reuse.
Read more
More guides
Keep building.
From ESP32 HomeKit accessories to Arduino and ATtiny reference guides, there’s more where this came from.
All guides