The ACR122U USB NFC Reader is usually connected to a PC or laptop but, of course, nothing is keeping you from connecting it to a Raspberry Pi instead. It took me some time and effort to get it all up and running but with some experimenting it finally worked out pretty good. For future reference and other Raspberry Pi users Googling for clues on how to install the drivers and packages, I describe the procedure below.
Installing the ACR122U USB NFC tag reader on a Raspberry Pi running Raspbian
The type of NFC reader I am using for this experiment is a ACR122U-A9 by Advanced Card Systems. This reader is connected by USB to a Raspberry Pi model 2B running Raspbian (version May 2015, release date 2015-05-05, Debian Wheezy, kernel 3.18).
First, we need to update the package lists and download and install some required packages:
sudo apt-get update
sudo apt-get -y install subversion autoconf debhelper flex libusb-dev libpcsclite-dev libpcsclite1 libccid pcscd pcsc-tools libpcsc-perl libusb-1.0-0-dev libtool libssl-dev cmake checkinstall
Then we download, extract, configure and install libnfc:
tar -xvzf libnfc-1.7.0-rc7.tar.gz
sudo make install
If all went well, issuing this command will list your ACR122U and any tags present:
But if it shows “nfc-list: error while loading shared libraries: libnfc.so.4: cannot open shared object file: No such file or directory” instead, then try this:
sudo sh -c "echo /usr/local/lib > /etc/ld.so.conf.d/usr-local-lib.conf"
After doing so, you can try again with the command “nfc-list”.
If it says “Unable to claim USB interface” then you need to prevent modprobe from autoloading the pn533 and nfc modules by blacklisting them. To do so, create the file “blacklist-libnfc.conf” by using nano:
sudo nano /etc/modprobe.d/blacklist-libnfc.conf
Add the following two lines to the empty file, save (CTRL+O), and exit (CTRL+X):
Then all you need to do is this:
sudo modprobe -r pn533 nfc
Finally, “nfc-list” should now work without errors.
It will show you some information about the NFC reader and the NFC tag, if one is present.
And now you can use the ACR122U USB NFC Reader on your Raspberry Pi!