

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, card emulation, and peer-to-peer communication. This flexibility makes the PN532 an ideal choice for a wide range of applications, such as:
The PN532 is widely used due to its compatibility with various microcontrollers, including Arduino, and its support for multiple NFC protocols.








The PN532 is a highly integrated NFC controller with the following key specifications:
| Parameter | Value |
|---|---|
| Operating Voltage | 2.7V to 5.5V |
| Communication Interfaces | I²C, SPI, UART |
| Operating Frequency | 13.56 MHz |
| Supported Protocols | ISO/IEC 14443 Type A & B, FeliCa, NFC Forum Type 1-4 Tags |
| Maximum Communication Range | Up to 5 cm (depending on antenna design and environment) |
| Current Consumption | ~50 mA (active mode), ~100 µA (low-power mode) |
| Operating Temperature | -25°C to +85°C |
The PN532 module typically comes with the following pin configuration:
| Pin Name | Pin Number | Description |
|---|---|---|
| VCC | 1 | Power supply input (2.7V to 5.5V) |
| GND | 2 | Ground connection |
| SDA | 3 | I²C data line (used for I²C communication) |
| SCL | 4 | I²C clock line (used for I²C communication) |
| MOSI | 5 | Master Out Slave In (used for SPI communication) |
| MISO | 6 | Master In Slave Out (used for SPI communication) |
| SCK | 7 | Serial Clock (used for SPI communication) |
| NSS | 8 | SPI Chip Select (active low) |
| RX | 9 | UART Receive (used for UART communication) |
| TX | 10 | UART Transmit (used for UART communication) |
| IRQ | 11 | Interrupt Request (used to signal events to the microcontroller) |
| RST | 12 | Reset pin (active low, used to reset the module) |
The PN532 can be interfaced with an Arduino UNO using I²C, SPI, or UART. Below is an example of connecting the PN532 using the I²C interface:
| PN532 Pin | Arduino UNO Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| SDA | A4 |
| SCL | A5 |
| IRQ | Not connected |
| RST | Digital Pin 2 |
The following Arduino sketch demonstrates how to use the PN532 in I²C mode to read an NFC tag. This example uses the Adafruit_PN532 library, which can 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
#define RST_PIN 2
// 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 connected
uint32_t versiondata = nfc.getFirmwareVersion();
if (!versiondata) {
Serial.println("Didn't find PN532 module!");
while (1); // Halt execution if the module is not found
}
// Display firmware version
Serial.print("Found PN532 with firmware version: ");
Serial.print((versiondata >> 16) & 0xFF, HEX);
Serial.print('.');
Serial.println((versiondata >> 8) & 0xFF, HEX);
// Configure the module 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;
// Attempt to read an NFC tag
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
if (success) {
Serial.println("NFC tag detected!");
// Print the UID of the tag
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 before scanning for another tag
}
}
PN532 module not detected:
NFC tag not detected:
Incorrect UID or data:
By following this documentation, you can effectively integrate the PN532 into your projects and leverage its NFC capabilities for a variety of applications.