

The PN532 NFC RFID Module V4 is a versatile and widely used module for enabling wireless communication with NFC-enabled devices and RFID tags. It is based on the NXP PN532 chip, which supports multiple communication protocols, including I2C, SPI, and UART. This module is ideal for applications such as contactless payments, access control, data exchange, and smart card reading.
With its robust design and compatibility with various microcontrollers, including Arduino, Raspberry Pi, and others, the PN532 module is a popular choice for developers and hobbyists working on NFC and RFID projects.








Below are the key technical details of the PN532 NFC RFID Module V4:
The PN532 module has multiple pins for communication and power. Below is the pin configuration:
| Pin Name | Description |
|---|---|
| VCC | Power input (3.3V or 5V) |
| 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) |
| SS | Slave Select (used in SPI communication mode) |
| TXD | UART transmit line (used in UART communication mode) |
| RXD | UART receive line (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) |
Below is an example of how to use the PN532 module with an Arduino UNO in I2C mode:
#include <Wire.h>
#include <Adafruit_PN532.h>
// Define the I2C pins for the PN532 module
#define SDA_PIN 2 // SDA pin on Arduino
#define SCL_PIN 3 // SCL pin on Arduino
// 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 if module is not found
}
// 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.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 again
} else {
Serial.println("No NFC tag detected.");
}
delay(500); // Short delay before next scan
}
PN532 Module Not Detected:
NFC Tags Not Being Read:
Communication Errors:
Q: Can the PN532 module write data to NFC tags?
A: Yes, the PN532 module can both read from and write to compatible NFC tags.
Q: What is the maximum range of the PN532 module?
A: The maximum range is approximately 5 cm, depending on the tag and environmental conditions.
Q: Can I use the PN532 module with a Raspberry Pi?
A: Yes, the PN532 module is compatible with Raspberry Pi. You can use libraries such as "libnfc" or Python-based libraries for integration.
Q: How do I switch between I2C, SPI, and UART modes?
A: The communication mode can be selected by configuring the onboard jumpers or switches on the module. Refer to the module's datasheet for specific instructions.