Barcode Interface

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

What is Barcode?

❑ A barcode is a machine readable data


representation made up of bars of dark and light
areas which represent a set of data, often a string of
numbers.
❑ This pattern of black lines and white spaces stores
the data.
❑ Once a barcode is scanned with a barcode scanner,
or a smart phone in some cases, the data is
translated into readable information.
What are Barcodes used for?
❑ Giving every item that you want to classify its own,
unique number and then simply print the number on the
item so an electronic scanning device can read it.
❑ Problem:

❑ a misprinted eight could look like a three to a computer.


❑ or a six is identical to nine if you turn it upside down
which could cause all sorts of chaos at the checkout if
you scanned the wrong way up.
❑ What we really need is a completely reliable way of
printing numbers so that they can be read very accurately
at high speeds. That's the problem that barcodes solve.
How Barcodes represent 0-9
❑ Looking at a barcode, can't make head or tail of
it-Where one number ends and another one begins.
❑ Each digit in the product number is given the

same amount of horizontal space- exactly 7


units.
❑ To represent any of the numbers from zero through
nine, we simply color those seven units with a
different pattern of black and white stripes
How Barcodes represent 0-9
The number one is
represented by coloring
in two white stripes, two
black stripes, two white
stripes, and one black
stripe, while the number
two is represented by two
white stripes, one black
stripe, two white stripes,
and two final black
stripes.
1D Barcode
Barcodes Information
❑ A long barcode represents three different types
of information:
❑ The first part of a barcode tells the country where it was
issued.
❑ The next part reveals the manufacturer of the product.

❑ The final part of the barcode identifies the product itself.

❑ Most products carry a simple barcode known as


the UPC (universal product code)—a line of
vertical stripes with a set of numbers printed
underneath it
Barcode Scanner
❑ Reading barcode involves determining the widths of
the dark and light bars across the pattern and
transform it into a digital representation.
❑ Elements of bar code may be only fractions of a
millimeter wide
❑ the reader has to focus to at least this
resolution if a clean output is to be produced
How does a barcode scanner works?
❑ Barcode scanners have to be able to read the black-and-white zebra
lines on products extremely quickly and feed that information to a
computer or checkout terminal, which can identify them immediately
using a product database.
❑ Lets’ assume, each black line corresponding to a one and each white
line a zero.
❑ Scanning head shines LED or laser light onto barcode.
❑ Light reflects back off barcode into a light-detecting electronic
component called a photoelectric cell.
❑ White areas of the barcode reflect most light; black areas reflect least.
❑ As the scanner moves past the barcode, the cell generates a pattern of
on-off pulses that correspond to the black and white stripes.
How does a barcode scanner works?
❑ An electronic circuit (decoder) attached to the scanner converts
these on-off pulses into binary digits (zeros and ones).
❑ The binary digits are sent to a computer attached to the scanner,
which detects the code as 11101011.
Fig: CCD Scanner Arrangement
Types of barcode scanner
❑ Pen Scanner:
❑ Need to run it across the barcode so it can reach each block of black or white
in turn
❑ Wand Scanner:
❑ A wand scanner, the CCD or photocells read the entirecode at once.
❑ Laser Scanner:
❑ The laser beam being bounced around at high-speed by a spinning wheel so
it reads products (literally) in a flash

The best barcode scanners are so accurate that they make only one
mistake in something like 70 million pieces of scanned information!
Codes
❑ UPC- Universal
Product Coding
❑ EAN-European
Article Number
❑ Numbers to be coded
consist of-
❑ Prefix(1 digit for UPC, 2
for EAN)
❑ Manufacturer number (5
digits)
❑ Item reference (5 digits)
❑ Check digit (1 digit)
13

Codes
❑ UPC-A is 12 digit number
❑ The scan able area of every UPC-A barcode follows the pattern
SLLLLLLMRRRRRRE,
-where S (start), M (middle), and E (end) guard patterns are
represented the same way on every UPC-A barcode and the L
(left) and R (right) sections collectively represent the 12
numerical digits that make each UPC-A unique.
❑ The total width for a digit is always 7 modules; consequently,
❑ UPC-A 12-digit number requires a total of 7×12 = 84 modules.
❑ A complete UPC-A is 95 modules wide: 84 modules for the digits,
combined with 11 modules for the S (start), M (middle), and E
(end) guard patterns.
14

Codes
❑ Codes used on either side of the center line are different so that
the direction of scan can be determined
❑ A scanner can determine whether it is scanning a symbol from
left-to-right or from right-to-left (the symbol is upside-down).
❑ After seeing a S (start) or E (end) guard pattern (they are the
same, bar-space-bar, whichever direction they are read), the
scanner will first see odd parity digits, if scanning left-to-right,
or even parity digits, if scanning right-to-left.
❑ With the parity/direction information, an upside-down symbol
will not confuse the scanner.
❖ When confronted with an upside-down symbol, the scanner may
simply ignore it or recognize the digits and put them in the right
order.
14

Codes
❑ For UPC
❑ Left hand digits are encoded using ‘Left Hand A’
❑ For EAN
hand digits are encoded using mixture of ‘Left
❑ Left
Hand A’ and ‘Left Hand B’
❑ The first digit determines which coding to use for each
of the remaining six digits.
15

Codes

❑ For UPC
❑ Left hand digits are encoded using ‘Left Hand A’
❑ For EAN
❑ Left hand digits are encoded using mixture of ‘Left Hand A’
and ‘Left Hand B’
❑ The first digit determines which coding to use
for each of the remaining six digits.
17

Example-1
Code: 9 780340 606 582 Total digit 13 EAN
9 (Table 7.2) A B B A B A
First 6 digits after 9

7 8 0 3 4 0
Left Hand Left Hand Left Hand Left Hand Left Hand Left Hand
A B B A B A
0111011 0001001 0100111 0111101 0011101 0001101

Last 6 digits

6 0 6 5 8 2
Right Hand Right Hand Right Hand Right Hand Right Hand Right Hand
1010000 1110010 1010000 1001110 1001000 1101100
17

Example-2
Code: 012345 678905 Total digit 12 UPC
First 6 digits

0 1 2 3 4 5
Left Hand Left Hand Left Hand Left Hand Left Hand Left Hand
A A A A A A
0001101 0011001 0010011 0111101 0100011 0110001

Last 6 digits

6 7 8 9 0 5
Right Hand Right Hand Right Hand Right Hand Right Hand Right Hand
1010000 1000100 1001000 1110100 1110010 1001110
18

Calculating the checksum

1. Add the values of the digits in even positions.


2. Multiply this result by 3.
3. Add the values of the digits in odd positions
4. Sum the results of steps 2 and 3.
5. To calculate the check digit, take the remainder of
(result/10 or result%10) and if not 0, subtract from 10.
21

Example of check digit calculation


❑ Example (UPC):
Assume the barcode data = 01234567890X
1. 1+3+5+7+9=25
2. 25x3=75
3. 0+2+4+6+8+0= 20
4. 75 + 20 = 95
5. 95%10=5
10-5=5
21

Example of check digit calculation


❑Example (EAN 13):
Assume the barcode data = 9 780340 606 58X

1.7+0+4+6+6+8=31
2. 31 x 3=93
3. 9+8+3+0+0+5=25
3. 25+93=118
4. 118+X=120 (next highest number multiple of 10)
X=120-118=2

You might also like