making transit card keychains - programming basics · rfid uses no batteries – devices can be...

116
1 Making Transit Card Making Transit Card Keychains: Keychains: RFID and NFC Technology RFID and NFC Technology

Upload: others

Post on 02-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

1

Making Transit Card Making Transit Card Keychains: Keychains:

RFID and NFC TechnologyRFID and NFC Technology

Page 2: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

2

Transit Card Keychains

● Today, we're going to talk about RFID and NFC– Radio-frequency identification– Near field communication

Page 3: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

3

How you seen these before?

● Tap to pay

Page 4: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

4

How many of you have used this?

● Transit card

Page 5: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

5

How do you open this door?

● Door opened by security fob

Page 6: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

6

What do these do?

● Theft tags

Page 7: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

7

Other Examples

● Library cards● Passports

● Tags!

Page 8: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

8

Goals of Session

● Make NFC stuff

Page 9: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

9

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 10: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

10

● How does NFC work?– If I asked you to build a card

● for opening doors ● or paying for things,

– how would you do it?

Page 11: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

11

● Has a chip for your data and encryption● RFID uses no batteries

– Devices can be cheap, small, long-lasting– Wireless power

● Only support nearby communication– Data transmission hard to do at a distance– Hard to snoop data and track people

Page 12: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

12

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 13: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

13

● Underlying physics magic used for wireless power and communication:– Magnetic Induction

Page 14: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

14

Electromagnets

● When electricity flows through a wire, it makes a weak magnetic field around it

Page 15: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

15

● Can increase strength of magnetic field– Use more electricity– Use more than one wire (so fields overlap)

● Use a coil

Page 16: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

16

● Can increase strength of magnetic field– Use more electricity– Use more than one wire (so fields overlap)

● Use a coil

Page 17: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

17

● Electromagnetic field demonstration– Magnets can pick up metal– Coil of wire around a nail

● Not magnetic

– Attach coil to a battery● It can pick up metal● (Danger: wires and battery can overheat!)

– Basis for electric motors● Vacuum, cars, washing machine, etc.

https://youtu.be/bDA-39izAwAhttps://youtu.be/vxmyC9KOdxQ

Page 18: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

18

Magnetic induction

● It works the opposite way too– Magnetic fields can create electricity– But it has to be a moving magnetic field

N

S

Page 19: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

19

Magnetic induction

● Magnetic induction demonstration– Hook up coil to a voltmeter– Move a strong magnet near it– See electricity flowing

– Magnets and wires don't have to touch but should be close– More coils and faster movement = more voltage

https://youtu.be/yZJLJDEnDUA

N

S

Page 20: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

20

Magnetic induction

● Magnetic induction demonstration– Basis for electric generators

● Most electricity generated this way– Except batteries and solar

Page 21: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

21

Wireless Power

● Can create a magnet using electricity● Moving magnets can create electricity

N

S

N

S

=

Page 22: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

22

Wireless Power

● Can transfer power wirelessly– One coil to create a magnetic field– Another coil to get electricity from magnetic field– The two coils need to be near but not touching

Page 23: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

23

Wireless Power

● Problem: magnetic field must be moving– It's possible to spin the coil

Page 24: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

24

Wireless Power

● Problem: magnetic field must be moving– It's possible to spin the coil– Easier to constantly reverse the flow of electricity

● Can do this millions of times per second● Much faster than spinning

N

S

Page 25: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

25

Wireless Power

● Problem: magnetic field must be moving– It's possible to spin the coil– Easier to constantly reverse the flow of electricity

● Can do this millions of times per second● Much faster than spinning

N

S

Page 26: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

26

Wireless Power

● Problem: magnetic field must be moving– It's possible to spin the coil– Easier to constantly reverse the flow of electricity

● Can do this millions of times per second● Much faster than spinning

Page 27: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

27

Wireless Power

● Wireless power demonstration– One coil put inside the other

● Near each other● Electricity not flowing directly between coils

– When one coil is connected to battery● Voltage detected in other coil

https://youtu.be/8PYmoTfDy8g

Page 28: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

28

Wireless Power

● Wireless power demonstration– Voltage detected when connection is changed

● Nothing happens when current is entirely on or off

https://youtu.be/8PYmoTfDy8g

Page 29: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

29

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 30: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

30

What's Inside NFC?

