Skip to content
Logistics Engineering

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:

    \[ c = (10 - S \bmod 10) \bmod 10,\qquad S = \sum_{k=1}^{12}w_kx_k,\quad w_k \in \{1, 3\} \]

Check digit of an EAN-13 code
The twelve digits 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 are multiplied alternately by 1 and 3; the weighted sum S is 93, and the check digit, which brings the sum to a multiple of 10, is 7.

Example. For 801234567890: 8 + 0 + 1 + 6 + 3 + 12 + 5 + 18 + 7 + 24 + 9 + 0 = 93, so c = 7 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 w changes by \delta, with \delta between -9 and 9 and non-zero, the weighted sum changes by w\delta. The error escapes only if w\delta is a multiple of 10. With w = 1, \delta would have to be a multiple of 10, impossible. With w = 3: since 3 and 10 have no common factors, 3\delta is a multiple of 10 only if \delta is, again impossible. ∎

Theorem. A swap of two adjacent digits a and b is detected, except when |a - b| = 5.

Proof. Two adjacent positions have weights 1 and 3. Before the swap they contribute a + 3b (or 3a + b), after it b + 3a: the difference is \pm 2(a - b). It is a multiple of 10 only if a - b is a multiple of 5, i.e., for distinct digits, if |a - b| = 5 (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.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x