QR codes and 2D barcodes
by Chris Woodford. Last updated: June 30, 2014.
From buying groceries to tracking a UPS delivery, barcodes make our lives easier in all kinds of ways—but they've been doing so now for decades. Originally patented in the 1940s, barcodes were commercially tested in the 1960s and gradually became ubiquitous in the 1980s. The basic idea has barely changed in all that time: just like in the 1960s, a barcode is still a zebra pattern of stripes with numbers written underneath that needs a special scanning device to decode it. But all that could change soon as the 2D barcode—a kind of second-generation barcode technology—slowly takes over. Let's take a closer look at how it works!
Photo: Do-it-yourself postal systems, such as Royal Mail's SmartStamp® (in the UK) and Deutsche Post's Stampit (in Germany), let you print your own franking labels on parcels without the bother of going to a post office. They print a 2D barcode on the postage label to validate it and protect against fraud. The code is read and checked when the mail passes through automated sorting equipment. This is an example of a data-matrix code made from four separate segments.
What are 2D barcodes?
You might have already noticed odd black-and-white squares appearing on your parcels, letters, utility bills, T-shirts, product packaging, and in all kinds of other places— a bit like mini crossword puzzles without any letters. They're called two-dimensional (2D) barcodes and, just like ordinary barcodes, they're machine-readable so they can quickly pass on information about a product in the blink of an electronic eye. Where a barcode presents a string of information as a one-dimensional line of black and white bars, a 2D barcode packs a lot more information into a grid of black and white, square-shaped dots.
Photo: It's a great idea to turn your website address (URL) into a QR Code® and put it on all your promotional material—from advertisments and leaflets to T-shirts and delivery vans. Here's a QR Code being used to good effect on a promotional leaflet from the Swanage Railway. If I want to find out more, all I have to do is point my cellphone at the leaflet and click. Be careful how you print the code: although there's some tolerance for bad printing, it still needs to be printed reasonably clearly and accurately or it won't work. So crisp laser printing is fine, but smudgy inkjet prints probably aren't. Always test the final, printed code with a QR Code reader to make sure it takes you where it should!
What are the advantages of 2D barcodes?
If we already have barcodes, why do need something else as well? 2D barcodes are a step further, with lots of advantages:
- More information: A barcode is just a short line of black and white bars so it can't contain much information: typically just a dozen digits or so—enough to identify a box of cornflakes to a grocery store checkout, but not much more. You can't add extra information to a barcode without making it longer and more unwieldy. By contrast, a 2D barcode is a square of information running in two directions so it can efficiently pack more information into the same space. A typical 2D barcode can represent up to about 2000 characters of information.
- Fewer errors: Barcodes hold so little information that there is very little redundancy. Apart from the length of the bars (which effectively repeat the barcode's information in the vertical direction), there is no duplication of information to guard against a code being misprinted or damaged (such as when a grocery box becomes torn in the store or a parcel label smudges in the rain). But the higher capacity of 2D barcodes means they can hold the same information in different ways with sophisticated, built-in error checking systems. If a code is damaged, that's easy to detect—and it may still be possible to read some or all of the code.
- Easier to read: 2D barcodes can be read by the latest cellphones (mobile phones) using their built-in digital cameras. No special reading equipment is needed. Even though they contain more information, they can be read accurately at high speeds.
- Easy to transmit: 2D barcodes can be sent as SMS text messages between cellphones.
- More secure: It's possible to encrypt the information in 2D barcodes to protect it.
What are the different kinds of 2D barcode technology?
To an untrained eye, 2D barcodes all look much the same. Look more closely, though, and you'll see they do vary quite a bit. There are actually several different types of 2D barcode, some available in the public domain and some that are still proprietary. The best known include QR Code® (pioneered in the 1990s by Japanese company Denso-Wave), Aztec code (developed by Welch Allyn and recognizable by a distinctive square "bulls-eye" pattern in the center), MaxiCode (used by the US postal service, and featuring a round "bulls-eye" center), and Semacode—though there are literally dozens of others. Data-matrix code is the name of the international (ISO) standards covering 2D barcodes, but not all 2D barcodes comply with them (Semacode does; QR codes and Aztec codes are slightly different).
Photo: Two examples of 2D barcodes: A QR Code on the left and an Aztec code on the right. Both contain the address of this website (www.explainthatstuff.com), but look how very different they are: there are many different ways of encoding the same basic informatin in a 2D data matrix pattern.