Difference between revisions of "PN532 NFC RFID Module"
Line 68: | Line 68: | ||
<br>[[File:PN532-11.jpg]]<br> | <br>[[File:PN532-11.jpg]]<br> | ||
'''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.) | '''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.) | ||
− | <br>[[File:PN532- | + | <br>[[File:PN532-8.png]]<br> |
Revision as of 07:42, 15 November 2016
Contents
Introduction
SunFounder 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. The integrated level shifter provides 3.3V or 5V working voltage for your choice. 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!
Note: When your wiring is correct (no short circuit), the module may be a little heated, which is just normal for use.
The diagram is shown as below:
PN532 Schematic.pdf
Features
Supports I2C, SPI and HSU (High Speed UART), easy to switch between these modes.
Works in the NFC mode and RFID reader/writer mode
The integrated 3.3V voltage regulator provides 3.3V or 5V working voltage for your choice
Maximum distance for communication: 3 cm
Equipped with two 3mm mounting holes, easy to use in your project with its small dimension
Test
Preparations
Arduino Uno/Mega 2560 board (or compatible SunFounder Uno/Mega 2560)
Dupont Jumper Wires
Blank NFC card supporting the ISO14443A
PC with Arduino software installed
PN532 NFC Module
Note:
Pay attention to avoid short circuits between the module’s power and the ground, such as the VCC and the GND
Procedures
The test is implemented on the Uno board in the Arduino IDE V1.6.12.
Install the library
Adafruit has a complete library for this, so we will just use its code to test the module directly.
Step 1: In IDE, select Sketch->Including Library->Manage Libraries, type in PN532 to search. Then we can see Adafruit PN532 searched out, and click INSTALL at the right side to start the installation.
Step 2: Select File->Examples ->Adafruit PN532->ReadMifare to open the ReadMifare.ino
Test under SPI Mode
Step 1: Slide the switch to SPI mode:
SEL0 SEL1
L H
Step 2: Connect the module and the Uno board as shown below:
PN532 Module SunFounder Uno
GND GND
5V 5V
SCK 2
MOSI 3
NSS 4
MISO 5
Step 3: Select the corresponding board and port, and upload the code to the Uno.
Step 4: Click at the upper right corner to open the serial monitor, and select 115200 baud.
Step 5: Thus, you can see the basic information of the card here
Test under I2C 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 I2C mode on the module:
SEL0 SEL1
H L
Step 3: Connect the PN532 and the Uno/Mega2560 as shown below:
PN532 Uno/Mega2560
GND GND
5V 5V
SDA A4/ pin20 Mega2560
SCL A5 /pin21 Mega2560
RSTO 3
IRQ 2
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.)