How does the universal barcode work?

Barcodes: you can’t escape them, and all along the supply chain from raw source to end-user purchase, we can’t function without them. They are pre-printed on neatly everything we buy or use, they can be added later as stick-on labels, or they can be printed on demand as needed for custom projects.

Barcodes are now so ingrained in our thinking and logistical systems that we don’t give much thought to them, how they work, and how they came to be what they are. This FAQ will briefly explore the elements and function of the barcode itself and its overall system, as well as the interesting twenty-year-long path of their development and adoption.

Q: What is a barcode (sometimes written as bar code)?

A: Starting with the Universal Product Code (UPC) for retail products and sales (Figure 1), the basic barcode is a standard one-dimensional (linear) series of black bars printed on a white background, initially representing ten digits and then expanded to 12 digits. The bars have a variable width, similar to pulse-width modulation

How does the universal barcode work?
Fig 1: The basic UPC barcode is instantly recognizable and elegantly simple in appearance, with 12 (formerly 10) numeric values represented by a pattern of lines of variable width and spacing. (image source: Barcodes, Inc.)

Q: What are the elements of a barcode system?

A: In concept, it’s elegant and simple: there’s the printed code, a scanner which reads the code bars, decodes the numbers or alphanumeric characters they represent and sends them as data to a computer, and a database in the computer (Figure 2).

How does the universal barcode work?
Fig 2: A high-level view of a complete barcode system shows the major elements: 1) a tightly focused light source; 2) the barcode itself; 3) a photoreceptor; 4) a light-to-digital interface and decoder, and 5) a computer which contains the UPC database. (Source: www.explainthatstuff.com )

Q: What do the bars represent?

A: Although there are now many encoding schemes in use, the basic original structure of a barcode has a leading and trailing quiet zone, a start pattern, one or more data characters, (optionally) one or two check characters, and a stop pattern (Figure 3) in a standard field size. The system was initially designed for retail environments, and that first code scheme is still widely used, with some extensions.

How does the universal barcode work?
Fig 3: The basic UPC representation is somewhat analogous to a merger of PPM, PWM, asynchronous RS-232 links, and Morse code, with a leading and trailing quiet zone, a start pattern, one or more data characters, (optionally) one or two check characters, and a stop pattern. (ISource: TAL Technologies, Inc.)

Q: How does the barcode scanner (reader) work?

A: There are several types of scanners with different complexity, arrangement, and cost. A simple scanner (Figure 4), uses a red laser LED to illuminate the bars; as the scanner is moved manually across the bars, a photocell in the scanner reads the reflected light pattern and generates a stream of high and low signals (with dark/light level thresholds, of course).

How does the universal barcode work?
Fig 4: A modern hand-held barcode scanner contains a set of red laser LEDs and corresponding photosensors; it is lightweight and low power, senses the light reflections from the light/dark code lines, decodes those into barcode values, and then sends the resultant UPC number string to the system computer. (Source: www.explainthatstuff.com)

The dark/light pattern and timing (remember, this is a pulse-width bar-encoding scheme) is then decoded to a string of 1s and 0s, which is further decoded to determine the actual character, and the rest is fairly straightforward.

Q: What’s the next scanner type?

A: The laser scanner uses a LED laser beam as the light source and directs the light across the barcode using a moving mirror or a rotating prism to scan the laser beam back and forth across the barcode. Some systems use a lower-precision version of a more-complex mechanical arrangement called a mirror galvanometer (Reference 9) to direct the laser in one or two dimensions (depending on chosen type), so it can easily read any barcode in any orientation. More-advanced scanners use a CMOS imaging array to “see” the barcode as a two-dimensional image rather than just a scanned linear dark/light response, and then interpret this image. There are also scanners which steer the LED beam using MEMS-based devices such as the digital micromirror devices and digital light projection technology from Texas Instruments, Reference 16.

You can also now use a smartphone as a barcode “scanner.” An app in the phone takes a picture of the barcode, then uses image-analysis software to interpret the bar pattern (Figure 5). Note that regardless of whether you are using a dedicated scanner, a video capture unit, or a smartphone, the same scanner hardware can used for different barcode standards (and there are many now standards in use, as well as proprietary ones) since the scanner’s front-end function is to “see” the light and dark patterns, while the interpretation s an independent back-end function.

How does the universal barcode work?
Fig 5: A smartphone can also be used to scan and decode barcodes; it does this by taking a photo of the barcode area, and then uses image processing software to process the image and determine what the pattern represents. (Source: Scandit, Inc.)

Q: What are some of the virtues of the bar code?

A: In addition to its obvious benefits in supply-chain and retail management, the basic code itself costs nothing to add to a product if it is pre-printed (and add-on labels are cheap, too), and can be read by eye if it doesn’t scan properly, since the numbers are also printed under the bars. The cost of the scanning hardware is modest, and the return on investment for retailers (and others) was seen as very favorable soon after introduction.

Q: Do you have to use that standard encoding, or any of the dozen or so other standards now available?

