Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

PN532 NFC module with Arduino Uno — I2C mode, IRQ and card UIDs

Connect a PN532 V3 NFC module to an Arduino Uno R3 in I2C mode at 5 V, with IRQ on D2 and reset on D3, and read MIFARE and NTAG card UIDs.

Arduino C++Verified — core avr 1.8.8, Adafruit PN532 1.3.4, 3 Nov 2026Compile-only

Community draft — report a mistake

The PN532 V3 is a red NFC module that reads MIFARE cards, NTAG stickers and can talk to phones. It can run over I2C, SPI or UART; two DIP switches choose which.

On the Uno, I2C is the simplest: power at 5V, SDA/SCL on the Uno’s I2C pins, plus IRQ on D2 and reset on D3, which the library uses to know when a card has been read. The sketch prints each card’s UID and guesses its type from the UID length — a starting point for attendance, canteen or door projects.

Wiring

Arduino Uno R3Only the pins used are shown · 5 V logicPN532 NFC / RFID module (13.56 MHz, V3)5VGNDD2D3SDA · 18SCL · 19GNDVCCSDASCLSCK (not connected)MISO (not connected)MOSI (not connected)SS (not connected)IRQRSTO
Also needed: NFC cards or tags (13.56 MHz: MIFARE Classic, NTAG213/215/216).
Every connection
Arduino Uno R3PN532 NFC / RFID module (13.56 MHz, V3)WireNotes
5VVCCredAbout 100–150 mA while reading. The module regulates its own 3.3 V.
GNDGNDblack
SDASDAblueSame signal as A4.
SCLSCLyellowSame signal as A5.
D2IRQpurpleLOW when the PN532 has an answer ready.
D3RSTOorangeReset, pulsed by the library at start-up.

3.3–5.5 V part, 5 V board. The V3 board has a regulator and level shifting, and its I2C pull-ups go to VCC. On ESP32 and Pico power it from 3.3 V so SDA/SCL stay at 3.3 V (read range drops only slightly); on Uno use 5 V.

Board quirks

  • Set the DIP switches to I2C — switch 1 ON, switch 2 OFF — and only then power up. The PN532 reads the mode at power-on.
  • On the Uno, 5 V is the right supply: the V3 board has a regulator and level shifting, and its I2C pull-ups go to VCC, which suits the Uno’s 5 V I2C.
  • The Uno’s SDA/SCL header pins next to AREF are the same signals as A4/A5. Use either, not both, and don’t use A4/A5 as analog inputs at the same time.
  • The Adafruit library keeps its packet buffers in RAM. This sketch fits easily, but a PN532 plus an OLED plus SD logging will run out of the Uno’s 2 KB — move to a Mega or ESP32 for that.
  • UID length hints at the card type: 4 bytes is usually MIFARE Classic (white cards, blue key fobs), 7 bytes NTAG / Ultralight (stickers). A UID alone is not secure — Classic UIDs can be copied.

Code

pn532-uno.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// PN532 NFC module (V3, I2C mode) on an Arduino Uno R3 — read card UIDs and guess the card type.
// DIP switches: 1 ON, 2 OFF (I2C). VCC → 5V, GND → GND, SDA → SDA (A4), SCL → SCL (A5), IRQ → D2, RSTO → D3.
#include <Wire.h>
#include <Adafruit_PN532.h>

const uint8_t PN532_IRQ = 2, PN532_RST = 3;
Adafruit_PN532 nfc(PN532_IRQ, PN532_RST, &Wire);

void setup() {
  Serial.begin(9600);
  nfc.begin();
  uint32_t ver = nfc.getFirmwareVersion();
  if (!ver) {
    Serial.println(F("PN532 not found - check the DIP switches (I2C = 1 ON, 2 OFF) and SDA/SCL"));
    while (true) delay(1000);
  }
  Serial.print(F("PN532 firmware "));
  Serial.print((ver >> 16) & 0xFF);
  Serial.print('.');
  Serial.println((ver >> 8) & 0xFF);
  nfc.SAMConfig();
  Serial.println(F("Tap a card or tag"));
}

void loop() {
  uint8_t uid[7];
  uint8_t len = 0;
  if (!nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &len, 500)) return;
  Serial.print(F("UID "));
  for (uint8_t i = 0; i < len; i++) {
    if (uid[i] < 0x10) Serial.print('0');
    Serial.print(uid[i], HEX);
    Serial.print(' ');
  }
  // 4-byte UIDs are usually MIFARE Classic (white cards, key fobs); 7-byte ones NTAG / Ultralight stickers.
  Serial.println(len == 4 ? F(" (4 bytes: MIFARE Classic?)") : len == 7 ? F(" (7 bytes: NTAG / Ultralight?)") : F(""));
  delay(1000);  // one line per tap
}

Library: Adafruit PN532 (Adafruit) — compiled with Adafruit PN532 1.3.4.

Expected serial output

Serial Monitor · 9600Output
PN532 firmware 1.6
Tap a card or tag
UID 7A 3F 1C 9E  (4 bytes: MIFARE Classic?)
UID 04 A2 3C B2 C5 12 90  (7 bytes: NTAG / Ultralight?)

Common errors

“PN532 not found”

DIP switches not on I2C, or changed after power-up — unplug and replug USB. Then check SDA/SCL and run the I2C scanner; the PN532 answers at 0x24.

Firmware found, cards never read

IRQ not on D2. In I2C mode the library waits for IRQ to go LOW before it reads the answer.

Reads only when the card touches the board

Normal range is 3–5 cm. Keep metal away from the antenna, and don’t power it from a weak USB port.

↑↓ to move · Enter to open