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
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" }
);
NDEF Message
One or more NDEF Records
NDEF Record
Contains a payload of data
Information describing the payload
NDEF Library
for Arduino
https://github.com/don/NDEF
I2C
SPI
Setup
Write Tag
Read Tag
Memory
you will run out