← All parts
Adafruit PN532 NFC/RFID
AdafruitPN532
The PN532 is an NFC and RFID module used for contactless communication. It supports various protocols like TTL serial, I2C, and SPI.
In stock
Specifications
2- Operating Voltage
- 3.3V or 5V Volts
- Logic Level
- TTL compatible
Pinout
12| Pin | Name | Functions | Notes |
|---|---|---|---|
| 1 | GND | GND | Ground |
| 2 | VCC | POWER | Power supply, typically 3.3V or 5V. |
| 3 | SDA | I2C | I2C data line |
| 4 | SCL | I2C | I2C clock line |
| 5 | TX | UART | Transmit data for serial communication. |
| 6 | RX | UART | Receive data for serial communication. |
| 7 | GND | GND | Ground |
| 8 | VCC | POWER | Power supply, typically 3.3V or 5V. |
| 9 | SCK | SPI | Serial clock for SPI communication |
| 10 | MOSI | SPI | Master Out/Slave In for SPI. |
| 11 | MISO | SPI | Master In/Slave Out for SPI. |
| 12 | CS | SPI | Chip select line for SPI |
Interactive pinout
Highlight:
PN532
Click a pin to copy its name · tap a tag above to spotlight a bus.
Starter code
Community starter examples — minimal, unofficial, and provided to get you wiring fast. Verify against the manufacturer datasheet before relying on them.
Arduino (C++)
Arduino library: Adafruit PN532
arduino
// PN532 NFC/RFID reader (I2C) — community starter example
#include <Wire.h>
#include <Adafruit_PN532.h>
#if defined(ESP32)
#define PN532_IRQ 4
#define PN532_RST 5
#else
#define PN532_IRQ 2
#define PN532_RST 3
#endif
Adafruit_PN532 nfc(PN532_IRQ, PN532_RST); // I2C mode
void setup() {
Serial.begin(115200);
nfc.begin();
if (!nfc.getFirmwareVersion()) { Serial.println("PN532 not found"); while (1) delay(10); }
nfc.SAMConfig();
Serial.println("Tap an NFC tag...");
}
void loop() {
uint8_t uid[7]; uint8_t uidLen;
if (nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLen)) {
Serial.print("UID bytes: "); Serial.println(uidLen);
}
delay(500);
}MicroPython
MicroPython library: pn532 (a PN532 MicroPython port)
python
# PN532 NFC (ESP32, I2C) — community starter example
# lib: a PN532 MicroPython driver (e.g. Carglglz/NFC_PN532)
from machine import Pin, I2C
from pn532 import PN532_I2C
import time
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
nfc = PN532_I2C(i2c)
nfc.SAM_configuration()
while True:
uid = nfc.read_passive_target(timeout=0.5)
if uid:
print("UID", [hex(b) for b in uid])
time.sleep(0.2)Wiring
| Pin | Arduino Uno R3 | ESP32 DevKitC (WROOM-32) | Notes |
|---|---|---|---|
| VCC | +5V | 3V3 | Logic 3.3-5 V |
| GND | GND | GND | |
| SDA | A4/SDA | GPIO21 | I2C data (set the board's mode switch to I2C) |
| SCL | A5/SCL | GPIO22 | I2C clock |
| RSTPDN | D3 | GPIO5 | Reset |
| IRQ | D2 | GPIO4 | Interrupt |
Typical uses
- NFC / RFID read & write (13.56 MHz)
- Card emulation and peer-to-peer NFC