User Tools

Site Tools


tutorials:products:rfidnfc:arduino.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:products:rfidnfc:arduino.html [2012/04/18 19:27]
ladyada
tutorials:products:rfidnfc:arduino.html [2016/01/28 18:05] (current)
Line 1: Line 1:
 +====== Moved! ======
  
-==== Which library? ==== +This tutorial ​has moved to [[http://learn.adafruit.com/adafruit-pn532-rfid-nfc|http://learn.adafruit.com/adafruit-pn532-rfid-nfc]]
- +
-We have two libraries (hopefully will be merged into one shortly) for the Adafruit NFC boards. One library is for SPI interfacing and one is for I2C. Both have the same functionality,​ capability and function names they just differ in whether they talk to the PN532 chip with I2C or with SPI. For the breakout, we assume you'll be using the SPI library. For the shield, we assume you'll be using the I2C library. +
- +
-Both libraries have the ability to read MiFare cards, including the hard-coded ID numbers, as well as authenticate and read/write EEPROM chunks +
- +
-==== I2C Library ==== +
- +
- +
-[[http://​www.ladyada.net/​products/​rfidnfc/​download.html|Download the PN532 I2C library from github. ]]  Uncompress the folder and rename the folder **Adafruit_NFCShield_I2C**. Inside the folder you should see the **Adafruit_NFCShield_I2C.cpp** and **Adafruit_NFCShield_I2C.h** files. Install the **Adafruit_NFCShield_I2C** ​ library foler by placing it in your **//​arduinosketchfolder///​libraries** folder. You may have to create the **libraries** subfolder if this is your first library. [[http://​www.ladyada.net/​library/​arduino/​libraries.html|You can read more about installing libraries in our tutorial]] +
- +
- +
-Restart the Arduino IDE. You should now be able to select **File > Examples > Adafruit_NFCShield_I2C > readMifare** sketch. Upload the sketch to your Arduino with the shield plugged in. +
- +
-==== SPI Library ​ ==== +
- +
- +
- +
-[[http://www.ladyada.net/products/​rfidnfc/​download.html|Download the PN532 SPI library from github. ]]  Uncompress the folder and rename the folder **Adafruit_PN532**. Inside the folder you should see the **Adafruit_PN532.cpp** and **Adafruit_PN532.h** files. Install the **Adafruit_PN532** ​ library foler by placing it in your **//​arduinosketchfolder///​libraries** folder. You may have to create the **libraries** subfolder if this is your first library. [[http://www.ladyada.net/library/​arduino/​libraries.html|You can read more about installing libraries in our tutorial]] +
- +
- +
- +
-Restart the Arduino IDE. You should now be able to select **File > Examples > Adafruit_PN532 > readMifare** sketch. Upload the sketch to your Arduino wired as in our tutorial +
- +
-==== Testing MiFare ==== +
- +
- +
-In the serial monitor, you should see that it found the **PN532** chip. Then you can place your tag nearby and it will display the 4 byte ID code (this one is 0xAE 0x4C 0xF0 0x6C) and then the integer version of all four bytes together. You can use this number to identify each card. Recently NXP made so many cards that they actually ran through all 4 Bytes (2^32) so the number is not guaranteed to be absolutely unique. However, the chances are extremely slim you will have two cards with the same ID so as long as you aren't using these cards for anything terribly important (like money transfer) its fine to use the number as a unique identifier +
- +
-{{  http://​www.ladyada.net/​images/​rfidnfc/​pn532test.gif?​nolink&​500x248 ​ |}} +
/home/ladyada/public_html/wiki/data/attic/tutorials/products/rfidnfc/arduino.html.1334777222.txt.gz · Last modified: 2016/01/28 18:05 (external edit)