2-D bar codes can hold mountains of information, compared to their low-tech 1-D predecessors.

HowStuffWorks.com

adAfterSmallInset

Introduction to How 2-D Bar Codes Work

In the summer of 1974 at a grocery store in Troy, Ohio, an event first took place that would forever change the way we purchase things: A clerk scanned the UPC code on a pack of Wrigley's gum [source: Collins]. UPC codes exploded in popularity after hitting the market, and today you can find them on practically every product on the shelves. Like all bar codes, UPC codes bridged the physical and digital worlds, providing anyone with a bar code scanner instantaneous access to the data that a bar code contains.

Like all of the first bar code formats, UPC codes were 1-D, meaning they only carried information in one direction. One-dimensional codes worked fine for carrying small amounts of data like numeric product codes, but as the digital world became more complex, the need for a bar code capable of carrying more data became apparent.

One solution still used today is the stacked bar code, which, as the name implies, contain a number of 1-D codes piled one on top of another. Although stacked bar codes can accommodate more information than their traditional 1-D counterparts, they can quickly grow very large in order to store more data and can be difficult to read. In order to have a bar code that was small in size, easy to read and capable of holding both a large amount of data and a large variety of character types, the market called for a new approach. Enter 2-D bar codes.

As you might have guessed, 2-D bar codes (sometimes called matrix codes) carry information in two directions: vertically and horizontally. Accordingly, 2-D bar codes are capable of holding tens and even hundreds of times as much information as 1-D bar codes. For instance, one of the most popular 2-D bar code formats, Denso Wave's QR Code, can hold more than 7,000 digits or 4,000 characters of text, whereas even the most complex 1-D codes top out around 20 characters. 2-D bar codes are also small and easy to scan.

Still, 2-D codes aren't perfect for every application. Because they're more complex than 1-D codes, they require more powerful scanners to decode. What's more, many people are simply unfamiliar with the technology, which hinders widespread adoption. But thanks to the smartphone in your pocket, that may all be about to change. Read on to find out why.

Diagram of a 2-D bar code

HowStuffWorks.com

adAfterSmallInset

2-D Bar Code Generators and Scanners

When the now ubiquitous UPC code first started making waves in the 1970s, retailers everywhere recognized the potential immediately. Unfortunately, the technology faced something of a Catch-22. Retailers refused to buy the expensive scanners needed to read the codes until manufacturers began putting UPC codes on all of their products, and manufacturers stonewalled on adopting them until they knew retailers could read the codes [source:Rawsthorne]. Eventually, large retailers like Kmart jumped in to kick-start the technology.

Fortunately for proponents of 2-D bar codes, we buy millions of scanners every year in the form of our smartphones. Common models like the iPhone, BlackBerry and Android all have the capability to read the most popular 2-D bar code formats, helping to clear perhaps the largest hurdle to their widespread adoption. But how does a smartphone -- or any bar code scanner, for that matter -- actually make sense of the seemingly unintelligible patterns of lines and squares that 2-D bar codes contain? Part of the answer lies in the design of the bar code itself, which is created from the ground up to make the scanning process as accurate and speedy as possible.

