Identification and traceability: barcodes, 2D codes and RFID
GS1 standards, the EAN-13 check digit with an example, detection of single errors and swaps proved, QR and DataMatrix, RFID tags, traceability and recalls.
Every parcel, every pallet, every component of a car must be identifiable and traceable along the chain: to know where it is, to reconstruct which batch it comes from if there is a defect, to recall only the products concerned. In this lesson we look at EAN-13 barcodes with the check digit, the proofs of which errors it detects and which it does not, two-dimensional codes, RFID tags and the standards that make codes readable by everyone.
GS1 codes
The GS1 organisation assigns each company a prefix and manages the identification standards: the GTIN identifies a product (the EAN-13 code on retail packs is a 13-digit GTIN), the SSCC identifies a logistic unit (a pallet, a parcel), the GLN a location. Thanks to the standards, a pallet labelled by a supplier can be read in any customer’s warehouse in the world.
The check digit
The last digit of an EAN-13 code carries no information: it is a check digit that lets the reader notice reading or typing errors. The first 12 digits are multiplied alternately by 1 and 3 (from the left, the first by 1), added up, and the check digit is the one that brings the sum to the next multiple of 10:
![Rendered by QuickLaTeX.com \[ c = (10 - S \bmod 10) \bmod 10,\qquad S = \sum_{k=1}^{12}w_kx_k,\quad w_k \in \{1, 3\} \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-284fa55e47ac90de2f69fddac61a9059_l3.png)

Example. For 801234567890:
, so
and the complete code is 8012345678907. The reader recomputes the weighted sum of all 13 digits (with weight 1 for the check digit): if it is not a multiple of 10, the reading is wrong and is repeated.
Theorem. The EAN check digit detects every single-digit error.
Proof. If the digit in a position with weight
changes by
, with
between
and 9 and non-zero, the weighted sum changes by
. The error escapes only if
is a multiple of 10. With
,
would have to be a multiple of 10, impossible. With
: since 3 and 10 have no common factors,
is a multiple of 10 only if
is, again impossible. ∎
Theorem. A swap of two adjacent digits
and
is detected, except when
.
Proof. Two adjacent positions have weights 1 and 3. Before the swap they contribute
(or
), after it
: the difference is
. It is a multiple of 10 only if
is a multiple of 5, i.e., for distinct digits, if
(for example 1 and 6, or 2 and 7). ∎
Swapping adjacent digits is the most frequent error when typing by hand, and the code detects about 89 % of them. More robust codes, such as ISBN-10 which uses weights from 1 to 10 modulo 11, detect them all, because 11 is prime; the same principle, taken much further, underlies error-correcting codes (Electrical Communications lesson on error-correcting codes).
Two-dimensional codes
2D codes such as QR and DataMatrix hold hundreds of characters in a small square, and use Reed-Solomon codes that correct errors, not just detect them: a QR code remains readable even with 30 % of its surface damaged (at the highest correction level). The GS1 DataMatrix carries the product code, batch, expiry date and serial number together: it is compulsory, for example, on medicine packs to fight counterfeiting, and is laser-etched directly onto electronic and mechanical components.
RFID
An RFID tag contains a chip and an antenna; the reader powers it with a radio-frequency field and reads its code, without needing to see it. Passive UHF tags (860-960 MHz) can be read at a few metres, hundreds per second: a whole pallet passes under a gate and all the parcels are recorded together, without unloading them. The EPC (electronic product code) identifies the individual object, not just the product type. The limits: liquids and metals disturb the field (lesson on antennas), and a tag still costs more than a printed code.
Traceability
With identification at every step, an information system records where each batch has been and what it contains: backward traceability (which raw material batches does this product come from?) and forward traceability (where did the products made with that defective batch end up?). In a recall, the difference between withdrawing a whole month’s production and withdrawing two hundred identified units lies entirely here.




