PN532 V4 Documentation

PN532 V4 Documentation covers quick start steps, wiring references, supported platforms, code examples, and troubleshooting for the ELECHOUSE PN532 NFC RFID Module V4.

Quick Start

  1. Select the communication interface on the module before wiring it. PN532 V4 supports I2C, SPI, and HSU (High Speed UART).
  2. Wire the module to your host board using the header that matches the selected interface.
  3. Install the ELECHOUSE PN532 Arduino library.
  4. Open a basic example such as readMifare or iso14443a_uid, compile, and upload.
  5. Open the serial monitor at 115200 baud and tap a tag or card to verify communication.

Pinout and Wiring Reference

The board exposes separate headers for I2C and SPI. Follow the silkscreen on the module.

I2C Header

Module Pin Typical Arduino Uno Notes
SCL A5 I2C clock
SDA A4 I2C data
VCC 5V Module supports 3.3V to 5V supply
GND GND Common ground required

SPI Header

Module Pin Typical Arduino Uno Notes
RSTO Optional GPIO Reset output / optional depending on sketch
IRQ Optional GPIO Interrupt line if used by your firmware
GND GND Common ground
VCC 5V Board supports 3.3V to 5V supply
SS D10 SPI chip select
MOSI D11 SPI MOSI
MISO D12 SPI MISO
SCK D13 SPI clock

Note: PN532 V4 also supports HSU/UART mode. If you use HSU, make sure the module interface selection matches your wiring and chosen library wrapper.

Supported Platforms

  • Arduino Uno, Mega, Leonardo, Nano, Due
  • ESP32 and ESP8266
  • Raspberry Pi through SPI or I2C
  • Linux systems using libnfc or nfcpy
  • Windows hosts through a suitable serial or USB bridge workflow

Initialization Method

  1. Confirm the module is in the correct communication mode.
  2. Install the ELECHOUSE PN532 library from GitHub.
  3. Choose the correct transport wrapper in code: PN532_I2C, PN532_SPI, or PN532_HSU.
  4. Call nfc.begin() and check getFirmwareVersion() before reading tags.

Example Code

#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>

PN532_I2C pn532_i2c(Wire);
PN532 nfc(pn532_i2c);

void setup() {
  Serial.begin(115200);
  nfc.begin();

  uint32_t version = nfc.getFirmwareVersion();
  if (!version) {
    Serial.println("Didn't find PN53x board");
    while (1) {}
  }

  nfc.SAMConfig();
  Serial.println("PN532 ready");
}

void loop() {
}

Useful examples in the ELECHOUSE repository:

  • readMifare
  • iso14443a_uid
  • mifareclassic_memdump
  • emulate_tag_ndef
  • p2p_raw

Drivers and Libraries

  • ELECHOUSE PN532 library
  • NDEF examples may also rely on Don’s NDEF library as noted in the repository README
  • Linux users can test with libnfc or nfcpy

Common Errors

  • No firmware response: the module interface selection and code wrapper do not match.
  • No tag detected: wrong wiring, low supply voltage, or the tag is out of range / not supported.
  • Unstable output: serial baud rate mismatch or loose jumper / breadboard wiring.
  • Short read distance: metal nearby, poor tag orientation, or heavy electrical noise.

Troubleshooting

  • Re-check the interface setting on the board before changing code.
  • Use only one communication interface at a time.
  • Start with a simple example such as readMifare before trying NDEF or P2P.
  • Keep the antenna area clear of large metal objects during testing.
  • If you move from V3 to V4, existing code should still work as long as the interface mode is correct.

V4 vs V3

Metric PN532 V3 PN532 V4
Reading distance (Mifare tag, PVC) 5–6 cm 6–8 cm
Reading distance (SRT512, PVC) 1–2 cm 2–4 cm
Compatibility V4 is hardware- and software-compatible with V3

Downloads and Support

Update History

  • 2026-04-05: First public documentation page for PN532 V4.
  • Hardware note: V4 improves reading performance while remaining compatible with V3 mechanical and software workflows.

Related Pages

RFID & NFC Module Selection Guide

Not sure which module fits your project? See the full comparison with protocol support, interface options, and use case guidance in our RFID & NFC Module Selection Guide.

Related Documentation

UART / HSU Wiring (Arduino)

Module Pin Arduino Uno Notes
TX RX (pin 0) or SoftwareSerial RX pin Module transmit → host receive
RX TX (pin 1) or SoftwareSerial TX pin Module receive → host transmit
VCC 5V 3.3V also supported
GND GND Common ground

On Uno, use SoftwareSerial on pins 2/3 to avoid conflict with the USB serial port. Set the interface jumper on the module to HSU before wiring.

