To use the PN532 NFC RFID reader with the Raspberry Pi you need to do the following things:
Within the raspi-config menu, select Advanced Options and enable SPI, I2C, and Serial.
sudo apt-get update sudo apt-get install libusb-dev libpcsclite-dev
cd ~ wget http://dl.bintray.com/nfc-tools/sources/libnfc-1.7.1.tar.bz2 tar -xf libnfc-1.7.1.tar.bz2
cd libnfc-1.7.1 ./configure --prefix=/usr --sysconfdir=/etc make sudo make install
cd /etc sudo mkdir nfc sudo nano /etc/nfc/libnfc.conf
Copy and paste the following contents to file /etc/nfc/libnfc.conf:
# Allow device auto-detection (default: true) # Note: if this auto-detection is disabled, user has to set manually a device # configuration using file or environment variable allow_autoscan = true # Allow intrusive auto-detection (dehttp://www.jamesrobertson.eu/pages/2014/mar/30/rfid-module.htmlfault: false) # Warning: intrusive auto-detection can seriously disturb other devices # This option is not recommended, user should prefer to add manually his device. allow_intrusive_scan = false # Set log level (default: error) # Valid log levels are (in order of verbosity): 0 (none), 1 (error), 2 (info), 3 (debug) # Note: if you compiled with --enable-debug option, the default log level is "debug" log_level = 1 # Manually set default device (no default) # To set a default device, you must set both name and connstring for your device # Note: if autoscan is enabled, default device will be the first device available in device list. device.name = "Itead_PN532_SPI" device.connstring = "pn532_i2c:/dev/i2c-1"
sudo nfc-list command and you should observe the following:
nfc-list uses libnfc 1.7.1 NFC device: pn532_i2c:/dev/i2c-1 opened
sudo nfc-poll command and observe the following:
nfc-poll uses libnfc 1.7.1 NFC reader: pn532_i2c:/dev/i2c-1 opened NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations) nfc_initiator_poll_target: Success
If you observe errors it may be that there is a loose jumper connection to the GPIO pins. Double-check the jumper connections and if necessary test the RFID reader with the Arduino.