img

Cognex Mobile Barcode Scanner SDK
UPC

What is UPC?

Universal Product Code (also called UPC-A and UPC-E) is likely the most recognizable barcode in North America, as it appears on all retail product packages. It is both a barcode symbology as well as a standardized numbering scheme for its use. Unlike many other more general barcode symbologies (e.g., Code 39, Code 128, Code 25) it was purpose-built for a specific datum: an 11-digit product code (and later, 6-digit, compressed product codes).

A brief history

As early as 1968, grocery stores in the US were looking for a faster and more accurate method for customer check-out. The National Association of Food Chains asked equipment manufacturers for barcode scanning solutions. In response to this, RCA implemented a bullseye-style barcode in a Cincinnati supermarket in 1969. In the early 1970’s the Uniform Grocery Product Code Council (an ad hoc committee formed by several grocery industry leaders) established guidelines and standards for product barcoding. The committee solicited seven different hardware manufacturers for barcode symbology and point-of-sale solutions. In 1973, the committee accepted the UPC symbology from IBM with minor modifications. George Laurer, a Senior Engineer at IBM, is credited with the symbology’s invention. By 1976, the European market had also adopted a product barcode symbology, EAN, which is a superset of UPC.

Symbology

There are two generally used symbologies: UPC-A and UPC-E. Both are numeric-only, fixed-length symbologies. A UPC-A is 12 digits long (11 data and a check digit) while UPC-E is 6 digits long. UPC is a linear, one-dimensional (1D) barcode. This means the barcode is composed of a single set of varying-width vertical lines (black) and spaces (white). Below is a simple example of both UPC-A and UPC-E barcodes:

 

pages_UPC-A_example.pngpages_UPC-E_example.png

 

Both symbologies are further characterized as continuous; that is, there is no inter-character space between adjacent characters. The space between characters is part of the data representation. Each data character is represented by a unique pattern of two bars and two spaces, with bars/spaces being one, two, three, or four modules wide. Each data character is a total of seven modules.

UPC-A uses a start pattern, a stop pattern, as well as a middle (guard) pattern. UPC-E uses only start and stop patterns. UPC-A includes a single-digit check digit. Here is the UPC-A code from above, diagramed for clarity (the UPC-E code is discussed below in detail):

 

UPC-A_diagramed

 

Parity

It is worth noting that the symbology uses a parity scheme for its data characters. This means that depending on where a digit appears in the symbol (on either the left or the right side of the middle guard), the pattern used to represent the digit will have either odd parity or even parity. Odd parity means that the total width (in modules) of the black bars used for the digit is odd, while even parity means the total width of the black bars is even. This means every digit (0-9) has two bar/space patterns: one with odd parity, and the other with even parity. From the example above, we’ve highlighted the 5 digits: one appears on the left of the symbol (odd parity) while the other appears on the right (even parity). Note that the bar/space patterns are different, even though it’s the same digit (5):

 

pages_UPC-A_parity.png

 

 

This parity method helps to determine the direction in which the barcode is being scanned as well as to detect “print” and “scan” errors. The UPC-E symbology further uses specific combinations of odd/even parity to represent additional data (discussed later).

Numbering

As mentioned above, UPC is more than just a barcode symbology; the standard also defines the structure and control of the product number within the barcode. All codes are 12 numeric digits, with the following general structure:

NMMMMMPPPPPC

where:

N is the numbering system used in the code; also called the version

MMMMM is a 5-digit manufacturer code

PPPPP is the 5-digit product code

C is the check digit

The structure and use of MMMMM and PPPPP change based on the designated numbering system. Here is a quick summary of numbering schemes

 

Numbering

Scheme(s)

Description

0, 1, 6, 7 and 8

Used for most products, MMMMM is the GS1-assigned manufacturer code, and PPPPP is the code assigned by the manufacturer to the product.

2

Used for local store items that are sold by variable weight (e.g., meat at the deli counter). MMMMM is the item number assigned by the store and PPPPP is either the weight or price (the first digit of PPPPP typically indicates which).

3