● Magnetic induction in NFC● Coil on device (e.g. transit card)● Coil on reader● Flip electricity direction repeatedly, flip

magnetic poles, induce electricity in device coil

Page 31: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

31

● Transmit using magnetic induction– Magnetic polarity (and electricity direction flow)

keeps flipping● Add some jitter to when the flips occur

N

S

N

S

N

S

N

S

N

S

Page 32: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

32

● Transmit using magnetic induction– Magnetic polarity (and electricity direction flow)

keeps flipping● Add some jitter to when the flips occur

Page 33: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

33

● Receive using magnetic induction– As the receiving device uses more power

● Sender uses more energy to power the magnetic field

– Receiving device can adjust its power usage● Sender can detect this● Use this as a signal

20

mA

30

50

10 5 1 0.1

0.01

Page 34: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

34

How Does It Work?

● Where is the magnetic coil?

● What happens if you walk around the gates instead of between them?

Page 35: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

35

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 36: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

36

● Now that we know how NFC works, can we do anything with it?

● We can customize and personalize our NFC devices to fit our own needs

Page 37: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

37

● PRESTO transit card● Many NFC devices are in the shape of cards● Sort of ugly and blah

Page 38: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

38

● PRESTO card made of plastic– Can melt it with nail polish remover

Page 39: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

39

● Front and back covers will soften– Can peel them off

Page 40: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

40

● Chip and coil around the edge of card– Can peel the two layers around it

Page 41: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

41

● Inside the PRESTO card

Page 42: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

42

● Want a different shape? – Reshape the induction coil

● Still has to be multiple loops● Can be a ring, bracelet, amulet● Weirder shapes are possible too

Page 43: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

43

● Cut out shape

Page 44: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

44

● Make it 3d

Page 45: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

45

● PRESTO snail in use

Page 46: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

46

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 47: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

47

● Making your own NFC stuff● Transit cards

– Expensive, time-consuming

● Instead we'll use generic NFC stickers– Can order rolls of “NFC stickers” from Ebay– Hold it up to the light to see the coil and chip

Page 48: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

48

Unleash Your Creativity

● We've got– Felt, foam sheets, construction paper– Scissors, hole punch– Markers, crayons– Glue, glue– Extra-large stickers– Clasps, carabiners, safety pins

Page 49: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

49

● Keychains– Punch a hole– Attach sticker to flat bottom part– Add keys

Page 50: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

50

● Pendant– Add two holes for string– Attach sticker to back of it

Page 51: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

51

● Stickers– For binders, lockers, pencil cases– Put NFC sticker on back of sticker

Page 52: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

52

● Out of ideas?– Cut out one of the shapes from the template

● Template also shows how to program your NFC tag

● Don't cut or put holes in NFC stickers● Leave NFC sticker on outside

– Easier to transfer power to it

Page 53: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

53

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 54: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

54

Extra: Programming your NFC tag

● NFC chip is programmable● Most NFC chips let you store some data there

– On the order of 100-1000 bytes of data

● On Android phones, you can use app NXP TagInfo to read tags, NXP Tag Writer to write tags

Page 55: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

55

● NDEF– Standardized data that you can write to tags– When Android phones read those tags, you can

trigger some simple actions● Show some text● Make a phone call● Open a web page

– Demo of tag writing

Page 56: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

56

● Make a tag that goes to your home page– Show your resume?– Shows your social networks?

● Make a tag that has your contact information● Record your medical information there

● Other things?

Page 57: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

57

Extra: Security

● Some types of attacks against NFC cards– Can you track someone remotely?– Can you read the data on their cards?

● Is that a problem?

– Can you copy someone's card?● Can you create a fake card and pretend it has more

money on it?

– Can you eavesdrop on communication?

Page 58: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

58

Extra: TDMA, FDMA

● Wallet full of NFC tags—what happens?● Don't want to “jam” the communication signal

with all the tags talking at the same time● NFC uses TDMA and FDMA

– Discuss the theory

Page 59: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

1

Making Transit Card Making Transit Card Keychains: Keychains:

RFID and NFC TechnologyRFID and NFC Technology

Page 60: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

2

Transit Card Keychains

● Today, we're going to talk about RFID and NFC– Radio-frequency identification– Near field communication

● RFID is the general technology● NFC is a standard for a specific

type of RFID

Page 61: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

3

How you seen these before?

● Tap to pay

