16.4 16.3 Bar Codes

In modern applications, bar codes and identification numbers go hand in hand. Bar coding is a method for automated data collection. It is a way to transmit information rapidly, accurately, and efficiently to a computer.

681

Bar Code DEFINITION

A bar code is a series of dark bars and light spaces that represent characters.

To decode the information in a bar code, a beam of light is passed over the bars and spaces via a scanning device, such as a handheld wand or a fixed-beam device. The dark bars reflect very little back to the scanner, whereas the light spaces reflect much light. The differences in reflection intensities are detected by the scanner and converted to strings of 0s and 1s that represent specific numbers and letters. Such strings are called a binary coding of the numbers and letters.

Binary Code DEFINITION

Any system for representing data with only two symbols is a binary code.

ZIP Code Bar Coding

The simplest bar code is the Postnet code used by the U.S. Postal Service and commonly found on business reply forms (see Figure 16.5).

image
Figure 16.5: Figure 16.5 ZIP + 4 bar code.

For a ZIP + 4 code, there are 52 vertical bars of two possible lengths (long and short). The long bars at the beginning and end are called guard bars and together provide a frame for the remaining 50 bars. In blocks of 5, the 50 bars within the guard bars represent the ZIP + 4 code and a 10th digit for error correction. Each block of 5 is composed of exactly 2 long bars and 3 short bars, which a scanner converts to binary strings, according to the pattern shown below:

682

image
Handheld scanner reading the shipping bar code on a crate.
Decimal Digit Bar Code Binary Code
1 image 00011
2 image 00101
3 image 00110
4 image 01001
5 image 01010
6 image 01100
7 image 10001
8 image 10010
9 image 10100
0 image 11000

The 10th digit of a Postnet code number is a check digit chosen so that the sum of the 9 digits of the ZIP + 4 and the 10th one is evenly divisible by 10. That is, the check digit for the ZIP + 4 code is the digit with the property that the sum ends with 0. For example, the ZIP + 4 code 80321-0421 has the check digit 9 because

and ends with 0.

Because each digit is represented by exactly two long bars and three short ones, any error in reading or printing a single bar would result in a block of five with only one long bar or three long bars. In either case, the error is detected. This is the reason behind the choice of five bars to code each digit rather than four bars. With five bars per digit, there are exactly 10 arrangements composed of two long bars and three short bars. Any misreading of a single bar in such a block is therefore recognizable because it does not match any of the other blocks for the 10 digits. And because the block location of the error is known, the check digit permits the correction of the error. Let's look at an example of an incorrectly printed bar code and see how the error is correctable.

683

EXAMPLE 6 Detecting and Correcting an Error

The scanner ignores the guard bars at the beginning and the end and reads the remaining bars in blocks of five, as shown below. (We have inserted dashed dividing lines for readability.)

image

The sixth block is an incorrect one because it has only one long bar. To correct the error, the computer linked with the bar-code scanner sums the remaining 9 digits to obtain 31. I Because the sum of all 10 digits ends with 0, the correct value for the sixth digit must be 9.

Self Check 5

Suppose the bar code for the first digit of the ZIP + 4 code has three long bars instead of the required two long bars. If the remaining bar code for the last 9 digits (including the check digit) represents 505582721, what is the correct first digit?

  • 5

Beginning in 1993, large organizations and businesses that wanted to receive reduced rates for ZIP + 4 bar-coded mail were required to use a 12-digit bar code called the delivery-point bar code. This code permits machines to sort a letter into the order in which it will be delivered by the carrier. Mail for the first location on a mail route occurs first, mail for the second location on a route occurs second, and so on.

The 12-digit bar code uses the Postnet bar scheme to code the 12-digit string composed of the 9-digit ZIP + 4 number, followed by the last two digits of the street address or box number and a check digit chosen so that the sum of all 12 digits is evenly divisible by 10. For example, a letter addressed to 1738 Maple Street with ZIP + 4 code 55811-2742 would have the Postnet bar code for the digits 558112742384 (38 is from the street address and 4 is the check digit).

