NFCPY is a Python library allowing for Near Field Communications readers to be accessed directly from Raspberry Pi. As part of a project I am working on, I needed to install this library on a clean Raspbian install of a Raspberry Pi.
Once the installation was completed I used the base ‘history’ command to retrieve all the commands that I typed in the terminal to accomplish this task. I removed all the commands that were wrong or superfluous.
Please note that this was a brand new install: I used a NOOBs SD card and chose Raspbian. Once the operating system was installed, the following commands were typed in:
$ sudo nano /boot/cmdline.txt
$ sudo nano /etc/inittab
The above two commands need to be modified in order to free up the UART on the Pi (to be totally honest, I’m not sure if this needs to be done for nfcpy.) Follow these directions from Clayton Smith’s website. Initially, I used Adafruit’s website for these instructions, but they were not totally clear.
$ sudo raspi-config
This allows you to personalize your Pi through the Raspbian Configuration utility.
$ sudo reboot –n
A reboot to ensure it all still works.
$ sudo rpi-update
Update the firmware on the Pi
$ sudo apt-get update
$ sudo apt-get upgrade
Install the latest Raspbian operating system updates and upgrades
$ sudo apt-get install xrdp
Install Remote Desktop
$ sudo apt-get install python-dev
$ curl -O http://python-distribute.org/distribute_setup.py
$ sudo python distribute_setup.py
$ curl -O https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py
$ sudo python get-pip.py
$ sudo pip install virtualenv
Install (fairly) standard Python utilities
$ sudo pip install pyserial
Install serial library for Python used by NFCPY.
$ sudo apt-get install bzr
Install Launchpad bazaar, a VCS (Version Control System), which allows you to download NFCPY.
$ mkdir pythonprogs
$ cd pythonprogs
Above 2 commands create and then switch to the directory where my Python programs will be stored on this machine.
$ bzr branch lp:nfcpy
Download the latest version of NFCPY.
$ cd /pythonprogs/nfcpy/examples
Switch to the examples directory of NFCPY.
$ python tagtool.py --device tty:AMA0:pn53x show
Run the Python program tagtool. The ‘device’ switch following tagtool.py specifies that we want to use the serial device.
Then put a card near the reader: partial success. There is output on the screen, but the reader cannot read the card, apparently NFCPY cannot handle MIFARE Classic 1K cards. So I ordered some other ones, hopefully they will work!
UPDATE 2014/01/29 The cards I ordered from OverAir Proximity Technologies do work! They are
NFC Card - White - NTAG203 PAC-N3Card
UPDATE 2014/08/02 I purchased a Raspberry Pi B+ (mainly for the form factor) and found I needed to modify to contents of some of the links above in order to successfully install nfcpy.