e0-245: aspdipanjan/e0_245/e0245-asp-lecture18.pdf · •2004: nfc forum •2006: nfc tag...

27
E0-245: ASP Lecture 18: NFC Dipanjan Gope

Upload: others

Post on 10-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

E0-245: ASP

Lecture 18: NFC

Dipanjan Gope

Page 2: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

2

Dipanjan Gope

• Location Sensors - Theory of location sensing

- Package android.location

• Physical Sensors - Sensor Manager

- Accelerometer

- Gyroscope

- Magnetometer

- Sensor fusion

• NFC

• Multimedia - Camera

- Microphone

Module 2: Android Sensor Applications

Page 3: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

3

Dipanjan Gope

• Greg Milette, Adam Stroud: Professional Android Sensor Programing, 2012, Wiley India

• Google I/O 2011: How to NFC

References

Page 4: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

4

Dipanjan Gope

Popular Apps with NFC

PAYMENT APPS

PAIRING USING NFC SHARING APPS

Page 5: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

5

Dipanjan Gope

• NFC is a special form of RFID

RFID vs NFC

Tag Chip + Tag Antenna Reader + Reader Antenna

RFI

D

NFC

Reader (+ “tag”) Communicating at ~<4cm

Page 6: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

6

Dipanjan Gope

• Range - NFC: 10cm

- RFID: upto 100m

• Frequency - NFC: 13.56MHz

- RFID: LF(125-134kHz – r~10cm); HF(13.56MHz – r~30cm);

UHF(856-960MHz- r~100m)

• Power - NFC: Device – active; Stickers – passive

- RFID: Active or passive

RFID vs NFC

Page 7: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

7

Dipanjan Gope

• 1983: RFID patent

• 2004: NFC Forum

• 2006: NFC tag specifications

• 2006: Nokia 6131 with NFC support

• 2010: Samsung Nexus S Android mobile NFC

History of NFC

5 billion devices even before 2011 - Transit - Credit cards - Passports - Physical access

Page 8: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

8

Dipanjan Gope

RFID UHF Antenna

Reader Antenna: - Linear polarization (dipole antenna) - Circular polarization (helix, cross-dipole, patch) - Monostatic circular / Bistatic circular

http://skyrfid.com/index.php?pr=RFID_Circular_Antenna_Types

Page 9: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

9

Dipanjan Gope

• 13.56MHz – 22m wavelength

• Not an antenna – but an inductor

NFC Antenna

NFC tag

Page 10: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

10

Dipanjan Gope

• Reader/writer mode - smart posters

- v-cards

• Peer-to-peer - exchange data

- exchange money

- bluetooth/wifi connection setup

• Card emulation mode - payments

- ticketing

- access

- identity

- loyalty

NFC modes

Page 11: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

11

Dipanjan Gope

NFC (peer-to-peer) vs Bluetooth

NFC Bluetooth

Connection Setup Low Friction (No discovery or pairing – 0 click)

High Friction (12 sec discovery + UI for pairing)

Range Low (1-4cm)

High (10s of meters)

Data Rate Low (106-414kbps)

High (>3Mbps)

Page 12: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

12

Dipanjan Gope

NFC (reader-tag) vs QR code

NFC Tags QR code

User Experience High (0-click)

Low (align and click)

Cost $0.3 $0

Size 10-30mm 20mmx20mm

Security Can be encrypted Open

Page 13: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

13

Dipanjan Gope

• NDEF: NFC Data Exchange Format

• NDEF message vs. NDEF record

NFC Data Format

Ref: [2]

Payload length: octet or 8 bits Payload type: URI/MIME/Smart poster/Signature - Type Name Format – byte array - e.g. NdefRecord.TNF_ABSOLUTE_URI or TNF_WELL_KNOWN (text) Payload Identifier – byte array

Page 14: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

14

Dipanjan Gope

• Type 1: Topaz

• Type 2: MIFARE Ultralight

• Type 3: Sony Felica

• Type 4: MIFARE Desfire

• Android: peer to peer

NFC Tags

Page 15: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

15

Dipanjan Gope

NFC tags

Ref: [1]

Page 16: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

16

Dipanjan Gope

• Proximity

• Screen off turns NFC off

• Apps must be in foreground to access NFC

• No default link level encryption

Security and Privacy

Page 17: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

17

Dipanjan Gope

Lets Code…

Page 18: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

18

Dipanjan Gope

Package: Android.hardware

SensorManager

Sensor SensorEventListener

SensorEvent

Produces Consumed

Specifies

Event Values

Page 19: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

19

Dipanjan Gope

Package: Android.nfc Classes

NfcManager

Nfcadapter NdefMessage NdefRecord

Redundant

Page 20: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

20

Dipanjan Gope

Manifest File

Page 21: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

21

Dipanjan Gope

• Part 1: Dispatch

- NDEF data is dispatched to only 1 activity

- Type of first NDEF record is used for dispatch

Reading NDEF

Ref: [2]

Page 22: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

22

Dipanjan Gope

• Part 2: Dispatch Types

Reading NDEF

Ref: [2]

Page 23: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

23

Dipanjan Gope

• Part 3:Receiving

Reading NDEF

Ref: [2]

Page 24: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

24

Dipanjan Gope

Writing NDEF Tags

Ref: [2]

Page 25: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

25

Dipanjan Gope

Writing NDEF P2P

Ref: [2]

Page 26: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

26

Dipanjan Gope

Summary

TAG P2P

READ

WRITE

Page 27: E0-245: ASPdipanjan/E0_245/E0245-ASP-Lecture18.pdf · •2004: NFC Forum •2006: NFC tag specifications •2006: Nokia 6131 with NFC support •2010: Samsung Nexus S Android mobile

27

Dipanjan Gope

Google StickyNote Application

Ref: [2]