Appliances

Appliance Science: The secret life of bar codes

How does a series of black and white stripes identify a product out of the thousands on sale at the grocery store? Appliance Science looks into the secrets of the bar code.

Some technologies you use every day, but without thinking about them. The bar code is one of these: everything you buy has one of these black and white striped codes on it. We've all seen how they are used: the cashier scans the code and the details and price pop up on the screen. The bar code identifies one product of the millions that are on sale at any one time. How does it do that? Let's find out.

The bar code

The bar code itself is very simple: a series of black and white stripes of varying width. These are scanned by a bar code reader. Here, a rapidly moving laser passes over the code, and a sensor detects the reflection, picking up the alternating pattern of light and dark. A computer translates the differences between the widths of the patterns into numbers. One pattern is translated into a 0, another into a 1, another into a 2 and so on. You don't have to have a laser to read a bar code, though. There are plenty of apps that can find a bar code in a picture taken with the onboard camera.

barcode-2.png

A typical UPC-A type bar code

The type of bar code used on products is known as a linear code, because you read it from left to right in a straight line. There are many other types that work differently and that can encode more data, from the QR codes that often contain website addresses to more arcane types such as the Maxicode that UPS uses to store the delivery address on package labels. These aren't used on products you buy in a store, though, because all the bar code needs to contain for a product sold in the US is a single 12-digit number, called the Universal Product Code (UPC).

The structure of the bar code on things that you buy at the store is based on the UPC-A standard UPC code, This is 12 digits long, but there is a version that shortens this down to seven digits (called the UPC-E standard) by removing some of the data. This makes the bar code smaller, which is useful for smaller products like candy bars or chewing gum.

The number

The UPC of a product contains several chunks of information. Firstly, there is a single number that represents the type of code we are dealing with (called the numbering type). For products made in the US, this will usually be a zero. Next is the manufacturer code, a unique code that identifies the company or division of a company that produced the product. Look at two products produced by the same company, and you will often see the first few digits of the bar code are the same. That's the manufacturer code.

Next is the item reference, another code that identifies the individual product itself. Every product has its own code, including different sizes of the same thing. So, a large box of pasta will have a different code to a small one. The final number is a check digit, which is created by doing a simple calculation on the first 11 digits. When the bar code is scanned, the reader performs this simple calculation to verify the scan: if it gets a different result than the check digit, something has been scanned wrongly and it throws up an error.

UPC codes are coordinated by an international standards organization called GS1. This organization has local members in many countries, each of which assigns numbers to companies and products in that country. In the USA, for instance, GS1 US assigns UPC codes. By assigning a range of numbers to each of these member groups, which then each assign numbers from this range to individual companies and products, every product can have a unique bar code. This means that you can make a product in one country, then sell it in another and the bar code should still work.

Well, that's the theory. Some countries created their own bar code systems (such as Japan), but most have been incorporated into this international system in clever ways that make them compatible.

Examples

barcode1.jpg

Richard Baguley/CNET

So, let's look at our first bar code, scanned off a product in my fridge. I used this free bar code scanner on my Android phone, but iPhone users can use this free app. Alternatively, you can just read the number off the bottom of the bar code: 01346604. This has eight digits, so it is a UPC-E bar code. These reduce the number of digits by removing superfluous zeros. So, a scanner in the supermarket will take the code 01346604 and expand it to the full UPC code is 0134000046604. Searching for this on a UPC search site shows that this is a 38-oz. bottle of tomato ketchup (product code 466), made by Heinz, who have the manufacturer code 013. Perfect for putting on fries.

ketchup.jpg

Richard Baguley/CNET
barcode2.jpg

Richard Baguley/CNET

Our next bar code is a bit more complex, though. This is another product from my fridge, which I bought from a local store. The full number from the bar code is 667803001957. That makes it unusual: most UPC codes on products on sale in the USA start with 0. There's nothing wrong with that, though: a UPC code can begin with 0,1,6,7 or 8, so it is still a valid UPC code. If the number begins with anything other than these digits, it is probably something other than a UPC, such as a coupon (which usually begins with a 2). So, if we use a more sophisticated UPC search system, we can find that the code was issued in the UK, to the manufacturer Unilever Ltd (manufacturer code 667803), for a 4.4-oz. jar of Marmite (product code 195).

This demonstrates the power of bar codes: I bought this jar in a branch of the US retailer Whole Foods. Even though it was manufactured in the UK and shipped over, the retailer could still identify it and sell it without having to apply a new bar code or yell across the store for a price on this curious foreign food. As a citizen of the UK living in the US, I am very glad that they can do so, as I adore this particular spread, and it being on sale in the US means I don't have to hide it in my luggage every time I return to the US.

marmite.jpg

Richard Baguley/CNET

That's the power of systems like bar codes: they allow a manufacturer anywhere in the world to sell its product in other countries without having to worry about acquiring new codes. Once it has applied for a UPC code, the product you put it on can travel the world and still be identified and sold.