Introdution


PN532 NFC RFID Module is a highly integrated transmission module for Near Field Communication at 13.56MHz. With the mode switch on board, you can change easily between I2C, SPI, and UART modes. In addition, it supports RFID reading and writing, and NFC function with Android phone, which makes it quite convenient for wireless connection. This module is equipped with two 3mm mounting holes, of which the small dimension makes it easy for using in your project!

Features



Hardware Preparation

1 *  Arduino UNO/Mega 2560 board
1 * PN532 NFC Module
1 * Blank NFC card supporting the ISO14443A
1 * PC with Arduino software installed
Several jumper wires


Schematic Diagram

datasheet


Install_the_library

Adafruit has a complete library for PN532 NFC module, so we will just use its code to test the module directly.

step 1: open Arduino IDE,select Sketch->Including Library->Manage Libraries, type in PN532 to search. than you will see Adafruit PN532 searched out, and click INSTALL at the right side to start the installation.

step 2: slect File->Examples->Adafruit PN532->readMifare to open it.


Test SPI Mode

step 1: Slide the switch to SPI mode.As the picture shows

Step 2: Connect the module and the Uno board as shown below

PN532 Module Arduino Uno/Mega 2560
VCC 5V
GND GND
SCK D2
MISO D5
MOSI D3
SS D4

step 3: Select Tools->Board->Boards Manager…to the corresponding board

Select Tools->Port->Serial ports to port

Upload the code to the Uno/Mega 2560.

step 4: Click at the upper right corner to open the serial monitor, and select 115200 baud.

step 5: You can see the basic information of the card here.

White card

 


Test IIC Mode

Step 1: Since the SPI mode is set as default, we need to make some changes to the code before testing under I2C mode. Use “//” to comment out the line56, and activate Line 65 by removing the double slashes (comment mark) as shown below:

Step 2: Slide the switch to IIC mode on the module

Step 3: Connect the PN532 and the Uno/Mega2560 as shown below

PN532 Module Uno/Mega2560
VCC 5V
GND GND
SDA A4/ pin20 Mega2560
SCL A5 /pin21 Mega2560
RSTO D3
IRQ D2

Step 4: Upload the program to the board, and open the Serial Monitor. Change the baud rate to 115200, then put the blank NFC card on the PN532 NFC Module, and then you can see the data of the card as shown below: (the UID Value varies from different UID settings.)

White card