A: It depends on the situation; for “external” use, yes. But nothing prevents a company or individual from setting up their own proprietary encoding scheme, barcode length, or printed field size, and there are many in use. Sometimes a standard code scheme and data set does not meet the needs, or perhaps there’s a need to prevent external access and insight. Some of the newer standards do allow the barcode to encode alphanumeric data (not just numbers), use longer fields, or barcode fields which are larger or smaller.

Q: Does the UPC barcode actually have the product name and information?

A: No, the barcode numeric (or alphanumeric) field) just an identifier of the vendor name and a product ID code. Once decoded, it is an entry to a table of stock-keeping units (SKUs). When the barcode is decoded, the vendor name and product number point to an entry in the database in the system computer, which then presents the information the system user needs to see, such a make, model, size, or price. Note that the UPC is “universal” and can be understood by any system designed for UPCs, as they are registered and listed, In contrast, an SKU is an internal number set up and used by the store, manufacture, or warehouse and can vary from site to site.

Q: It is standard In communication links to add a simple checksum of some sort as a basic way to ensure there are no errors, and sometimes a more complicated CRC (cyclic redundancy check), or even error detection and correction (ECC) scheme is used. What does the barcode system use?

A: For the standard 12-digit UPC retail coding, a simple checksum is used:

  1. First, add the digits in odd positions (digits 1, 3, 5, 7, 9 and 11).
  2. Multiply that number by 3.
  3. Add the digits in even positions (digits 2, 4, 6, 8 and 10).
  4. Add this sum to the value in step 2
  5. Take the number in Step 4, and then create a check digit by determining the number that, when added to the number in step 4, is a multiple of 10. So, if the number in step 4 is 106, then 106 + 4 = 110, and the check digit is 4. Add that to the end of the data field.

Q: What the error rate in scanning?

A: Answers vary, but the goal is not more than one scan error in millions of scans. Of course, this is separate from errors in matching the database or pricing; these are just scan-read errors.

Q: How are these UPCs assigned?

A: For retail items in commercial distribution (UPC in the US, or EAN in Europe), applications for a manufacturer number go through the Uniform Code Council; in Europe, it is EAN International in Belgium. The manufacturer pays an annual fee and the UCC issues the manufacturer a six-digit manufacturer identification number (for the newer 12-digit coding). The formal UPC symbol consists of both the machine-readable bar code and a printed, human-readable 12-digit UPC number underneath.

Q: How are the numbers physically encoded in the back bars/white spaces?

A: In the standard initial design of UPC coding), each digit is represented by a unique pattern of two bars and two spaces. The bars and spaces are variable-width modules and are 1, 2, 3, or 4 modules wide. The total width for a digit is always 7 modules; consequently, a 12-digit number requires a total of 7×12 = 84 modules. For more details (it gets complicated), Reference 8.

Q: Barcodes seem like a simple idea and scheme, so what did it take to make them happen?

A: Yes, it looks simple in hindsight, but was not. On the other hand, unlike some “lucky” or accidental developments or inventions, the barcode system is the result of a determined, highly focused project and effort driven not only by a presumption that it was something which retailers would want but by their tangible requests for a solution to a vexing problem. Part 2 will discuss this further.

References

  1. Photonics, “A History of the Laser“
  2. IEEE GlobalSpec Engineering 360, “Color TV: How One Man’s Obsession Produced a Technology Revolution“
  3. Explain That Stuff, “Barcodes and barcode scanners”
  4. The New York Times, “Who Made That Universal Product Code?”
  5. Simple Barcodes, “FAQs”
  6. Smithsonian, “The History of the Bar Code“
  7. ID History, “UPC History – ID History Museum”
  8. Wikipedia, “Universal Product Code”
  9. Laser Focus World, “Galvonometer Scanners: What you need to know to buy a galvo-positioner”
  10. Wasp Bar Code, “Barcode: The Ultimate Guide to Barcodes”
  11. How Stuff Works, “How UPC Bar Codes Work”
  12. Tal Technologies, “Barcode Basics”
  13. Barcodes, Inc., “Barcoding Frequently Asked Questions (FAQ)”
  14. TechSpirited, “Here’s How to Read Universal Product Code (UPC) Barcodes Easily”
  15. Washington University, “Bar code Encoding of Strings”
  16. Texas Instruments, “Overview for Display & Projection”

What is universal barcode?

A UPC, short for universal product code, is a type of code printed on retail product packaging to aid in identifying a particular item. It consists of two parts – the machine-readable barcode, which is a series of unique black bars, and the unique 12-digit number beneath it.

How does the barcode system work?

Barcode scanners work much like the human eye. They use light to decipher empty versus filled spaces on a barcode. This information is captured, then delivered into the processor. The processor converts it into a series of binary code that communicates with the software to relay what item it is representing.

How do you read a universal product code?

The 12-digit UPC code consists of three groups of numbers with different purposes. In a product UPC, the first 6 numbers indicate the manufacturer, the next 5 digits are the item number, and the final number is the check digit. The manufacturer's section of the UPC is technically called the UPC Company Prefix.