Difference between revisions of "PN532 RFID Module"

From LinkSprite Playgound
Jump to: navigation, search
(Features)
(Resources)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Introduction  ==
 
== Introduction  ==
 +
The PN532 is the most popular NFC chip, and is what is embedded in pretty much every phone or device that does NFC. It can pretty much do it all, such as read and write to tags and cards, communicate with phones (say for payment processing), and 'act' like a NFC tag. If you want to do any sort of embedded NFC work, this is the chip you'll want to use!
 +
NFC (Near Field Communications) is a way for two devices very close to each other to communicate. Sort of like a very short range bluetooth that doesn't require authentication. It is an extension of RFID, so anything you can do with RFID you can do with NFC. You can do more stuff with NFC as well, such as communicate bi-directionally with cell phones
  
 +
Because it can read and write tags, you can always just use this for RFID-tag projects. We carry a few different tags that work great with this chip. It can also work with any other NFC/RFID Type 1 thru 4 tag (and of course all the other NXP MiFare type tags)
  
 +
The PN532 is also very flexible, you can use 3.3V TTL UART at any baud rate, I2C or SPI to communicate with it. This chip is also strongly supported by libnfc, simply plug in an FTDI cable and use the FTDI serial port device to communicate - this lets you do NFC dev using any Linux/Mac/Windows computer!
  
 +
[Model: RFID_NFC_BB_PN532]
  
 +
[[File:PN532_MODULE.jpg | 400px]]
  
 
== Features  ==
 
== Features  ==
 +
=== Production Features ===
 
*Reader/writer functionality compatible to ISO/IEC 14443 A&B, MIFARE, FeliCa and NFC Forum tag types (MIFARE Ultralight, Topaz, FeliCa, MIFARE DESFire)
 
*Reader/writer functionality compatible to ISO/IEC 14443 A&B, MIFARE, FeliCa and NFC Forum tag types (MIFARE Ultralight, Topaz, FeliCa, MIFARE DESFire)
Full peer-to-peer functionality
+
*Full peer-to-peer functionality
 
*Card emulation functionality compatible to ISO/IEC 14443 A when connected to secure controller (SmartMX P5CN072)
 
*Card emulation functionality compatible to ISO/IEC 14443 A when connected to secure controller (SmartMX P5CN072)
 
*Up to 10cm operating distance
 
*Up to 10cm operating distance
Line 14: Line 21:
 
*Integrated MIFARE cipher crypto1
 
*Integrated MIFARE cipher crypto1
  
== Application Ideas  ==
+
=== Reader/Writer ===
 +
*Easy pairing of Bluetooth-, Wi-Fi- or WUSB-enabled devices
 +
*Read/ write NFC Forum tags such as MIFARE, MIFARE Ultralight, DESFire, Felica and Topaz
  
 +
=== Peer-to-peer ===
 +
*Easy pairing of Bluetooth-, Wi-Fi- or WUSB-enabled devices
 +
*Exchange data (business card, picture, etc.) between two active devices
  
 +
=== Card emulation ===
 +
*The PN532 makes it possible to emulate:
 +
*A MIFARE card to access public transport, stadium, building etc.
 +
*A MIFARE card to store loyalty program or pre-paid wallet
 +
*An EMV payment card such as PayPass and VisaWave
 +
*An active tag and change its content over the air (OTA)
  
 +
== Arduino Sample Code  ==
 +
<syntaxhighlight lang="c">
 +
/*
 +
PN532 reads the tag by Arduino mega
 +
command
 +
wake up reader
 +
send: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 03 fd d4 14 01 17 00
 +
return: 00 00 FF 00 FF 00 00 00 FF 02 FE D5 15 16 00
  
 +
firmware
 +
send: 00 00 FF 02 FE D4 02 2A 00
 +
return: 00 00 FF 00 FF 00 00 00 FF 06 FA D5 03 32 01 06 07 E8 00
  
== Cautions  ==
+
reads the tag
 +
send: 00 00 FF 04 FC D4 4A 01 00 E1 00
 +
return: 00 00 FF 00 FF 00 00 00 FF 0C F4 D5 4B 01 01 00 04 08 04 XX XX XX XX 5A 00
 +
XX is tag.
 +
*/
 +
const unsigned char wake[24]={0x55,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,0xfd,0xd4,0x14,0x01,0x17,0x00};//const
 +
const unsigned char firmware[9]={0x00,0x00,0xFF,0x02,0xFE,0xD4,0x02,0x2A,0x00};//const
 +
const unsigned char tag[11]={0x00,0x00,0xFF,0x04,0xFC,0xD4,0x4A,0x01,0x00,0xE1,0x00};//
 +
 
 +
unsigned char receive_ACK[25];
 +
int inByte = 0;        // incoming serial byte
 +
 
 +
 
 +
void UART1_Send_Byte(unsigned char command_data)
 +
{
 +
  Serial1.print(command_data);
 +
}
 +
 
 +
