In this recipe we connect the Adafruit PN532 NFC/RFID Shield to a Raspberry Pi and Reactive Blocks via the I2C bus.
Physical Connection
Connect the NFC shield with the following pins of the Raspberry Pi Connector. (Use a breadboard or a soldered connection.)
NFC Shield Raspberry Pi
------------------------------
SCL SCL1 / GPIO 9
SDA SDA1 / GPIO 8
5V 5V
Gnd GND
Digital I/O 2 GPIO 7
For now, you do not need to connect the last one, Digital I/O 2 and GPIO7. This will be to speed up card detection later.
Make sure to shutdown your Pi and remove all power before cabling.
Enable I2C on the Raspberry Pi
You need to enable I2C first. Start the Raspberry Pi Configuration tool, and enable I2C. Restart the Pi.
Check I2C
Install the I2C tools:
sudo apt-get update
sudo apt-get install -y python-smbus i2c-tools
Use the i2c detect tool to check if the NFC chip is reachable.
sudo i2cdetect -y 1
The resulting table should list at least one device, the NFC sensor.
Connect with Reactive Blocks
Import the library Raspbery Pi Adafruit NFC. It contains a building block that detects the UID of each NFC card.
7,702 thoughts on “Adafruit RFID/NFC Shield”