Skip to content
My Account

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.

2 min read

No ratings yet, be the first.

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:

PN532RC522
ProtocolFull NFC Forum stack (NDEF, card emulation, peer-to-peer)13.56MHz RFID (MIFARE) only
Reads phone NFC (tap-to-share)YesNo
InterfacesI2C, SPI, UART, selectable on one boardSPI only
CostHigherLower, 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.

ModePins used
I2CVCC, GND, SDA, SCL
SPIVCC, 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 PinESP32 Pin
VCC3.3V
GNDGND
SDAGPIO21
SCLGPIO22

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.

Advertisement

Related

All guides

More guides

Keep building.

From ESP32 HomeKit accessories to Arduino and ATtiny reference guides, there’s more where this came from.

All guides