void UART_Send_Byte(unsigned char command_data)
 +
{
 +
  Serial.print(command_data);
 +
}
 +
 
 +
 
 +
void array_ACK(unsigned char temp)
 +
{
 +
    for(unsigned char i=0;i<temp;i++)                                         
 +
    {
 +
      receive_ACK[i]= Serial1.read();
 +
      delay(100);
 +
    }
 +
}
 +
 
 +
void wake_card(void)
 +
{
 +
    unsigned char i;
 +
    for(i=0;i<24;i++) //send command
 +
  UART1_Send_Byte(wake[i]);
 +
}
  
 +
void firmware_version(void)
 +
{
 +
    unsigned char i;
 +
    for(i=0;i<9;i++) //send command
 +
    UART1_Send_Byte(firmware[i]);
 +
}
  
 +
void read_tag(void)
 +
{
 +
    unsigned char i;
 +
    for(i=0;i<11;i++) //send command
 +
    UART1_Send_Byte(tag[i]);
 +
}
  
 +
void dsplay(unsigned char tem)
 +
{
 +
    unsigned char i;
 +
    for(i=0;i<tem;i++) //send command
 +
    UART_Send_Byte(receive_ACK[i]);
 +
}
  
 +
void setup()
 +
{
 +
  Serial.begin(9600); // open serial锛宻et Baund rate 9600 bps
 +
  Serial1.begin(115200);
 +
 
 +
  wake_card();
 +
  delay(100);
 +
  array_ACK(15);
 +
  delay(100);
 +
  dsplay(15);
 +
 
  
== Schematic  ==
+
}
  
 +
void loop()
 +
{
 +
  if (Serial.available() > 0)
 +
  {
 +
    // get incoming byte:
 +
    inByte = Serial.read();
 +
    if (inByte=='r')
 +
    { 
 +
      read_tag();
 +
      delay(100);
 +
      array_ACK(25);
 +
      delay(100);
 +
      dsplay(25);
 +
    }
 +
    else if (inByte=='v')
 +
    {
 +
      firmware_version();
 +
      delay(100);
 +
      array_ACK(19);
 +
      delay(100);
 +
      dsplay(19);
 +
    }
 +
   
 +
  }
 +
}
  
 +
</syntaxhighlight>
  
 +
== Cautions  ==
  
  
== Specification  ==
 
  
  
  
 +
== Schematic  ==
 +
