How to Use the PN532 for NFC and RFID

The PN532 is an NFC (Near Field Communication) controller chip from NXP that reads and writes ISO14443A-compliant cards and tags, including the MIFARE family used in access badges, transit cards, and student ID cards. Unlike simpler RFID readers, a PN532 module can operate in three distinct roles — reader/writer (scanning a card and pulling data off it), card emulation (acting like a card so another NFC reader can scan the module itself), and peer-to-peer (exchanging data directly with another NFC device, such as a phone). It talks to a host microcontroller over I2C, SPI, or UART, with the interface usually selected on the breakout board through a pair of onboard DIP switches or solder jumpers rather than in firmware.

What can the PN532 actually do?

Most RFID modules sold for hobbyist projects, including the widely used MFRC522, only do one thing: read and write 13.56MHz MIFARE cards. The PN532 covers that same ground and adds two capabilities that the cheaper modules don't have:

  • Reader/writer mode — scans ISO14443A cards and tags (MIFARE Classic, MIFARE Ultralight, NTAG-series tags) and reads or writes their memory blocks. This is the mode used for attendance systems, access control, and inventory tags.
  • Card emulation mode — the PN532 itself can act as a virtual NFC card, which is what lets a project respond to a phone's NFC reader instead of only reading cards itself.
  • Peer-to-peer mode — two NFC-capable devices (for example, a PN532 and a modern smartphone) can exchange small amounts of data directly, the same underlying mechanism behind Android Beam-style file transfers.

For a plain "scan a card and print its ID" project, only the first mode is needed, and an MFRC522 would do the job for less money. The PN532 earns its higher price when a project needs to talk to a phone, not just a card.

I2C vs SPI vs UART: which PN532 mode should you use?

Every PN532 breakout board supports all three interfaces, but only one is active at a time, and switching between them is a hardware step, not a software one:

  • I2C — uses two wires (SDA, SCL) plus power and ground. The simplest wiring option and the right default for an Arduino Uno project, since the Uno's I2C bus is fixed to two known pins and most PN532 breakout boards ship in I2C mode out of the box.
  • SPI — uses four data/control lines (MOSI, MISO, SCK, SS) instead of two. Faster than I2C, and preferred when a project also needs the PN532's interrupt line for fast response, but it uses more pins on a pin-constrained board like the Uno.
  • UART — uses two serial lines (TX, RX). Useful when connecting to a board that doesn't expose spare I2C or SPI pins, or when driving the module from something other than a microcontroller, such as a Raspberry Pi's serial port.

Selecting the mode is done on the board itself, usually with two small DIP switches or a pair of solder jumper pads silkscreened SEL0/SEL1 or similar. Check your specific breakout's silkscreen and documentation, since the switch positions for each mode are not standardized across manufacturers. For an Arduino Uno build, I2C is the standard choice: it needs the fewest wires and leaves the Uno's SPI pins free for anything else the project might use later.

How do you wire the PN532 to an Arduino Uno over I2C?

With the module's interface switches set to I2C, four connections are all that's needed:

Arduino Uno pin PN532 pin Signal
5V VCC Power
GND GND Ground
A4 SDA I2C data
A5 SCL I2C clock

The PN532's own logic runs at 3.3V, but most breakout modules — including the one Compoden stocks — accept a supply anywhere from 3.3V to 5V and regulate it internally, which is why connecting VCC straight to the Uno's 5V pin is the standard wiring pattern rather than something requiring a separate level shifter. The IRQ pin can be left disconnected for basic polling-based card detection; it only needs to be wired to a digital pin if the firmware is written to wait for a hardware interrupt instead of repeatedly checking for a card. The default I2C address for the PN532 is 0x24, which is what libraries expect out of the box.

PN532 vs MFRC522: which RFID module should you buy?

These are the two RFID/NFC modules most commonly paired with an Arduino Uno, and the choice comes down to what the project needs to talk to:

PN532 MFRC522
Reads/writes MIFARE cards Yes Yes
Card emulation (acts as a card) Yes No
Peer-to-peer / phone NFC tap Yes No
Interfaces I2C, SPI, UART SPI only
Typical price on Compoden Higher (see table below) Rs.180-260

If a build only ever needs to scan MIFARE cards or tags and print an ID, the MFRC522 does that at a fraction of the cost and is the more common choice in student projects and access-control tutorials. The PN532 is worth the extra cost specifically when a project needs to react to a phone tap, emulate a card, or exchange data peer-to-peer — capabilities the MFRC522's chip does not have at all, regardless of firmware.

Watch it built live

We typed this into Compoden's storefront assistant, Soldr, exactly as a customer would:

"I want to build an NFC/RFID card reader using a PN532 module and an Arduino Uno"

