Arduino NFC

Maker Faire NY

September 22, 2013

Presented by Don Coleman / @doncoleman

What is NFC?

What can I do with NFC?

  • Mobile Payments
  • Sharing Data between Phones
  • Contact Info on Conference Badge
  • Pair with Bluetooth Device
  • Mass Transit Card
  • Smart Poster
  • Hack Stuff

Devices

Tags

Tags hold a tiny amount of data

Think bytes

not kilobytes, megabytes, or gigabytes

Tag Types

Common properties

  • UID
  • Type
  • Technology
  • Capacity
  • Is Locked
  • Is Lockable

Each tag type

  • Stores data in different binary format
  • Has different security features
  • Has different ways to read and write

NDEF

NFC Data Exchange Format

NDEF Message

NDEF Record

NDEF Record

  • TNF (Type Name Format)
  • Type
  • Payload
  • Record Id

TNF - Type Name Format

Indicates the structure of the value of the type field

TNF Constants

  • Empty
  • Well Known
  • Mime Media
  • External

Type

Identifier describing the type of the Payload

Must follow rules implied by TNF

Payload

Data for the user application

Empty Record

  • TNF = Empty

Text Record

hello, world

  • TNF = Well Known
  • Type = T
  • Payload = 2 + en + hello, world

URI Record

http://arduino.cc

  • TNF = Well Known
  • Type = U
  • Payload = 0x3 + arduino.cc

Mime Media Record

{ "message": "hello, world" }

  • TNF = Mime Media
  • Type = application/json
  • Payload = { "message": "hello, world" }

Helper Methods

  • message.addEmptyRecord();
  • message.addTextRecord("hello, world");
  • message.addUriRecord("http://arduino.cc");
  • message.addMimeMediaRecord(
       "text/json", { "message": "hello, world" }
    );

Quick Review...

NDEF Message

One or more NDEF Records

NDEF Record

Contains a payload of data

Information describing the payload

Adafruit NFC Shield

http://www.adafruit.com/products/789

Seeed Studio NFC Shield

http://www.seeedstudio.com/depot/nfc-shield-v20-p-1370.html

PN532 Library

https://github.com/Seeed-Studio/PN532 Based on Adafruit's Library and modified by Yihui Xiong to support both I2C and SPI

NDEF Library

for Arduino

https://github.com/don/NDEF

I2C

SPI

Setup

Write Tag

Read Tag

DEMO

https://gist.github.com/don/6665981

Memory

you will run out

Peer to Peer

Logical Link Control Protocol (LLCP)

Simple NDEF Exchange Protocol (SNEP)

https://github.com/Seeed-Shield/NFC_Shield_DEV

Android Apps for NFC

Read Tags PhoneGap NFC Reader

Format and Unformat Mifare Classic Tags NXP Tag Writer

View Raw Data on Tag NFC Tag Info

Technical Specs

http://www.nfc-forum.org/specs/spec_license

Thank You

Don Coleman

@doncoleman

don@chariotsolutions.com

http://don.github.io/slides/

 

 

Creative Commons License
Arduino NFC by Don Coleman is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at https://github.com/don/slides/tree/gh-pages/2013-09-22-arduino-nfc.