[https://s3.amazonaws.com/linksprite/RFID/RFID_Module/PN532_Breakout_Schematic_v1.0.pdf Schematic of PN532 Breakout board in PDF]
  
 +
== Specification  ==
  
== Pin definition and Rating  ==
 
  
  
  
  
 +
== Pin definition and Rating  ==
  
== Mechanic Dimensions  ==
 
  
  
  
  
 +
== Mechanic Dimensions  ==
 +
2" (51mm) x 4.7" (117.7mm) and 0.425" (1.1mm) thick
  
 
== Usage  ==
 
== Usage  ==
Line 76: Line 202:
  
 
== Resources  ==
 
== Resources  ==
 
+
*[http://www.microbuilder.eu/Projects/PN532.aspx Microbuilder website]
 
+
*[https://s3.amazonaws.com/linksprite/RFID/RFID_Module/pn532ds.pdf PN532 RFID module data sheet]
 
+
*[https://s3.amazonaws.com/linksprite/RFID/RFID_Module/pn532um.pdf PN532 RFID module user manual]
 
 
  
 
== How to buy  ==
 
== How to buy  ==
 
+
Click here to buy PN532 RFID Module [http://www.linkspritedirect.com/product_info.php?products_id=120 RFID_NFC_BB_PN532] at LinkSpriteDirect [http://www.linkspritedirect.com cart]
 
 
 
 
 
 
  
 
== See Also  ==
 
== See Also  ==

Latest revision as of 10:06, 27 February 2013

Introduction

The PN532 is the most popular NFC chip, and is what is embedded in pretty much every phone or device that does NFC. It can pretty much do it all, such as read and write to tags and cards, communicate with phones (say for payment processing), and 'act' like a NFC tag. If you want to do any sort of embedded NFC work, this is the chip you'll want to use! NFC (Near Field Communications) is a way for two devices very close to each other to communicate. Sort of like a very short range bluetooth that doesn't require authentication. It is an extension of RFID, so anything you can do with RFID you can do with NFC. You can do more stuff with NFC as well, such as communicate bi-directionally with cell phones

Because it can read and write tags, you can always just use this for RFID-tag projects. We carry a few different tags that work great with this chip. It can also work with any other NFC/RFID Type 1 thru 4 tag (and of course all the other NXP MiFare type tags)

The PN532 is also very flexible, you can use 3.3V TTL UART at any baud rate, I2C or SPI to communicate with it. This chip is also strongly supported by libnfc, simply plug in an FTDI cable and use the FTDI serial port device to communicate - this lets you do NFC dev using any Linux/Mac/Windows computer!

[Model: RFID_NFC_BB_PN532]

PN532 MODULE.jpg

Features

Production Features

  • Reader/writer functionality compatible to ISO/IEC 14443 A&B, MIFARE, FeliCa and NFC Forum tag types (MIFARE Ultralight, Topaz, FeliCa, MIFARE DESFire)
  • Full peer-to-peer functionality
  • Card emulation functionality compatible to ISO/IEC 14443 A when connected to secure controller (SmartMX P5CN072)
  • Up to 10cm operating distance
  • Optimized 80C51 core processor with embedded firmware in ROM
  • Multiple interfaces (UART, SPI I2C)
  • Integrated MIFARE cipher crypto1

Reader/Writer

  • Easy pairing of Bluetooth-, Wi-Fi- or WUSB-enabled devices
  • Read/ write NFC Forum tags such as MIFARE, MIFARE Ultralight, DESFire, Felica and Topaz

Peer-to-peer

  • Easy pairing of Bluetooth-, Wi-Fi- or WUSB-enabled devices
  • Exchange data (business card, picture, etc.) between two active devices

Card emulation

  • The PN532 makes it possible to emulate:
  • A MIFARE card to access public transport, stadium, building etc.
  • A MIFARE card to store loyalty program or pre-paid wallet
  • An EMV payment card such as PayPass and VisaWave
  • An active tag and change its content over the air (OTA)

Arduino Sample Code

<syntaxhighlight lang="c"> /* PN532 reads the tag by Arduino mega command wake up reader send: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 03 fd d4 14 01 17 00 return: 00 00 FF 00 FF 00 00 00 FF 02 FE D5 15 16 00

firmware send: 00 00 FF 02 FE D4 02 2A 00 return: 00 00 FF 00 FF 00 00 00 FF 06 FA D5 03 32 01 06 07 E8 00

reads the tag send: 00 00 FF 04 FC D4 4A 01 00 E1 00 return: 00 00 FF 00 FF 00 00 00 FF 0C F4 D5 4B 01 01 00 04 08 04 XX XX XX XX 5A 00 XX is tag.

  • /

const unsigned char wake[24]={0x55,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,0xfd,0xd4,0x14,0x01,0x17,0x00};//const const unsigned char firmware[9]={0x00,0x00,0xFF,0x02,0xFE,0xD4,0x02,0x2A,0x00};//const const unsigned char tag[11]={0x00,0x00,0xFF,0x04,0xFC,0xD4,0x4A,0x01,0x00,0xE1,0x00};//

unsigned char receive_ACK[25]; int inByte = 0; // incoming serial byte


void UART1_Send_Byte(unsigned char command_data) {

 Serial1.print(command_data);

}

void UART_Send_Byte(unsigned char command_data) {

 Serial.print(command_data);

}


void array_ACK(unsigned char temp) {

   for(unsigned char i=0;i<temp;i++)                                           
   {
      receive_ACK[i]= Serial1.read();
      delay(100);
   }

}

void wake_card(void) {

   unsigned char i;
   for(i=0;i<24;i++) //send command
  UART1_Send_Byte(wake[i]);

}

void firmware_version(void) {

   unsigned char i;
   for(i=0;i<9;i++) //send command
   UART1_Send_Byte(firmware[i]);

}

void read_tag(void) {

   unsigned char i;
   for(i=0;i<11;i++) //send command
   UART1_Send_Byte(tag[i]);

}

void dsplay(unsigned char tem) {

   unsigned char i;
   for(i=0;i<tem;i++) //send command
   UART_Send_Byte(receive_ACK[i]);

}

void setup() {

 Serial.begin(9600); // open serial锛宻et Baund rate 9600 bps
 Serial1.begin(115200);
 
 wake_card();
 delay(100);
 array_ACK(15);
 delay(100);
 dsplay(15);
 

}

void loop() {

  if (Serial.available() > 0) 
  {
   // get incoming byte:
   inByte = Serial.read();
   if (inByte=='r')
   {   
     read_tag();
     delay(100);
     array_ACK(25);
     delay(100);
     dsplay(25);
   }
   else if (inByte=='v')
   {
      firmware_version();
      delay(100);
      array_ACK(19);
      delay(100);
      dsplay(19);
   }
   
  }

}

</syntaxhighlight>

Cautions

Schematic

Schematic of PN532 Breakout board in PDF

Specification

Pin definition and Rating

Mechanic Dimensions

2" (51mm) x 4.7" (117.7mm) and 0.425" (1.1mm) thick

Usage

Hardware Installation

Programming

FAQ

Please list your question here:

Support

If you have questions or other better design ideas, you can go to our forum to discuss or creat a ticket for your issue at linksprite support.

Resources

How to buy

Click here to buy PN532 RFID Module RFID_NFC_BB_PN532 at LinkSpriteDirect cart

See Also

Other related products and resources.

Licensing

This documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0 Source code and libraries are licensed under GPL/LGPL, see source code files for details.