ESP32 PN532 NFC Module

PN532 NFC Module image

PN532

Protocol: I2C,SPI,UART

Overview

The PN532 NFC module provides a powerful and flexible platform for integrating NFC and RFID capabilities into your projects. Its multi-protocol support and versatile interfaces make it suitable for various use cases, including access control, contactless payment, and data exchange.

About PN532 NFC Module

The PN532 is a widely used NFC and RFID module, offering reliable wireless data exchange for various applications.

Key Features

  • Multi-Protocol Support – Works with ISO/IEC 14443 Type A & B cards and NFC peer-to-peer communication.
  • Flexible Interfaces – Supports I2C, SPI, and UART, ensuring easy integration.
  • Versatile Applications – Ideal for access control, contactless payments, smart authentication, and data exchange.
  • Compact & Efficient – Low power consumption with a high-performance NFC controller.

Where to Buy

PN532 NFC Module

Starting from

8.00$ per unit

Amazon com
Amazon.com Ships worldwide
View Price
Amazon de
Amazon.de Ships to EU
View Price
Aliexpress
AliExpress Best value
View Price

Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.

Technical Specifications

Communication Protocols I2C, SPI, UART
Operating Voltage 3.3V or 5V
Supported Standards ISO/IEC 14443 Type A & B, NFC
Operating Temperature -25°C to +85°C
Dimensions 40mm x 40mm x 4mm

Pinout Configuration

The VCC pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND pin is the ground connection and must be connected to the ground of your ESP32.

PN532 Communication Modes

The PN532 module is a versatile NFC controller that supports multiple communication protocols, including I²C, SPI, and HSU (High-Speed UART). Depending on your requirements, you can select the desired communication mode by setting the small switches to the appropriate positions.

I²C Mode

ProtocolSwitch 1Switch 2
I2C
  • VCC: Power supply (3.3V or 5V)
  • GND: Ground
  • SDA: I²C Data Line
  • SCL: I²C Clock Line
  • IRQ: Optional (for interrupts)
  • RSTO: Optional (reset)

SPI Mode

ProtocolSwitch 1Switch 2
I2C
  • VCC: Power supply (3.3V or 5V)
  • GND: Ground
  • MISO: Master In Slave Out
  • MOSI: Master Out Slave In
  • SCK: Serial Clock
  • SS (NSS): Slave Select
  • IRQ: Optional (for interrupts)
  • RSTO: Optional (reset)

HSU Mode (High-Speed UART)

ProtocolSwitch 1Switch 2
I2C

💡 When using HSU (High-Speed UART) mode, the SDA (I²C Data) and SCL (I²C Clock) pins are repurposed as UART TX and RX.

  • VCC: Power supply (3.3V or 5V)
  • GND: Ground
  • SDA (TX): Transmit Data (to MCU RX)
  • SCL (RXD): Receive Data (to MCU TX)
  • IRQ: Optional (for interrupts)
  • RSTO: Optional (reset)

PN532 Pins Required For Different Protocols

PN532 PinI²C ModeSPI ModeHSU Mode (UART)
VCC
GND
SDA✅ (I²C Data)✅ (TX - To ESP32 RX)
SCL✅ (I²C Clock)✅ (RX - To ESP32 TX)
MISO
MOSI
SCK
SS (NSS)
IRQOptionalOptionalOptional
RSTOOptionalOptionalOptional

3D Printed Enclosure

PN532 NFC Module enclosure

We offer a variety of enclosures for the ESP32 C3 Super Mini, available in different colors and configurations – with or without header pins, and more! You can also choose between a hexagon-patterned lid for improved heat dispersion ❄️ or a solid lid for a sleek finish.

🛍️ View on Etsy

Premium Quality

💡

Each enclosure is carefully designed and tested to ensure perfect fit and functionality. Made with premium materials for durability and aesthetics.

Wiring with ESP32

SPI Protocol Wiring with ESP32

In SPI (Serial Peripheral Interface) mode, the PN532 NFC module communicates with the ESP32 using a fast, synchronous data exchange method. This mode is ideal for high-speed applications requiring stable communication.

Connections:

  • VCC3.3V (ESP32)
  • GNDGND (ESP32)
  • MISOGPIO19 (ESP32 MISO)
  • MOSIGPIO23 (ESP32 MOSI)
  • SCKGPIO18 (ESP32 SCK)
  • SS (NSS)GPIO5 (ESP32 CS/SS)
  • IRQ (Optional)GPIO4 (ESP32 IRQ)
  • RSTO (Optional)GPIO21 (ESP32 Reset)

Key Features of SPI Mode:

  • Faster communication compared to I²C.
  • More stable data transfer for high-speed NFC applications.
  • Uses dedicated SPI pins for efficient hardware support.


I2C Protocol Wiring with ESP32

In I²C (Inter-Integrated Circuit) mode, the PN532 NFC module communicates with the ESP32 using a two-wire communication method. This mode is simple and requires fewer connections compared to SPI.

Connections:

  • VCC3.3V (ESP32)
  • GNDGND (ESP32)
  • SDAGPIO21 (ESP32 SDA)
  • SCLGPIO22 (ESP32 SCL)
  • IRQ (Optional)GPIO4 (ESP32 IRQ)
  • RSTO (Optional)GPIO5 (ESP32 Reset)

Key Features of I²C Mode:

  • Uses only two data lines (SDA & SCL), making it ideal for minimal wiring.
  • Multiple devices can share the same I²C bus.
  • Simpler setup compared to SPI.


HSU (High-Speed UART) Wiring with ESP32

In HSU (High-Speed UART) mode, the PN532 NFC module communicates with the ESP32 using a serial UART interface. This mode is useful for applications requiring a simple and widely supported communication method.

Connections:

  • VCC3.3V (ESP32)
  • GNDGND (ESP32)
  • SDA (HSU TX)GPIO16 (ESP32 RX)
  • SCL (HSU RX)GPIO17 (ESP32 TX)
  • IRQ (Optional)GPIO4 (ESP32 IRQ)
  • RSTO (Optional)GPIO5 (ESP32 Reset)

Key Features of HSU (UART) Mode:

  • Uses standard UART communication, widely supported by microcontrollers.
  • Simple wiring, requiring only TX, RX, VCC, and GND.
  • High-speed data transfer, suitable for real-time NFC applications.

Troubleshooting Guide

Common Issues

⚡ Module Fails to Power On

🔄 Communication Interface Not Working

📡 Unable to Read Tags

⚠️ Inconsistent Tag Detection

🖥️ Library or Software Issues

Debugging Tips

🔍 Serial Monitor

⚡ Voltage Checks

Code Examples

Arduino Example

C++
🔧

ESP-IDF Example

C++
🏠

ESPHome Example

YAML
🛠️

PlatformIO Example

C++
🐍

MicroPython Example

Python

Conclusion

The ESP32 PN532 NFC Module is a powerful NFC sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.