● Ice breaker: ask them to put hands up if they've seen one of these before

Page 62: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

4

How many of you have used this?

● Transit card

Page 63: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

5

How do you open this door?

● Door opened by security fob

Page 64: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

6

What do these do?

● Theft tags

Page 65: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

7

Other Examples

● Library cards● Passports

● Tags!

● Get kids to try tapping their Android phones on a tag to get a special message

Page 66: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

8

Goals of Session

● Make NFC stuff

● Same technology as transit cards etc● Due to cost, won't actually make a

transit card keychain● Will show you the steps needed to do it

though

Page 67: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

9

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 68: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

10

● How does NFC work?– If I asked you to build a card

● for opening doors ● or paying for things,

– how would you do it?

● Factors to consider● Power (e.g. solar, batteries, wireless)● Size (batteries are heavy, big, brittle,

expensive)● Cost● How to transmit data (lights? Radio?)● How to store data● Security

Page 69: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

11

● Has a chip for your data and encryption● RFID uses no batteries

– Devices can be cheap, small, long-lasting– Wireless power

● Only support nearby communication– Data transmission hard to do at a distance– Hard to snoop data and track people

Page 70: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

12

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 71: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

13

● Underlying physics magic used for wireless power and communication:– Magnetic Induction

Page 72: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

14

Electromagnets

● When electricity flows through a wire, it makes a weak magnetic field around it

Page 73: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

15

● Can increase strength of magnetic field– Use more electricity– Use more than one wire (so fields overlap)

● Use a coil

Page 74: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

16

● Can increase strength of magnetic field– Use more electricity– Use more than one wire (so fields overlap)

● Use a coil

Page 75: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

17

● Electromagnetic field demonstration– Magnets can pick up metal– Coil of wire around a nail

● Not magnetic

– Attach coil to a battery● It can pick up metal● (Danger: wires and battery can overheat!)

– Basis for electric motors● Vacuum, cars, washing machine, etc.

https://youtu.be/bDA-39izAwAhttps://youtu.be/vxmyC9KOdxQ

Page 76: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

18

Magnetic induction

● It works the opposite way too– Magnetic fields can create electricity– But it has to be a moving magnetic field

N

S

Page 77: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

19

Magnetic induction

● Magnetic induction demonstration– Hook up coil to a voltmeter– Move a strong magnet near it– See electricity flowing

– Magnets and wires don't have to touch but should be close– More coils and faster movement = more voltage

https://youtu.be/yZJLJDEnDUA

N

S

Page 78: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

20

Magnetic induction

● Magnetic induction demonstration– Basis for electric generators

● Most electricity generated this way– Except batteries and solar

Page 79: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

21

Wireless Power

● Can create a magnet using electricity● Moving magnets can create electricity

N

S

N

S

=

Page 80: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

22

Wireless Power

● Can transfer power wirelessly– One coil to create a magnetic field– Another coil to get electricity from magnetic field– The two coils need to be near but not touching

Page 81: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

23

Wireless Power

● Problem: magnetic field must be moving– It's possible to spin the coil

Page 82: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

24

Wireless Power

● Problem: magnetic field must be moving– It's possible to spin the coil– Easier to constantly reverse the flow of electricity

● Can do this millions of times per second● Much faster than spinning

N

S

Page 83: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

25

Wireless Power

● Problem: magnetic field must be moving– It's possible to spin the coil– Easier to constantly reverse the flow of electricity

● Can do this millions of times per second● Much faster than spinning

N

S

Page 84: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

26

Wireless Power

● Problem: magnetic field must be moving– It's possible to spin the coil– Easier to constantly reverse the flow of electricity

● Can do this millions of times per second● Much faster than spinning

Page 85: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

27

Wireless Power

● Wireless power demonstration– One coil put inside the other

● Near each other● Electricity not flowing directly between coils

– When one coil is connected to battery● Voltage detected in other coil

https://youtu.be/8PYmoTfDy8g

Page 86: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

28

Wireless Power

● Wireless power demonstration– Voltage detected when connection is changed

● Nothing happens when current is entirely on or off

https://youtu.be/8PYmoTfDy8g

Page 87: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

29

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 88: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

30

What's Inside NFC?

● Magnetic induction in NFC● Coil on device (e.g. transit card)● Coil on reader● Flip electricity direction repeatedly, flip

magnetic poles, induce electricity in device coil