Indicates a National Drug Code, a unique identifier assigned by the FDA for drugs intended for human use. The NDC is a 10-digit code consisting of its own structure consisting of a product vendor (labeler code), dosage/formulation indicator (product code), and package size information (package code).

4

Reserved for local store use; typically for loyalty programs/cards and store coupons.

5, 9

Used for manufacturer coupons. Like product codes, MMMMM is the GS1 assigned manufacturer code, while PPPPP indicates the coupon: the first 3 digits are a family code (used to verify the consumer has purchased the couponed product) and the last 2 digits are the value code (a standard discount code, defined by GS1).

 

Manufacturer codes are issued by GS1 US (formerly the Uniform Code Council, or UCC).

UPC-E

UPC-E (also known as zero-suppressed UPC) is a special 8-digit UPC code used primarily for small package labeling where a full UPC-A may not fit (e.g. a pack of gum). UPC-E works by “suppressing” zeros within the UPC number. This means though that not all UPC-A numbers can be represented as UPC-E. When a UPC-E is scanned, it is typically expanded into its full 12-digit UPC code by the point of sale (POS) system.

The means by which a UPC-A is converted to a UPC-E are as follows:

  1. If the manufacturer code ends in 000, 100, or 200, the UPC-E code consists of the first two characters of the manufacturer code, the last three characters of the product code, followed by the third character of the manufacturer code. The product code must be 00000 to 00999.
  2. If the manufacturer code ends in 00 but does not qualify for #1 above, the UPC-E code consists of the first three characters of the manufacturer code, the last two characters of the product code, followed by the digit "3". The product code must be 00000 to 00099.
  3. If the manufacturer code ends in 0 but does not qualify for #1 or #2 above, the UPC-E code consists of the first four characters of the manufacturer code, the last character of the product code, followed by the digit "4". The product code must be 00000 to 00009.
  4. If the manufacturer code does not end in zero, the UPC-E code consists of the entire manufacturer code and the last digit of the product code. Note that the last digit of the product code must be in the range of 5 through 9 (since 0-4 are used to indicate a manufacturing code from 1-3 above). The product code must be 00005 to 00009.

Additionally, UPC-E only works for codes using numbering systems 0 and 1.

The sample UPC-A used in this discussion was chosen specifically to demonstrate how it could be converted to UPC-E. The number for the UPC-A code is 012345000058; the numbering scheme is 0, the manufacturer code is 12345, and the product code is 00005. This code satisfies rule 4 above; thus 123455 would be encoded in the UPC-E barcode.

UPC-E uses the same start pattern (guard) as UPC-E, but a different stop pattern (UPC-A’s middle guard and end guard combined). UPC-E does not compute its own check digit; the check digit for the corresponding UPC-A is used.

 

pages_UPC-E_diagramed.png

 

Notice that the UPC-E symbol does not explicitly store the number system and check digits as data characters. Rather, this information is represented by the parity of data characters used. Unlike UPC-A which uses odd parity for the left-hand characters and even parity for the right-hand digits, the parity used for each character is based on the number system and check digit.

Who uses UPC?

UPC is used on millions of consumer products around the world, though primarily in North America, the United Kingdom, Australia, and New Zealand. Virtually every retail outlet in these counties uses it to scan and price products at checkout.

The explosive growth of mobile devices and applications has led to many additional, consumer-facing uses of them as well:

  • Comparative shopping
  • Product reviews
  • Detailed product and manufacturer information
  • Competitive product recommendations
  • Safety and recall information
  • Detailed ingredient lists
  • Allergen information
  • And many more!

How do we help developers using UPC?

The Cognex Mobile Barcode Scanner SDK supports UPC detection, enabling developers to gather relevant workflow and application data into their own barcode-scanning apps. You can download the SDK for free by registering on the Cognex Mobile Barcode Developer Network. In addition, the Barcode Scanner SDK supports a broad range of symbologies to meet your growing development needs. Packaged with the consumer product barcodes of EAN, GS1 Databar, PDF417, and QR Code, the SDK Consumer Developer License (CDL) lets you deliver a powerful retail experience quickly and easily.

Get Started