In May 2011, the Postnet code was replaced by a new bar code called the Intelligent Mail Barcode. The new bar code converts 31 digits of data into 65 vertical bars that encode the type of service, the mail owner, a unique serial number that enables the user to track the letter at every step from arrival at the post office to delivery, and the delivery-point ZIP code. The code uses bars of three lengths and multiple levels to create four states as shown below.

image

684

The UPC Bar Code

The bar code that we encounter most often is the UPC that was first used on grocery items in 1974. The widespread use of the UPC code by manufacturers enabled businesses to cheaply and accurately manage much larger inventories than was previously possible. This, in turn, gave rise to big box retailers such as Target and Home Depot, which are now commonplace. As Figure 16.6 shows, it has other applications as well. The UPC bar code translates 12-digit UPC identification numbers discussed earlier into bars that can be read quickly and accurately by a laser scanner. The number has four components—two five-digit numbers sandwiched between two single digits—as shown in Figure 16.7.

For the UPC 0 38000 00127 7, here is what the four components represent:

image
Figure 16.6: Figure 16.6 Entomologist Stephen Buchmann developed a reliable, inexpensive way to track bees using the same technology that supermarkets use to speed up checkout lines and keep track of inventory. He glued barcode labels onto the backs of 100 bees and placed a laser scanner above the hive. In the past, researchers marked bees with paint or tags, but monitoring activity required the presence of a human observer.
image
Figure 16.7: Figure 16.7 UPC identification number 4 41120 10640 9. The initial 4 indicates that the number is a savings coupon. The block 41120 identifies the retailer as Kmart. The block 10640 identifies the product. The last digit, 9, is a check digit.
image
Figure 16.8: Figure 16.8 UPC bar coding for a left-side 6 and left-side 0, part of the manufacturer's number.

Each digit of the UPC code is represented by a space divided into seven modules of equal width, as illustrated in Figure 16.8. How these seven modules are filled depends on the digit being represented and whether the digit being represented is part of the manufacturer's number or the product number. In every case, there are two light spaces and two dark bars of various thicknesses that alternate. A UPC code has on each end two long bars of one-module thickness separated by a light space of one-module thickness. These two modules are called the guard bar patterns (Figure 16.9). The guard bar patterns define the thickness of a single module of each type. They are not part of the identification number. The manufacturer's number and the product number are separated by a center bar pattern consisting of the following five modules: a light space, a dark bar, a light space, a dark bar, and a light space (see Figure 16.9). The center bar pattern is not part of the identification number but merely serves to separate the manufacturer's number and product number. Figure 16.8 shows how the digits 6 and 0 in a manufacturer's number are coded.

685

image
Figure 16.9: Figure 16.9 UPC bar-code format.

Observe the following pattern in Figure 16.8: a light space of one-module thickness, a dark bar of one-module thickness, a light space of one-module thickness, and a dark bar of four-module thickness. Symbolically, such a pattern of light spaces and dark bars is represented as 0101111. Here, each 0 means a one-module-thickness light space and each 1 means a one-module-thickness dark bar.

Table 16.1 shows the binary code for all digits. Notice that the code for the digits in the product number (the block of five digits on the right side) can be obtained from the code for the digits in the manufacturer's number (the block of digits on the left side), and vice versa, by replacing each 0 by a 1 and each 1 by a 0. Thus, the code 0111011 for 7 in a manufacturer's number becomes 1000100 in the product number. Also notice that each manufacturer's number has an odd number of 1s, whereas each product number has an even number of 1s. This permits a computer linked with an optical scanner to determine whether the bar code was scanned left to right or right to left. (If the first block of digits has an even number of 1s for each digit, the scanning is being done right to left.) Thus, scanning can be done in either direction without ambiguity.

