Adafruit NFC/RFID on Raspberry Pi. Created by Kevin Townsend



Similar documents
Adafruit NFC/RFID on Raspberry Pi

Matrix and 7-Segment LED Backpack with the Raspberry Pi

Adafruit's Raspberry Pi Lesson 7. Remote Control with VNC

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable. Created by Simon Monk

Adafruit's Raspberry Pi Lesson 1. Preparing an SD Card for your Raspberry Pi

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

Preparing Raspberry Pi

5inch HDMI LCD User Manual

Setting up a Raspberry Pi as a WiFi access point

Introducing the Adafruit Bluefruit LE Sniffer

Adding a Real Time Clock to Raspberry Pi

Setting up IO Python Library on BeagleBone Black

Arduino Lesson 17. Sending Movement Detector

Monitor Your Home With the Raspberry Pi B+

BeagleBone Black: Installing Operating Systems

Bob Rathbone Computer Consultancy

Chapter 1 Hardware and Software Introductions of pcduino

Playing sounds and using buttons with Raspberry Pi

In-System Programmer USER MANUAL RN-ISP-UM RN-WIFLYCR-UM

Adafruit's Raspberry Pi Lesson 6. Using SSH

Install bluez on the Raspberry Pi

Adafruit's Raspberry Pi Lesson 3. Network Setup

Adafruit's Raspberry Pi Lesson 9. Controlling a DC Motor

Drive a 16x2 LCD with the Raspberry Pi

How To Connect A Raspberry Pi To The Internet On A Microsoft Moonstone 2 (Microsoft) Microsoft Powerbook 2 (Powerbook 2) (Powerboard 2) And Powerbook 3 (Powerstation 2)

PN532 NFC RFID Module User Guide

Yun Shield User Manual VERSION: 1.0. Yun Shield User Manual 1 / 22.

Designing VM2 Application Boards

WebIOPi. Installation Walk-through Macros

2. Boot using the Debian Net Install cd and when prompted to continue type "linux26", this will load the 2.6 kernel

Arduino Lesson 0. Getting Started

SSH to BeagleBone Black over USB

Character LCD System Monitor

Raspberry Pi Kernel-o-Matic

Bluefruit LE Python Library

UniPi technical documentation REV 1.1

Arduino Lesson 13. DC Motors. Created by Simon Monk

Raspberry Pi Android Projects. Raspberry Pi Android Projects. Gökhan Kurt. Create exciting projects by connecting Raspberry Pi to your Android phone

Arduino Lesson 14. Servo Motors

Adafruit SHT31-D Temperature & Humidity Sensor Breakout

Arduino Lesson 1. Blink

Introduction. Getting familiar with chipkit Pi

7inch HDMI LCD (B) User Manual

Cassandra Installation over Ubuntu 1. Installing VMware player:

AN10866 LPC1700 secondary USB bootloader

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

CAN-Bus Shield Hookup Guide

PiFace Control & Display

Intro to Intel Galileo - IoT Apps GERARDO CARMONA

A REST API for Arduino & the CC3000 WiFi Chip

TSL2561 Luminosity Sensor

AN Quick Start Up Guide for EXPLORE NFC working with Raspberry Pi. Application note COMPANY PUBLIC. Rev December

IPMI Firmware Update (AMI) In WEB-GUI/DOS/WIN/Linux

2.2" TFT Display. Created by Ladyada. Last updated on :15:09 PM EDT

Wireless Communication With Arduino

Using Network Attached Storage with Linux. by Andy Pepperdine

Creating a DUO MFA Service in AWS

Programming Flash Microcontrollers through the Controller Area Network (CAN) Interface

Board also Supports MicroBridge

USB HSPA Modem. User Manual

Radio Toolbox And Player Embedding

7/Basic Input and Output

Using Microsoft Visual Studio API Reference

Adafruit's Raspberry Pi Lesson 11. DS18B20 Temperature Sensing

Raspberry Pi Setup Tutorial

AN10811 Programming SPI flash on EA3131 boards Rev May 2009 Application note Document information Info Content Keywords Abstract

Raspberry Pi Webserver

Embedded Based Web Server for CMS and Automation System

DESIGN AND IMPLEMENTATION OF A WIRELESS ZIGBEE MESH NETWORK

How to upload - copy PowerChute Network Shutdown installation files to VMware VMA from a PC

Newton2 Developers Guide

Accessing I2C devices with Digi Embedded Linux 5.2 example on Digi Connect ME 9210

Arduino Lesson 5. The Serial Monitor

Chapter 1: Getting Started

Adafruit BME280 Humidity + Barometric Pressure + Temperature Sensor Breakout

NFC EXPRESS User Manual

AR1100 Resistive Touch Screen Controller Guide


Bob Rathbone Computer Consultancy

SETTING UP RASPBERRY PI FOR TOPPY FTP ACCESS. (Draft 5)

Setup Cisco Call Manager on VMware

Sending an SMS with Temboo

Quick Installation Guide

Apache 2.0 Installation Guide

Exercise 1: Set up the Environment

How To Add A Usb Secondary Ipo Bootloader To An Lpc23Xx Flash Device To A Flash Device

Pwn Plug Community Edition 1.1 Installation Guide

XPort Universal Demo Board User Guide

Installing Booked scheduler on CentOS 6.5

ML310 VxWorks QuickStart Tutorial. Note: Screen shots in this acrobat file appear best when Acrobat Magnification is set to 133.3%

