Hooking Everything Up

The Adafruit NFC Breakout board is much more appropriate with the Pi than the NFC Shield, since the breakout doesn't have 5V level shifting (which means you won't accidentally damage your Pi!), and you have easier access to the bus select pins, etc.

If it isn't already hooked up, you can connect your breakout now using a convenient Pi Cobbler, following the image below:
Note: Make sure that the SEL0 and SEL1 jumpers on the NFC breakout are set to OFF, which will cause the PN532 to boot into UART mode (rather than SPI and I2C, which aren't currently supported by libnfc).  You will need to reset the breakout after changing these pins, which you can do by cycling the power pin.

Use the 5V supply on the Pi Cobbler, and the 5V input on the FTDI header rather than the 3.3V supply, since the 3.3V supply is used by the core on the rasberry Pi and you don't want to pull sharp, heavy loads from it, like when you first enable and charge the near field.

Read an ISO14443-A (Mifare, etc.) Card with nfc-poll

With libnfc built and properly configure, you can go back to the command-line, place a card on the reader, and run the following command to get the tags unique ID:
$ cd examples
$ sudo ./nfc-poll
Which should results in the following:
That's it!  From here, you can explore some of the other examples in the 'examples' folder, and figure out how to get started writing your own applications based on libnfc!  Be sure to have a look at the libnfc project page which also contains a useful and active forum.

This guide was first published on Jul 29, 2012. It was last updated on Jul 29, 2012.

This page (Testing it Out) was last updated on Nov 26, 2021.

Text editor powered by tinymce.