● Show the inside of an NFC device

Page 89: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

31

● Transmit using magnetic induction– Magnetic polarity (and electricity direction flow)

keeps flipping● Add some jitter to when the flips occur

N

S

N

S

N

S

N

S

N

S

Page 90: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

32

● Transmit using magnetic induction– Magnetic polarity (and electricity direction flow)

keeps flipping● Add some jitter to when the flips occur

Page 91: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

33

● Receive using magnetic induction– As the receiving device uses more power

● Sender uses more energy to power the magnetic field

– Receiving device can adjust its power usage● Sender can detect this● Use this as a signal

20

mA

30

50

10 5 1 0.1

0.01

Page 92: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

34

How Does It Work?

● Where is the magnetic coil?

● What happens if you walk around the gates instead of between them?

Page 93: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

35

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 94: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

36

● Now that we know how NFC works, can we do anything with it?

● We can customize and personalize our NFC devices to fit our own needs

Page 95: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

37

● PRESTO transit card● Many NFC devices are in the shape of cards● Sort of ugly and blah

Page 96: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

38

● PRESTO card made of plastic– Can melt it with nail polish remover

● Nail polish remover can dissolve lots of stuff● It might melt through plastic containers● We use a metal tray to hold everything

● Pour nail polish remover until it covers the card

● Let it sit for a few hours as it dissolves the plastic and softens it

Page 97: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

39

● Front and back covers will soften– Can peel them off

Page 98: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

40

● Chip and coil around the edge of card– Can peel the two layers around it

Page 99: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

41

● Inside the PRESTO card

Page 100: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

42

● Want a different shape? – Reshape the induction coil

● Still has to be multiple loops● Can be a ring, bracelet, amulet● Weirder shapes are possible too

Use a big sticker to hold coil in place

Page 101: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

43

● Cut out shape

Page 102: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

44

● Make it 3d

Page 103: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

45

● PRESTO snail in use

Page 104: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

46

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 105: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

47

● Making your own NFC stuff● Transit cards

– Expensive, time-consuming

● Instead we'll use generic NFC stickers– Can order rolls of “NFC stickers” from Ebay– Hold it up to the light to see the coil and chip

Page 106: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

48

Unleash Your Creativity

● We've got– Felt, foam sheets, construction paper– Scissors, hole punch– Markers, crayons– Glue, glue– Extra-large stickers– Clasps, carabiners, safety pins

Page 107: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

49

● Keychains– Punch a hole– Attach sticker to flat bottom part– Add keys

Page 108: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

50

● Pendant– Add two holes for string– Attach sticker to back of it

Page 109: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

51

● Stickers– For binders, lockers, pencil cases– Put NFC sticker on back of sticker

Page 110: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

52

● Out of ideas?– Cut out one of the shapes from the template

● Template also shows how to program your NFC tag

● Don't cut or put holes in NFC stickers● Leave NFC sticker on outside

– Easier to transfer power to it

Page 111: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

53

NFC

Science

Engineering

A Look Inside a Transit Card

Making an NFC Keychain

More Things to Do with NFC

Page 112: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

54

Extra: Programming your NFC tag

● NFC chip is programmable● Most NFC chips let you store some data there

– On the order of 100-1000 bytes of data

● On Android phones, you can use app NXP TagInfo to read tags, NXP Tag Writer to write tags

Page 113: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

55

● NDEF– Standardized data that you can write to tags– When Android phones read those tags, you can

trigger some simple actions● Show some text● Make a phone call● Open a web page

– Demo of tag writing

Page 114: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

56

● Make a tag that goes to your home page– Show your resume?– Shows your social networks?

● Make a tag that has your contact information● Record your medical information there

● Other things?

Page 115: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

57

Extra: Security

● Some types of attacks against NFC cards– Can you track someone remotely?– Can you read the data on their cards?

● Is that a problem?

– Can you copy someone's card?● Can you create a fake card and pretend it has more

money on it?

– Can you eavesdrop on communication?

Page 116: Making Transit Card Keychains - Programming Basics · RFID uses no batteries – Devices can be cheap, small, long-lasting – Wireless power Only support nearby communication –

58

Extra: TDMA, FDMA

● Wallet full of NFC tags—what happens?● Don't want to “jam” the communication signal

with all the tags talking at the same time● NFC uses TDMA and FDMA

– Discuss the theory