Compoden storefront AI assistant Soldr building a PN532 NFC RFID card reader parts tray with Arduino Uno

Soldr picked a five-part tray built around a genuine PN532-based module — the Elecrow Crowtail NFC 2.0 RFID Reader Module — and explained the build in plain language: "This build lets you read information from NFC/RFID cards or tags. It uses a small computer to talk to a special reader, which then communicates with the cards. This way, you can build a system that recognizes different cards for things like access control or inventory tracking." On the reader module specifically, it noted: "The Elecrow Crowtail NFC 2.0 RFID Reader Module (PN532) is the part that actually reads the NFC/RFID cards. It has a PN532 chip inside. This module can also communicate using I2C, SPI, or UART." It also flagged the voltage difference between the two main parts as the thing to watch: "the Arduino uses 5V logic, while the NFC reader uses 3.3V logic. Connecting them directly without proper level shifting can damage the 3.3V device."

Watch the firmware get generated

We then took the same project to Compoden's VoltIQ code assistant and asked it to write working firmware:

"I'm using a PN532 NFC/RFID module over I2C with an Arduino Uno. Write the full firmware to detect a card and print its UID to the serial monitor."

VoltIQ PWA generated Arduino firmware for PN532 NFC RFID module using Adafruit PN532 library over I2C

The generated sketch includes Wire.h and Adafruit_PN532.h, which is the standard library path for driving a PN532 over I2C. The firmware panel opens with a wiring comment block spelling out the exact connections it assumed — SDA to A4, SCL to A5, VCC to 5V, GND to GND — and notes that the IRQ pin can be left unconnected for polling mode or wired to a digital pin for interrupt-driven detection. It also calls out the default I2C address, 0x24, in a comment. The instructions above the code panel are explicit about the one manual step every PN532 project needs: "Flash this sketch to your Arduino Uno. Install via Library Manager: 'Adafruit PN532' (by Adafruit)" — that library isn't bundled with the Arduino IDE by default and has to be added before the sketch will compile.

What can you build with a PN532?

Because it can read a card, act as a card, and exchange data with a phone, the PN532 shows up in projects that plain card readers can't cover on their own: attendance and time-tracking systems that scan an ID badge, access-control locks that respond to a keyfob or card, prototype NFC payment or loyalty-tap systems, and phone-tap automations where touching a phone to the module triggers an action — turning on a light, unlocking a door, or launching a routine — without needing an app in the middle.

Get everything in this build

These are the exact parts Soldr selected for this build, with live prices and direct add-to-cart links.

Part Price Add to cart
Arduino Uno R3 CH340G ATmega328P Board Rs.230 Add to cart
Elecrow Crowtail NFC 2.0 RFID Reader Module (PN532) Rs.1530 Add to cart
23 AWG Multi-Strand Breadboard Wire Rs.10 Add to cart
SYB-170 Mini Breadboard Rs.20 Add to cart
USB-C 5V 3A Power Supply Adapter Rs.180 Add to cart
Total Rs.1,970 Add all 5 to cart

The reader module listed above is a genuine PN532-based board, not a substitute. Compoden also stocks the cheaper MFRC522 module (Rs.180-260) for projects that only need to read and write MIFARE cards without NFC phone-tap or card-emulation support — see the comparison table above for which one fits your project.

Built and Backed by Compoden

Every part listed above ships from Compoden's India stock, so there's no long international shipping wait on an NFC module. Parts are checked for compatibility with the boards they're paired with before they're listed together in a build like this one. Orders typically arrive in 3-7 days, Cash on Delivery and UPI are both supported at checkout, and Compoden's support team is available if you run into wiring or firmware issues while building.

Frequently asked questions

What's the difference between the PN532 and the MFRC522?
Both read and write MIFARE cards, but the PN532 also supports card emulation (acting as a card) and peer-to-peer communication with other NFC devices like phones, which the MFRC522 cannot do at all. The MFRC522 is cheaper and is the better fit when a project only needs to scan cards.

Does the PN532 work with I2C, SPI, and UART at the same time?
No. A PN532 breakout board supports all three interfaces, but only one is active at a time, selected with onboard DIP switches or solder jumpers. Changing modes is a hardware change on the board, not something done in firmware.

Can the PN532 read a phone's NFC instead of just cards?
Yes, through its peer-to-peer and card-emulation modes. This is what separates it from simpler RFID readers, which can only read passive cards and tags, not exchange data with an active NFC device like a smartphone.

What library does the PN532 use with an Arduino Uno?
The standard library is Adafruit's PN532 library ("Adafruit PN532" in the Arduino Library Manager), which handles I2C, SPI, or UART communication with the chip and exposes functions for reading a card's UID and its memory blocks.

Back to blog