RFID and NFC lesson plan
MIFARE Classic and NTAG cards on an MFRC522 and a PN532: how a passive tag is powered, UIDs of four and seven bytes, sectors, keys and blocks, NTAG pages and NDEF, an access list with a master card, honest security (UIDs clone, Crypto1 is broken), and a spaceship crew airlock.
Objectives and materials
By the end, students can
- How tags work, their UIDs, and the memory inside a MIFARE Classic.
- NFC on the PN532, access lists, and the limits of card security.
- A crew airlock that knows who is aboard.
Materials for the whole unit
- Arduino Uno R3
- Buzzer
- Character LCD with I2C backpack
- LED x 2
- NFC reader, PN532
- Resistor x 2
- RFID reader, MFRC522
Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.
Cards and readers
How tags work, their UIDs, and the memory inside a MIFARE Classic.
| Lesson | Time | What students do |
|---|---|---|
| How tags workA reader that powers the card it reads: the MFRC522’s 13.56 MHz field, a passive tag’s coil and chip, and the ATQA and SAK that tell a MIFARE Classic 1K from an NTAG213 before anything else is said. | 45 min |
|
| MFRC522 UIDsEvery card’s UID, four bytes or seven, sent in the clear before anything secret; PICC_HaltA() makes a card held on the reader count once per tap; and the property that decides which UIDs the cards on this bench carry. | 45 min |
|
| Sectors and blocksInside a MIFARE Classic 1K: 16 sectors of four 16-byte blocks, keys and access bits in every sector trailer, the wrong key timing out, the transport key FF FF FF FF FF FF working, and a name written to block 4 and read back. | 55 min |
|
Materials
- Arduino Uno R3
- RFID reader, MFRC522
Check for understanding
Each student finishes "Sectors and blocks" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Your own data".
Building with tags
NFC on the PN532, access lists, and the limits of card security.
| Lesson | Time | What students do |
|---|---|---|
| PN532 and NFCThe PN532 NFC controller on I2C: firmware version 1.6, a card’s UID through command frames, an NTAG213’s capability container E1 10 12 00, and a page of user memory written and read back with no key. | 55 min |
|
| Access listsA door controller: an allow list of UIDs with names, a green lamp for Ana, a red lamp and a buzzer for a stranger, and a master card that enrolls the stranger as a guest, who then gets in. | 55 min |
|
| Security limitsA door that trusts the UID lets in a card that only copies it. A door that gives each card a secret in a keyed sector and checks it on every tap refuses the copy. And why even that is not enough: MIFARE Classic’s Crypto1 has been broken since 2008. | 45 min |
|
Materials
- Arduino Uno R3
- Buzzer
- LED x 2
- NFC reader, PN532
- Resistor x 2
- RFID reader, MFRC522
Check for understanding
Each student finishes "Security limits" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Honest security".
Boss project
A crew airlock that knows who is aboard.
| Lesson | Time | What students do |
|---|---|---|
| Boss: the crew airlockThe airlock of a deep-space ship: crew cards board and leave for spacewalks, the LCD keeps the count aboard, the outer door lamp cycles on every crossing, and an unknown card sounds the intruder alarm. | 55 min |
|
Materials
- Arduino Uno R3
- Buzzer
- Character LCD with I2C backpack
- LED x 2
- Resistor x 2
- RFID reader, MFRC522
Check for understanding
Each student finishes "Boss: the crew airlock" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "A new crew member".
Teach this unit as a class
Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.
The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.