

The PN532 NFC RFID Module is a versatile and widely used component for Near Field Communication (NFC) and Radio Frequency Identification (RFID) applications. It enables wireless communication over short distances, making it ideal for a variety of tasks such as reading NFC tags, emulating NFC cards, and interacting with other NFC-enabled devices. The module supports multiple protocols, including ISO/IEC 14443 Type A and B, and is compatible with I2C, SPI, and UART interfaces, making it highly adaptable for integration into various projects.








The PN532 NFC RFID Module is designed to provide robust and flexible NFC functionality. Below are its key technical details:
The PN532 module typically has the following pin layout:
| Pin Name | Description |
|---|---|
| VCC | Power supply input (3.3V or 5V, depending on the module version). |
| GND | Ground connection. |
| SDA | I2C data line (used in I2C communication mode). |
| SCL | I2C clock line (used in I2C communication mode). |
| MOSI | Master Out Slave In (used in SPI communication mode). |
| MISO | Master In Slave Out (used in SPI communication mode). |
| SCK | Serial Clock (used in SPI communication mode). |
| NSS/CS | Chip Select (used in SPI communication mode). |
| RXD | UART receive pin (used in UART communication mode). |
| TXD | UART transmit pin (used in UART communication mode). |
| IRQ | Interrupt request pin (used for event notifications). |
| RSTPD | Reset and power-down pin (used to reset the module or enter power-down mode). |
Note: The exact pin configuration may vary slightly depending on the manufacturer. Always refer to the specific datasheet for your module.
The PN532 NFC RFID Module can be used in a variety of projects. Below are the steps to integrate and use the module effectively:
Below is an example of how to use the PN532 module with an Arduino UNO via I2C:
#include <Wire.h>
#include <Adafruit_PN532.h>
// Define the I2C pins for the PN532 module
#define SDA_PIN 2
#define SCL_PIN 3
// Create an instance of the Adafruit_PN532 library
Adafruit_PN532 nfc(SDA_PIN, SCL_PIN);
void setup() {
Serial.begin(9600); // Initialize serial communication
Serial.println("Initializing PN532 module...");
nfc.begin(); // Initialize the PN532 module
// Check if the module is detected
uint32_t versiondata = nfc.getFirmwareVersion();
if (!versiondata) {
Serial.println("PN532 not detected. Check connections.");
while (1); // Halt execution
}
// Display firmware version
Serial.print("Found PN532 with firmware version: ");
Serial.println((versiondata >> 16) & 0xFF, HEX);
// Configure the module to read passive targets (NFC tags)
nfc.SAMConfig();
Serial.println("PN532 ready to scan NFC tags.");
}
void loop() {
Serial.println("Waiting for an NFC tag...");
// Check for an NFC tag
uint8_t success;
uint8_t uid[] = { 0 };
uint8_t uidLength;
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
if (success) {
Serial.println("NFC tag detected!");
Serial.print("UID Length: "); Serial.println(uidLength);
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 again
} else {
Serial.println("No NFC tag detected.");
}
delay(500); // Short delay before retrying
}
PN532 Not Detected:
Short Communication Range:
Module Not Responding:
Interference with Other Devices:
Q: Can the PN532 module emulate an NFC card?
A: Yes, the PN532 supports card emulation mode for certain NFC protocols.
Q: What is the maximum range of the PN532 module?
A: The typical range is around 5 cm, depending on the antenna and tag type.
Q: Can I use the PN532 with a Raspberry Pi?
A: Yes, the PN532 is compatible with Raspberry Pi via I2C, SPI, or UART.
Q: Do I need external pull-up resistors for I2C?
A: Some modules include built-in pull-up resistors, but if not, you will need to add them.
This concludes the documentation for the PN532 NFC RFID Module.