Let's check out of one of the most widespread types of 2-D bar codes, QR Codes, to see how its design helps bar code scanners read the data it contains. For starters, every QR Code contains a finder pattern, an arrangement of squares that help the scanner detect the size of the QR Code, the direction it's facing and even the angle at which the code is being scanned. Next, every QR Code contains an alignment pattern, another pattern of squares devised to help scanners determine if the 2-D bar code is distorted (perhaps it's placed on a round surface, for instance). QR Codes also have margins for error, meaning that even if part of the code is smudged or obscured, the code can often still be scanned.

But even a perfectly designed bar code would be nothing without sophisticated software capable of recognizing the bar code's alignment patterns and decoding the data. For instance, the scanning software used to read QR Codes has some pretty impressive capabilities. Once the  smartphone's camera processes the code's image, the software goes to work analyzing the image. By calculating the ratio between the black and white areas of the code, it can quickly identify which squares are part of the alignment patterns and which squares contain actual data. Using the QR Code's built-in patterns and error correction, the software can also compensate for any distortion or obscured areas of the bar code. After the software has digitally "reconstructed" the QR Code, it examines the jumble of black and white squares in the QR Code's data section and outputs the data contained within.

Of course, QR Code is only one example of a 2-D bar code. For instance, the shipping company UPS uses a format called MaxiCode, which can be scanned very quickly as packages fly down the conveyor belt, whereas the U.S. Department of Defense has adopted DataMatrix, a 2-D bar code format capable of holding a lot of information in a very small area. Regardless of the format, 2-D bar codes contain both data and built-in patterns to help the scanner decode the information each bar code contains, and in many cases, one device can read a variety of different formats, even traditional 1-D bar codes.

If you want to create your own, you'll find several great 2-D bar code generators online. They let you adjust everything from the format you want to use to the size of the code, so the next time you're putting up a flyer for your local garage sale, consider adding a 2-D bar code with your home address at the bottom. Who knows how many smartphone-carrying bargain hunters you might attract?

Crop Circles to Crop Bar Codes?

For years, people wondered if the mysterious crop circles popping up all over the world were the work of mischievous extraterrestrials, but we can be certain the 160-square-meter (1,700-square-foot) pattern that appeared in a wheat field in 2007 was the work of an earthling named Ben Hopfeng-Aertner. Hopfeng-Aertner, a German programmer interested in 2-D bar  code symbology, spent several months stamping out a 2-D bar code into the wheat field that, when finished, was large enough to be read from space. So what did the code say? "Hello, World!" of course.

2-D Bar Code Advertising

If you can think of a way to sell a product, it's probably been done: blimps with giant company logos, televisions streaming ads to the backseats of taxicabs and even advertisements printed in edible ink on food. Nothing is off-limits from advertisers. But even they have long faced a difficult challenge as they try to determine how effective their physical ads really are; regardless of the medium, they can only guess how many people end up buying products or learning more about their company because of a particular ad. That all changed with 2-D bar codes. For the first time, companies could simply add a 2-D bar code to their advertisement and directly track how many times consumers scanned the code. If someone did scan it, the advertisers could then track whether that person went on to visit the company's Web site or even purchase a particular product.

Putting the technology to use, the fashion company Tommy Bahama added a 2-D bar code into Esquire Magazine that, when scanned, took readers directly to a Web page featuring the pair of sunglasses shown in the magazine ad. With one click of their mouse (or smartphone), readers could then buy the sunglasses for a cool $138 a pop. Not only did the codes help Tommy Bahama sell a lot of sunglasses, they also helped the company learn more about their customers, telling the company what time of day and part of the country an ad was scanned.

Target is another company exploring the capabilities of 2-D bar codes, adding QR codes to its magazine advertisements. Curious readers can scan the codes and instantly watch a video from a famous interior designer explaining how to use the product in the home. Advertisers say this level of interactivity is perfect for a new generation of tech-savvy consumers who want instantaneous access to product information, reviews and more. In fact, the codes have become such a popular way to advertise in Japan that they're even found on billboards, where they can be scanned at highway speeds from a passing car.

Currently, the codes aren't as popular in the United States as they are in Japan, so data on just how many advertisers are using them and what sort of results they've been getting is hard to come by. Still, as more people purchase smartphones and learn about the capabilities of QR Codes, 2-D bar codes may take off much like their 1-D predecessors.

Lots More Information

Related ArticlesSources
  • Collins, Nick. "Bar code: invention history behind new Google doodle." The Telegraph. March 20, 2011. (March 18, 2011) http://www.telegraph.co.uk/technology/google/6268827/Bar-code-invention-history-behind-new-Google-doodle.html
  • Denso Wave. "About 2D Code." (March 18, 2011) http://www.denso-wave.com/qrcode/aboutqr-e.html
  • Denso Wave. "What is a bar code?" (March 18, 2011) http://www.denso-wave.com/en/adcd/fundamental/barcode/index.html
  • Harnick, Chris. "Esquire uses 2D bar codes within magazine for mobile commerce." Mobile Commerce Daily. Feb. 4, 2010. (March 18, 2011) http://www.mobilecommercedaily.com/2010/02/04/esquire-uses-2d-bar-codes-within-magazine-for-mobile-commerce
  • Haselton, Todd. "German man programs 'Hello World' into wheat field." Ars Technica. June 11, 2007. (March 18, 2011) http://arstechnica.com/gaming/news/2007/06/german-programmer-programs-hello-world-into-wheat-field.ars
  • Kats, Rimma. "Tommy Bahama print ad sells sunglasses via click-to-buy QR Code." Mobile Commerce Daily. Sept. 27, 2010. (March 18, 2011) http://www.mobilemarketer.com/cms/news/advertising/9191.html
  • Mobile Marketer. "Target implements QR codes in print ads to engage readers." Feb. 25, 2011. (March 18, 2011) http://www.mobilemarketer.com/cms/news/advertising/9191.html
  • QRMe. "Understanding a QR Code." (March 18, 2011)http://www.qrme.co.uk/qr-code-resources/understanding-a-qr-code.html
  • QRMe. "QR Codes Explained." (March 18, 2011) http://www.qrme.co.uk/qr-codes-explained.html
  • QR Code. "QR Code Standardization." (March 18, 2011)http://www.qrcode.com/qrstandard-e.html
  • Rawsthorne, Alice. "Scan Artists." The New York Times. Feb. 23, 2010. (March 18, 2011) http://www.nytimes.com/2010/02/28/t-magazine/womens-fashion/28talk-rawsthorn.html
  • Schonfeld, Erick. "See That Funny 2D Barcode In The Store Window? It Might Pull Up A Google Listing." TechCrunch. Dec. 6, 2009. (March 18, 2011) http://techcrunch.com/2009/12/06/google-local-maps-qr-code/
  • Story, Louise. "New Bar Codes Can Talk With Your Cellphone." The New York Times. April 1, 2007. (March 18, 2011) http://www.nytimes.com/2007/04/01/business/01code.html?_r=2
  • Synthesis Journal. "QR Code." 2008. (March 18, 2011) http://qrbcn.com/imatgesbloc/Three_QR_Code.pdf