ESP8266 WiFi Module Quick Start Guide

Upgrading from Windows XP to Windows 7

Upgrading from Windows XP to Windows 7

USER GUIDE. Ethernet Configuration Guide (Lantronix) P/N: Rev 6

Solr Bridge Search Installation Guide

Using an IR Remote with a Raspberry Pi Media Center

How to Make a Pogo Pin Test Jig. Created by Tyler Cooper

Transcription:

Adafruit NFC/RFID on Raspberry Pi Created by Kevin Townsend

Guide Contents Guide Contents Overview Freeing UART on the Pi Step One: Edit /boot/cmdline.txt Step Two: Edit /etc/inittab Step Three: Reboot your Pi Building libnfc Step One: Download libnfc Step Two: Modify libnfc/buses/uart_posix.c Step Three: Configure libnfc Step Four: Build! Testing it Out Hooking Everything Up Read an ISO14443-A (Mifare, etc.) Card with nfc-poll 2 3 4 4 4 4 6 6 7 7 9 11 11 12 Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 2 of 12

Overview Interested in adding some NFC fun and excitement to your Raspberry Pi? You're in luck! One of the big advantages of Linux is that it includes a large number of stacks that have been developed by the open source community, and you get to take advantage of all that hard work simply by using or installing the right library. NFC is no exception here, with libnfc (http://adafru.it/an2) having been around for a quite some time -- in fact, it's the original reason the NFC Breakout was developed! To get libnfc playing well with your Pi and your Adafruit NFC breakout you'll need to make some minor modification to your vanilla Wheezy distribution, and one small change to the latest NFC code (1.6.0-rc1 as of this writing), but it's pretty painless, and this tutorial will show you everything you need to do to start writing your own NFC-enabled apps on the Pi! Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 3 of 12

Freeing UART on the Pi The easiest way to use libnfc with the Adafruit NFC Breakout is via UART, since it's wellsupported by libnfc out of the box. Unfortunately the UART port on the Pi is already dedicated to other purposes, and needs to be freed up for libnfc. The following steps (based on a clean 2012-07-15-wheezy-raspbian install but should also work with Adafruit's Occidentalis) should free UART up for us: Step One: Edit /boot/cmdline.txt From the command prompt enter the following command: $ sudo nano /boot/cmdline.txt And change: dwc_o tg.lpm_enable=0 co nso le=ttyama0,115200 kgdbo c=ttyama0,115200 console=tty1 $ to: dwc_o tg.lpm_enable=0 co nso le=tty1 $ Step Two: Edit /etc/inittab From the command prompt enter the following command: $ sudo nano /etc/inittab And change: #Spawn a getty on Raspberry Pi serial line T0: 23: respawn:/sbin/getty -L ttyama0 115200 vt100 to: #Spawn a getty on Raspberry Pi serial line #T0: 23: respawn:/sbin/getty -L ttyama0 115200 vt100 Step Three: Reboot your Pi Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 4 of 12

After rebooting the Pi for the above changes to take effect, you can proceed with building and testing libnfc... Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 5 of 12

Building libnfc Step One: Download libnfc Before you can do anything, you will need to get a copy of libnfc. Make sure you have an Ethernet cable connected to your Pi, and run the following commands to get libnfc 1.6.0-rc1 For reasons we don't understand it does not work with libnfc-1.7.0-rc4 - but we have tested it with 1.6.0-rc1 as above! $ cd /home/pi $ mkdir libnfc $ cd libnfc $ wget http://libnfc.googlecode.com/files/libnfc-1.6.0-rc1.tar.gz $ tar -xvzf libnfc-1.6.0-rc1.tar.gz $ cd libnfc-1.6.0-rc1 You should see something similar to the following: Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 6 of 12

Step Two: Modify libnfc/buses/uart_posix.c uart_posix.c needs to be modified to make libnfc test for devices named ttyama*, the name of the default UART device on the Pi. To include ttyama in the serial autoprobe function, enter the following command: $ nano libnfc/buses/uart_posix.c And change: # elif defined ( linux ) char *serial_po rts_device_radix[] = { "ttyusb", "ttys", NULL }; # else to: # elif defined ( linux ) char *serial_po rts_device_radix[] = { "ttyusb", "ttys", "ttyama", NULL }; # else Step Three: Configure libnfc Before libnfc can be built, it needs to be cofigured for the target system and based on some parameters specific the NFC device you have connected. Run the following command to configure libnfc to use UART and the PN532: $./configure --with-drivers=pn532_uart --enable-serial-autoprobe This should give you the following screens, during and after the configuration process: Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 7 of 12

Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 8 of 12

Step Four: Build! To build libnfc, you simply need to enter the following commands: $ sudo make clean $ sudo make install all Which should start the (slowish!) build process as follows: Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 9 of 12

Once the build process is complete, you're ready to go on to testing the library on actual HW... Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 10 of 12

Testing it Out Hooking Everything Up The Adafruit NFC Breakout (http://adafru.it/364) board is much more appropriate with the Pi than the NFC Shield (http://adafru.it/789), 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 (http://adafru.it/914), following the image below: No te: 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. Adafruit Industries http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi Page 11 of 12

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 $./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 (http://adafru.it/an3) which also contains a useful and active forum. Adafruit Industries Last Updated: 2013-03-07 12:34:30 PM EST Page 12 of 12