Table 16.2: TABLE 16.1 Binary UPC Coding
Digit Manufacturer's Number Product Number
0 0001101 1110010
1 0011001 1100110
2 0010011 1101100
3 0111101 1000010
4 0100011 1011100
5 0110001 1001110
6 0101111 1010000
7 0111011 1000100
8 0110111 1001000
9 0001011 1110100

686

New Applications of Bar Coding

New applications of bar coding continue to be found. In 2003, a method of bar coding genetic information about animal species was introduced that provides a convenient, inexpensive way to identify species (see Spotlight 16.2).

New Frontier: Bar Coding DNA Spotlight 16.2

In 2003, Paul Hebert from the University of Guelph in Canada proposed the compilation of a public library of DNA bar codes for animal species. Rather than scanning an animal’s entire genome, which is expensive and time-consuming, Hebert pinpointed a short piece of a section of a single gene that could be used to distinguish one animal species from another cheaply and quickly. For about $2 per sample, the genetic sequence of this tiny gene section can be converted to a four-color bar code that corresponds to the four nucleotides that make up the genetic code. The bar code identifies the species of its source in the same way that the UPC bar code identifies a retail item. By 2013, more than 300,000 species were bar-coded, and a new field of science was born. The technique has already resulted in improved food safety, disease prevention, and better environmental monitoring.

image
DNA bar codes for the hermit thrush (Stubblefield Photography/Shutterstock), American robin (Alan & Sandy Carey/Science Source), bumblebee (Mark Stoeckle, The Rockefeller University), and honeybee (Scott Camazine/Science Source).

687

Recently, a new generation of bar codes, called the QR code (abbreviated from Quick Response Code), uses mosaics of black and white rectangles that encode much more information than traditional bar codes (see Figure 16.10). These bar codes can be read by specially equipped cell phones to display video, music, or text on the screen or to link the cell phone to a web page. A user can point his or her cell phone at the bar code in a magazine, on a billboard, or on the side of a building to receive information about a product or service. A bar code for a movie will allow the viewer to watch a trailer. Scanning the wrapper of a hamburger will provide nutrition information. See Spotlight 16.3 for a history of bar codes.

In June 2011, the Royal Dutch Mint issued the world’s first official coin with a QR code. One study found that during the month of June 2011, 14 million mobile users scanned a QR code or a bar code.

image
Figure 16.10: Figure 16.10 Bar code on a building in Japan that can be read by a properly equipped cell phone.

 

 

 

 

History of Bar Codes Spotlight 16.3

1948 Graduate students Norman Joseph Woodland and Bernard Silver at the Drexel Institute of Technology begin working on a bar code.

1952 Woodland and Silver receive a U.S. patent.

1967 The Association of American Railroads adopts an optical bar code.

1969 General Motors uses bar codes to keep track of inventory.

1971 The Uniform Code Council, originally called the Uniform Grocery Product Code Council, is formed to administer the UPC.

1972 U.S. Supermarket Ad Hoc Committee on a Uniform Grocery Product Code recommends the adoption of the 1972 UPC.

1973 An ad-hoc committee composed of grocery executives chooses the linear bar code with 11 digits and a 12th check digit.

1974 A 10-pack of Wrigley’s Juicy Fruit chewing gum was the first product with a bar code; it was first scanned at a checkout counter in Troy, Ohio. Today, the pack of gum is on display at the Smithsonian Institution’s National Museum of American History.

1974 Ninety-five percent of the railroad fleet is labeled with a bar code.

1977 European Article Numbering Association is formed in Belgium.

1981 U.S. Department of Defense adopts the use of bar codes for marking all products sold to the U.S. military.

1982 The U.S. Postal Service adopts the Postnet bar code.

1992 Norman Joseph Woodland is awarded the 1992 National Medal of Technology by President George H. W. Bush.

1994 The two-dimensional QR bar is introduced in Japan for use in the automotive industry.

2004 Consortium for the Barcode of Life is established.

2011 Intelligent Mail Barcode replaces the Postnet code for U.S. Postal Service mail.