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?