RFID & NFC: A Technical Guide
A comprehensive guide to contactless communication — from fundamentals to hands-on tag programming.
About This Book
This book takes you from the physical principles of radio-frequency identification all the way to writing Python code that reads and writes NFC tags. It focuses specifically on the 13.56 MHz band where most modern NFC applications live, with deep coverage of MIFARE Classic, MIFARE Ultralight, NTAG chips, and the NDEF application format that ties them together.
Who This Book Is For
- Developers integrating NFC into applications or embedded systems
- Security researchers studying contactless protocols
- Makers and hobbyists building NFC-enabled hardware projects
- Engineers evaluating RFID technologies for product design
- Anyone who wants to understand what happens when they tap a card or phone on a reader
What You’ll Learn
- How LF, HF, and UHF RFID differ in physics, range, and application
- The ISO 14443 and NFC Forum standards stack
- MIFARE Classic memory layout, sector trailer encoding, and CRYPTO1 authentication
- MIFARE Ultralight / NTAG21x page structure, lock bits, and password protection
- NDEF message and record format — flags, TNF values, URI/Text/SmartPoster records
- How NDEF maps onto physical tag memory (Capability Container, TLV wrappers, MAD)
- Available hardware readers and how to connect them
- Python libraries: nfcpy, ndeflib, pyscard, and libnfc/libfreefare
- Practical examples: scanning, authenticating, reading and writing tags
Book Structure
The book is organized in three parts:
Part 1 — Foundations (Chapters 0–2): RFID physics, frequency bands, ISO standards, and the NFC operating modes. Sets up vocabulary and mental models used throughout the rest of the book.
Part 2 — Tag Deep Dives (Chapters 3–6): MIFARE Classic, MIFARE Ultralight/NTAG, the NDEF format, and a brief look at high-security tags (DESFire). Each chapter covers the memory model, the protocol, and the practical consequences for developers.
Part 3 — Hands-On (Chapters 7–10): Hardware readers, software libraries, complete Python examples, and an action plan for your own projects.
Author Notes
All code examples are written in Python 3. Larger scripts live in the code/ subfolder and are referenced from the chapters. Inline snippets are kept to 20 lines or fewer.
The security-related sections (MIFARE Classic vulnerabilities, DESFire) are presented in an educational context to help developers understand risks and make informed design choices — not to facilitate unauthorized access.
Table of Contents
- Introduction: The World of Contactless Communication
- Chapter 1: RFID Fundamentals — Frequencies, Ranges & Use Cases
- Chapter 2: NFC Standards — ISO 14443, ISO 15693, NFC Forum
- Chapter 3: MIFARE Classic — Memory Layout, Auth & Security
- Chapter 4: MIFARE Ultralight — Lightweight Tags & Ticketing
- Chapter 5: NDEF Format — Records, Types & Encoding
- Chapter 6: Secure NFC — DESFire and Beyond
- Chapter 7: Hardware & Readers — PN532, ACR122U, SPI/I2C
- Chapter 8: Software Libraries — nfcpy, libnfc, pyscard & more
- Chapter 9: Practical Examples — Reading, Writing & Debugging
- Chapter 10: Action Plan — Projects & Next Steps