Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use NFC/RFID reader PN532: Examples, Pinouts, and Specs

Image of NFC/RFID reader PN532Design with NFC/RFID reader PN532 in Cirkit Designer

Introduction

The NFC/RFID Reader PN532 is a versatile and user-friendly module capable of reading Near Field Communication (NFC) tags and Radio-Frequency Identification (RFID) cards. Manufactured by Arduino, this module is based on the PN532 v.3 chip and is widely used in applications such as access control, contactless payment systems, and data exchange between devices. Its popularity stems from its ease of use, reliability, and compatibility with a wide range of microcontrollers, including the Arduino UNO.

Explore Projects Built with NFC/RFID reader PN532

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Biometric Access Control System with RFID and Touch Activation: A project utilizing NFC/RFID reader PN532 in a practical application
Biometric Access Control System with RFID and Touch Activation

This circuit is designed for security and identification purposes, featuring an RFID-RC522 module for contactless communication and a fingerprint scanner for biometric authentication. It includes an LCD display for user interaction, a touch sensor for input, a buzzer for audio feedback, and a relay module for controlling external devices. The components are interfaced with a NANO Expansion board, which likely contains a microcontroller to coordinate the operations of the system.

Open Project in Cirkit Designer
Image of Biometric and RFID Security System with Dual Adafruit Feather nRF52840 Controllers: A project utilizing NFC/RFID reader PN532 in a practical application
Biometric and RFID Security System with Dual Adafruit Feather nRF52840 Controllers

This circuit features two Adafruit Feather nRF52840 microcontrollers, each interfaced with an RFID-RC522 module for RFID communication and an AT24C256 external EEPROM for additional memory storage. One of the microcontrollers is also connected to an R307 Fingerprint Sensor for biometric input, and both microcontrollers are powered by a shared power supply and a coin cell breakout for backup or RTC power. The circuit is likely designed for secure access control or identification purposes, utilizing both RFID and fingerprint authentication, with data storage capabilities.

Open Project in Cirkit Designer

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Name Description
1 VCC Power supply (3.3V to 5.5V)
2 GND Ground
3 SDA Serial Data (I2C interface)
4 SCL Serial Clock (I2C interface)
5 MISO Master In Slave Out (SPI interface)
6 MOSI Master Out Slave In (SPI interface)
7 SCK Serial Clock (SPI interface)
8 SS Slave Select (SPI interface)
9 RXD Receive Data (HSU interface)
10 TXD Transmit Data (HSU interface)
11 IRQ Interrupt Request (optional use)
12 RSTO Reset Output (optional use)

Usage Instructions

Integrating with a Circuit

To use the PN532 module with an Arduino UNO, connect the module's power pins (VCC and GND) to the Arduino's 5V and GND pins, respectively. For communication, you can choose between I2C, SPI, or HSU interfaces. I2C is recommended for simplicity and ease of use.

I2C Connection Example

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues

Solutions and Tips

Example Arduino Code for I2C

#include <Wire.h>
#include <Adafruit_PN532.h>

// If using the I2C interface, define the pins for SDA and SCL
#define SDA_PIN A4
#define SCL_PIN A5

Adafruit_PN532 nfc(SDA_PIN, SCL_PIN);

void setup(void) {
  Serial.begin(115200);
  Serial.println("Hello! Scan a NFC/RFID tag to see the UID!");

  nfc.begin();
  uint32_t versiondata = nfc.getFirmwareVersion();
  if (!versiondata) {
    Serial.print("Didn't find PN53x board");
    while (1); // halt
  }
  // Configure board to read RFID tags
  nfc.SAMConfig();
}

void loop(void) {
  uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID
  uint8_t uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type)

  // Wait for an ISO14443A type cards (Mifare, etc.). When one is found
  // 'uid' will be populated with the UID, and uidLength will indicate
  // if it's a 4-byte or 7-byte UID
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

  if (success) {
    Serial.println("Found a card!");
    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("");
    // Wait 1 second before continuing
    delay(1000);
  }
}

Remember to include the Adafruit PN532 library in your Arduino IDE before uploading the code to your Arduino UNO. This example demonstrates how to initialize the module, read a card's UID, and print it to the serial monitor.