The Incredible QR Code
Chapter Field Guide
- Find the square
- DECODE
- Recover codewords
- CHECK
- Repair within capacity
- 1
- XOR MASK
- 1
- MASKED BIT
- 0; XOR again to restore 1
Measurable Learning Outcomes
- Identify finder patterns, timing patterns, and format modules in a QR matrix.
- Explain why QR codes apply XOR mask patterns to avoid confusing optical scanners.
- Describe how Reed-Solomon parity codewords allow recovery even when a region is damaged.
Core Scientific Intuition
Unlike a 1D barcode, a QR code stores bits in a 2D grid. Three square finder patterns let a camera determine position, scale, and rotation in one frame. Data bytes are paired with Reed-Solomon error-correction codewords computed in GF(256), allowing up to 7% (L), 15% (M), 25% (Q), or 30% (H) of codewords to be recovered.
Units & assumptions: n = total codewords, k = data codewords, t = unknown-location byte errors in GF(256).
Worked Example
A Version 1-M QR code (21×21 modules) holds 26 total codewords: 16 data bytes and 10 Reed-Solomon parity bytes, enabling correction of up to 5 corrupted bytes anywhere in the symbol.
Hands-On Exploration
Interactive Laboratory
Test the concepts directly with 5 interactive panels, live controls, and visual feedback.
Open Interactive Lab →Three Guided Projects
Structured experiments with hypotheses, boundary tests, hints, and reflection prompts.
View 3 Projects →Source Code (5 Snippets)
Inspect byte-identical printed JavaScript blocks, download `.js` files, or test runnable blocks in the isolated sandbox.
Browse Code →Self-Check Quiz (5 Questions)
Immediate explanations for every choice, unlimited retries, and local-only score tracking.
Take Self-Check Quiz →Book Chapter Outline (Reference Guide)
Section headings from Volume 1 for cross-referencing with the printed book.
Show all 27 book section headings
- A guide to QR codes and error correction.
- A parcel that refused to forget
- Try this before reading on
- The engineer behind the square
- Masahiro Hara (born 1957)
- From factory floors to everyday life
- The anatomy of a square
- From text to a matrix
- Two mathematicians, one remarkable idea
- Irving Stoy Reed (1923 to 2012)
- Gustave Solomon (1930 to 1996)
- Give the message extra clues
- Four levels, four compromises
- Why does a QR code look random?
- Build your own QR generator
- Damage the code, then repair it
- Can a copied QR label fool a verification system?
- Can a square prove a product is genuine?
- The case of the scratched cargo label
- Mission questions
- Invent a better experiment
- What even a clever code cannot do
- Now invent
- Answers to the detective mission
- Scientific vocabulary and sources
- Further reading and references
- Next chapter
Primary Sources & Further Reading
External links are provided for independent verification and deeper study. Link availability can change over time; see the Resources page for verification notes.
| Source | Type | Link |
|---|---|---|
| Real photograph: Masahiro Hara, Qargo (2024), CC0, Wikimedia Commons | reference | https://commons.wikimedia.org/wiki/File:Masahiro_Hara_honored_by_French_artist_qargo.jpg |
| Biography and historical portrait source: National Academy of Engineering memorial | reference | https://www.nationalacademies.org/read/18959/chapter/46 |
| Biography and photograph reference: IT History Society (Reed) | reference | https://ithistory.org/honoree/irving-stoy-reed |
| Historical photograph reference: University of Victoria course notes (Reed and Solomon) | reference | https://www.ece.uvic.ca/~agullive/reedsolomon-2014.pdf |
| DENSO WAVE: error correction | reference | https://www.qrcode.com/en/about/error_correction.html |
| TrustQR product verification workflow | reference | https://trustqr.org/how-it-works/ |
| DENSO WAVE: QR Code history | reference | https://www.qrcode.com/en/history/ |
| DENSO WAVE: QR Code versions and capacity | reference | https://www.qrcode.com/en/about/version.html |
| European Patent Office: QR code inventor team | reference | https://www.epo.org/en/news-events/european-inventor-award/meet-the-finalists/masahiro-hara-motoaki-watabe-tadao-nojiri |
| Reed and Solomon (1960): original paper | reference | https://doi.org/10.1137/0108018 |
| Thonky: QR encoding, masking and placement tutorial | reference | https://www.thonky.com/qr-code-tutorial/ |
| MDN: Canvas API and JavaScript | official-docs | https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API |