Professional Documents
Culture Documents
TRC3500 Section 08 - Bar Codes
TRC3500 Section 08 - Bar Codes
TRC3500
Sensors & Artificial Perception
2
Example bar codes
CODE 39
DATAMATRIX
Can encode alphanumeric and special
2D barcode, higher data density
characters
3
Barcode Scanners
Handheld scanner
1) Laser light scanned across barcode
2) Reflected intensity captured by photodiode
3) Circuitry converts intensity to numerical output
Omni-directional scanner
1) Extension of handheld scanner
2) Scans in multiple directions (Lissajous curves)
Imaging scanners
1) Small video camera to capture image of barcode
2) Image processing to decode barcode
4
The Supply Chain
A supply chain is the sequence of activities that delivers an
object or a service to a consumer. Supply chain management
involves passing orders and requests down from the consumer
and organising the sourcing of components and other items to
satisfy the consumer request. E.g.
5
The Supply Chain
2. Items read
as shipped by
supplier and
1. Bar code
receiver
attached to
goods, palates,
cases at
manufacturer
3. Items read
as received by
4. Items read as removed from store
storage and put on shelves
6
Bar code requirements
The code should contain 10 decimal characters (subsequently, 12
were required).
The scanning reject rate should not exceed 0.01 and the
undetected error rate should not exceed 0.0001.
7
Bar code requirements
The depth of field should be at least one inch.
The symbol area should not exceed 1.5 square inches. (The
symbol selected is of variable size.)
8
The UPC
The Universal Product Code (UPC) is a widely used form of bar
code that will be familiar to everyone. Most products that are
purchased from a supermarket are identified by one of these bar
codes and each product is allocated a unique code number.
9
Binary code requirements
Simplest way to encode numbers and characters is to use binary
codes
m m!
Cr =
(m r)!r!
11
(n, k) codes
Distinct characters in (n, k) codes
k
1 2 3 4
2 1 0 0 0
3 2 0 0 0
4 3 1 0 0
5 4 4 0 0
n 6 5 10 1 0
7 6 20 6 0
8 7 35 21 1
9 8 56 56 8
10 9 85 126 36
12
UPC Code Characters
A (7, 2) code was selected to encode the ten characters 0
through 9 and to provide an indication of parity
13
Decoding UPC Characters
14
The UPC Symbol
15
Number System
NS Description
0 Regular Items
1 Reserved
2 Variable Weight Items
3 Drug/Health Items
4 In-store use on non-food items
5 Coupons
6 Regular Items
7 Regular Items
8 Regular Items
9 Regular Items
16
Modulo check digit (creation)
The modulo check digit is used to ensure the barcode has been
decoded correctly
CREATED as follows:
1. From right to left, add the digits in the odd-numbered positions (first, third, fifth, etc.)
together and multiply by three.
2. From right to left, add the digits in the even-numbered positions (second, fourth,
sixth, etc.) to the result.
3. Find the result modulo 10 (i.e. the remainder when divided by 10. e.g. 10 goes into
58, 5 times with 8 leftover, so 58 mod 10 = 8).
4. If the result is not zero, subtract the result from ten.
17
Modulo check digit (checking)
CHECKED as follows:
1. EXCLUDE THE SCANNED CHECK DIGIT
2. From right to left, add the digits in the odd-numbered positions (first, third, fifth, etc.)
together and multiply by three.
3. From right to left, add the digits in the even-numbered positions (second, fourth,
sixth, etc.) to the result.
4. Find the result modulo 10 (i.e. the remainder when divided by 10. e.g. 10 goes into
58, 5 times with 8 leftover, so 58 mod 10 = 8).
5. If the result is not zero, subtract the result from ten.
6. If the calculated digit does not match the scanned digit, an error has occurred in
scanning
18
Example
Check if the following scanned barcode is valid: 931007202213
1. Exclude the scanned check digit: 3
2. From right to left, odd digits: 122019 (digit sum = 15, 153 = 45)
3. From right to left, even digits: 20703 (digit sum = 12)
4. Check sum = 45 + 12 = 57
5. 57 mod 10 = 7, Check digit = 10 7 = 3
6. Scanned barcode is correct
19
Bar code ink spreading
Printing of barcodes is subject to ink spreading
20
T - Values
21
T4 Extended (T4e)
T4e is resistant to
spreading and
contains the first black
bar in the next
character (if you know
T4e
the size of this black
bar you can work out
T4)
22
The Effect of Ink Spreading
As the following slide illustrates, the choice of these four T-
values helps to make measurements independent of spreading
of the ink used to print the bar code.
23
Resistance to Spreading
T1 = T1
T2 = T2
24
Converting Measurements to Modules
Measurements made of the bar code are converted to integer
module values in the following way:
25
Converting Measurements to Modules
Measurements made of the bar code are converted to integer
module values in the following way:
Ti 2.5 If decision is correct,
ATi = 2 then ATi =Ti
T 7
2.5 Ti 3.5
ATi = 3
7 T 7 A one unit error in
interpreting T1 or T2
3.5 Ti 4.5
ATi = 4 results in a parity error
7 T 7 in decoded character
...
26
Decoding Characters
Using measured
values of t1, t2, and
t4 the character
can be decoded
27
EAN-13 Bar Codes
First 2 or 3 digits = country code of manufacturer
28
Decoding a UPC Bar Code
101 0001011 0111101 0101111 0110001 01010 1110010 1100110 1000100 1001110 101
Guard Guard Guard
9O 3O 6O 5O bar 0E 1E 7E 5E
bar bar
29
EAN-13 Country Code
The left-most digit in the bar code is not coded as bars, it is
encoded in the parity of the left-hand group of digits.
0=OOOOOO
1=OOEOEE
2=OOEEOE
3=OOEEEO
4=OEOOEE
5=OEEOOE
6=OEEEOO
7=OEOEOE
8=OEOEEO
9=OEEOEO
30
EAN-13 Character Encoding
Left Digits Right Digits
Character Odd Parity Even Parity Even Parity
0 0001101 0100111 1110010
1 0011001 0110011 1100110
2 0010011 0011011 1101100
3 0111101 0100001 1000010
4 0100011 0011101 1011100
5 0110001 0111001 1001110
6 0101111 0000101 1010000
7 0111011 0010001 1000100
8 0110111 0001001 1001000
9 0001011 0010111 1110100
31
Decoding an EAN-13 Bar Code
Guard Guard
3O 1E 0E 0O 7E 2O Guard 0E 0E 4E 4E 2E 6E
bar bar bar
32
Now it is Your Turn!
What numbers are coded in this right hand half of a bar code?
33
Australia Post barcodes
4-state bars
3 Encoding methods C, N and Base-4
http://auspost.com.au/business/barcoding.html
34
Australia Post barcode format
35
Error correction codes
Used in (tele)communications
36
Error correction code principles
Redundancy
e.g. sampling a received bit 3 times Triplet
Interpreted as
received
Majority of bits determines 000 0
most likely received bit 001 0
010 0
Inefficient 3 bits required 100 0
to encode 1 data bit! 111 1
Data-rate = 1/3 110 1
101 1
011 1
37
Error correction code principles Code
Data
word
Hamming distance is the number of bits that are 0000 0000000
different between two code words 0001 1101001
Adding extra bits to the data allows an increase in the 0010 0101010
0011 1000011
Hamming distance between code words
0100 1001100
In this example Hamming(7,4) code, if a single bit 0101 0100101
error occurs in a received code word, it is possible to 0110 1100110
unambiguously ascertain the transmitted code word 0111 0001111
1000 1110000
e.g. 0000001 has been received/decoded
1001 0011001
Assuming ONE bit error, the only possible transmitted
1010 1011010
code word is 0000000
1011 0110011
This code can detect, but not correct, TWO bit errors 1100 0111100
The code shown here has 3 redundancy bits for 1101 1010101
1110 0010110
4 data bits, a data-rate of 4/7.
1111 1111111
38
2D barcodes (example Datamatrix)
http://www.gs1.org/sites/default/files/docs/barcodes/GS1_DataMatrix_Introduction_and_technical_overview.pdf
Finder
pattern
Data
39
Datamatrix capacity
Grid size determines data capacity of barcode
40
Datamatrix encoding
Data encoded in 2D code words
Datamatrix output:
Raw data Binary image Finder pattern added
42
Datamatrix decoding
Requires 2D scanner
43
Problems
8.1 Why is it important to track goods in the supply chain?
8.2 What are the main advantages of using bar codes to identify goods?
8.3 The UPC bar code employs a (7,2) code. Explain what a (7,2) code is in terms of
the number of modules employed, how they code information and how may unique
characters can be represented by the code.
8.4 Bar codes can be decoded in terms of their T values. Explain how the T values
are resistant to the spreading of ink when the bar code is printed.
8.5 How is the left most character (the one that is not coded in the stripes) in an
EAN-13 bar code encoded?
44
More Problems
8.6 For the following EAN-13 bar codes which ones contain an error?
a) 9310072022116
b) 8995077200098
c) 9300462348216
d) 9310755305037
e) 8004880211114
45