

The PN532 is a versatile NFC (Near Field Communication) controller that enables communication with NFC-enabled devices. It supports multiple modes of operation, including reader/writer, peer-to-peer, and card emulation. This flexibility makes the PN532 an ideal choice for a wide range of applications, such as:
The PN532 is widely used in embedded systems and is compatible with microcontrollers like the Arduino UNO, making it accessible for both hobbyists and professionals.








The PN532 is a highly integrated NFC controller with the following key technical details:
| Parameter | Value |
|---|---|
| Operating Voltage | 2.7V to 5.5V |
| Communication Interfaces | I²C, SPI, UART |
| Operating Frequency | 13.56 MHz |
| Current Consumption | ~50 mA (active mode) |
| Supported Protocols | ISO/IEC 14443A/B, FeliCa, NFC-IP1 |
| Operating Modes | Reader/Writer, Peer-to-Peer, Card Emulation |
The PN532 module typically comes with a breakout board. Below is the pin configuration for a common PN532 breakout board:
| Pin Name | Description |
|---|---|
| VCC | Power supply input (2.7V to 5.5V) |
| GND | Ground |
| SCL | I²C clock line (used in I²C mode) |
| SDA | I²C data line (used in I²C mode) |
| MOSI | Master Out Slave In (used in SPI mode) |
| MISO | Master In Slave Out (used in SPI mode) |
| SCK | Serial Clock (used in SPI mode) |
| SS | Slave Select (used in SPI mode) |
| RX | UART receive line (used in UART mode) |
| TX | UART transmit line (used in UART mode) |
| IRQ | Interrupt request output |
| RST | Reset pin |
The PN532 can be used in various modes depending on the application. Below are general instructions for using the PN532 with an Arduino UNO in I²C mode.
Below is an example Arduino sketch to read an NFC tag using the PN532 in I²C mode. This code uses the Adafruit_PN532 library, which must be installed via the Arduino Library Manager.
#include <Wire.h>
#include <Adafruit_PN532.h>
// Define the I²C pins for the PN532
#define SDA_PIN A4
#define SCL_PIN A5
// Create an instance of the Adafruit_PN532 class
Adafruit_PN532 nfc(SDA_PIN, SCL_PIN);
void setup() {
Serial.begin(9600); // Initialize serial communication
Serial.println("Initializing PN532...");
nfc.begin(); // Initialize the PN532 module
// Check if the PN532 is responding
uint32_t versiondata = nfc.getFirmwareVersion();
if (!versiondata) {
Serial.println("Didn't find PN532 board");
while (1); // Halt execution if the board is not found
}
// Display firmware version
Serial.print("Found PN532 with firmware version: ");
Serial.println((versiondata >> 16) & 0xFF, HEX);
// Configure the board to read NFC tags
nfc.SAMConfig();
Serial.println("Waiting for an NFC tag...");
}
void loop() {
uint8_t success;
uint8_t uid[] = { 0 }; // Buffer to store the UID
uint8_t uidLength; // Length of the UID
// Attempt to read an NFC tag
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
if (success) {
Serial.println("NFC tag detected!");
Serial.print("UID Length: "); Serial.print(uidLength, DEC); Serial.println(" bytes");
Serial.print("UID Value: ");
for (uint8_t i = 0; i < uidLength; i++) {
Serial.print(" 0x"); Serial.print(uid[i], HEX);
}
Serial.println();
delay(1000); // Wait 1 second before scanning again
}
}
The PN532 is not detected by the Arduino.
NFC tags are not being detected.
Communication errors occur during operation.
Q: Can the PN532 read and write NFC tags?
A: Yes, the PN532 supports both reading and writing NFC tags in reader/writer mode.
Q: What is the maximum communication range of the PN532?
A: The typical range is 2-5 cm, depending on the antenna design and the NFC tag.
Q: Can the PN532 be used with a Raspberry Pi?
A: Yes, the PN532 can be interfaced with a Raspberry Pi using I²C, SPI, or UART communication.
Q: Does the PN532 support peer-to-peer communication?
A: Yes, the PN532 supports peer-to-peer mode for data exchange between NFC-enabled devices.