ESP32 Wiring (SPI)

Module Pin ESP32 Notes
SS GPIO5 SPI chip select
MOSI GPIO23 SPI MOSI
MISO GPIO19 SPI MISO
SCK GPIO18 SPI clock
VCC 3.3V or 5V Both voltages supported
GND GND Common ground

Raspberry Pi Wiring (SPI)

Module Pin Raspberry Pi Notes
SS Pin 24 (CE0) SPI chip select
MOSI Pin 19 (MOSI)
MISO Pin 21 (MISO)
SCK Pin 23 (SCLK)
VCC Pin 1 (3.3V)
GND Pin 6

Enable SPI with sudo raspi-config → Interface Options → SPI. Test with libnfc or nfcpy.

Supported Card and Tag Types

Card / Tag Standard Read UID Read/Write Data
Mifare Classic 1K / 4K ISO 14443A ✓ (with auth key)
Mifare Ultralight / C ISO 14443A
NTAG213 / 215 / 216 ISO 14443A / NFC Forum T2T ✓ (NDEF)
Mifare DESFire EV1/EV2 ISO 14443A ✓ (with crypto)
FeliCa (e.g. Suica) ISO 18092 Read only (limited)
ISO 14443B ISO 14443B Limited

Write URL to NTAG Tag (NDEF Example)

#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>

PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc(pn532_i2c);

void setup() {
  Serial.begin(115200);
  nfc.begin();
}

void loop() {
  Serial.println("Place an NTAG tag to write...");
  if (nfc.tagPresent()) {
    NdefMessage message = NdefMessage();
    message.addUriRecord("https://www.elechouse.com");
    bool success = nfc.write(message);
    if (success) Serial.println("Write successful");
    else         Serial.println("Write failed");
  }
  delay(3000);
}

Requires the NDEF library by Don Coleman in addition to the ELECHOUSE PN532 library. Works with NTAG213, NTAG215, and NTAG216 tags.

Card Emulation Mode

The PN532 supports NFC card emulation — it can make your microcontroller appear to be an NFC tag when touched by a phone or reader. This is useful for:

  • Custom NFC payment or loyalty card simulation
  • HCE (Host Card Emulation) prototyping
  • NFC-based authentication tokens
  • Android Beam / P2P data exchange

Card emulation reading distance: Up to approximately 100mm — significantly longer than the 50mm typical for reader/writer mode. This is because in emulation mode, the external reader drives the RF field.

// Basic NFC card emulation sketch structure (requires PN532 emulation example)
// The PN532 responds to an external reader as if it were a tag.
// See: examples/emulate_tag_ndef in the ELECHOUSE PN532 library

#include <PN532_I2C.h>
#include <PN532.h>

PN532_I2C pn532_i2c(Wire);
PN532 nfc(pn532_i2c);

void setup() {
  Serial.begin(115200);
  nfc.begin();
  nfc.SAMConfig();
  // Set to target (emulation) mode
  // Refer to emulate_tag_ndef example for full implementation
}

MIFARE Security Levels Explained

Not all MIFARE cards offer the same security. Understanding the differences helps you choose the right card for your application:

Card Type Encryption Security Level Typical Use
MIFARE Classic 1K/4K Crypto1 (48-bit, proprietary) Low — known vulnerabilities Low-security access, transit (legacy)
MIFARE Ultralight None (or OTP lock) Very low Disposable tickets, event passes
MIFARE Ultralight C 3DES Medium Transport tickets, event wristbands
NTAG213/215/216 Password (32-bit) Low–Medium NFC stickers, IoT triggers
MIFARE DESFire EV1 DES / 3DES / AES High Access control, e-passports
MIFARE DESFire EV2/EV3 AES-128, Proximity Check Very High Secure payments, ID documents

Recommendation: For any new access control system, use MIFARE DESFire EV2 or EV3. MIFARE Classic should be considered insecure for sensitive applications.

Reading Distance Optimization Tips

  • Metal nearby reduces range: Metal surfaces behind or around the antenna create eddy currents that counteract the RF field. If metal is unavoidable, consider the PN5321 MINI with ferrite-backed antenna.
  • Tag orientation matters: NFC is most effective when the tag antenna is parallel to the module antenna. Angling the tag significantly reduces coupling.
  • Power supply noise: A noisy 5V supply (from a switching regulator) can reduce reading stability. Add a 100µF + 100nF decoupling capacitor close to VCC on the module.
  • I2C speed: At 400 kHz fast mode, I2C communication is more stable than at 100 kHz in noisy environments. The ELECHOUSE library defaults to a safe speed.
Shopping Cart