justride paper barcode ticket with barcode

Connecting the Dots: An Introduction to 2D Barcodes

As the growth of sophisticated mobile devices becomes ever more pronounced in modern society, barcodes have emerged as a channel through which these devices communicate and relay information for us. While conventional 1D barcodes have existed on everyday consumer items for some time, we are now see 2D barcodes as a common feature of the world around us. You can now see them on movie posters, pay for your coffee with them, or even use them as a train ticket. Therefore, in order to make the most use of this new technology, a basic understanding is very advantageous.

A Brief History of Barcodes

Barcodes, in their 1D format, were first developed in the rail industry to label railroad cars for automated tracking. They achieved commercial success in the 1990s, when they were adapted to be used on consumer goods such as supermarket food items. Since then, their influence has spread to encompass virtually any identification system that can be processed by a machine.

A common 1D barcode known as EAN-13

How Do Barcodes Work?

In simple terms, barcodes are a visual language that is recognised by computers. In other words, a scanner reading a barcode is like a person reading a sentence. Since computers process binary data, every line or pixel in a barcode represents a 1 or a 0. After scanning, the lines or pixels are ‘translated’ by the computer into binary data, a series of 1s and 0s.

Crucially, all barcodes contain an error detection system (the check sum in the image above). This ensures that a barcode will be rejected if it cannot be read correctly (e.g. due to damage or tampering). It works like this: after scanning the code, the reader performs a simple check sum (mathematical calculation) over the 1s and 0s of the message, and compares this value to the check sum within the barcode itself (which was calculated before the barcode was generated) – if they do not match, the scan is rejected because some of the 1s and 0s in the message must have been changed.

The Leap to 2D

2D barcodes, which are now prevalent in our day-to-day lives, are a more sophisticated evolution of their 1D variant. Whereas information on a 1D barcode is stored and read horizontally only, 2D barcodes store information both vertically and horizontally. The lines of a 1D barcode thus become dots, or pixels, in 2D. Consequently, 2D barcodes are able to store much more data and communicate much more complicated tasks within a smaller physical area, though obviously they require enhanced scanning equipment.

The numbers 1234567890 encoded into EAN-13 and Aztec formats; red lines indicate scanning axes

Barcode Symbologies

There may not appear to be much of a difference between any two barcodes, other than cosmetic, but there are actually hundreds of types, and they each require a specific symbology to be able to decode them. These different types are each developed to suit a specific role or industry.

Each barcode symbology comes with a specification, which is a technical document that explains how that barcode pattern is displayed, how it functions, and how it must be printed in order to be properly decoded.

Barcode readers in different forms. They can also be mobile phone cameras or embedded in large machines e.g. ticket gates at stations

What is a Symbology?

To extend our analogy of a machine language, a barcode symbology can be seen as a language ‘dictionary’ for a specific type of barcode. It tells a reader (which can be either a laser scanner or a digital camera) how to read the barcode, and decode the squares into data. Common types of 2D barcodes include Aztec, Data Matrix and QR Code. While they all look similar in appearance, each one is encoded in a different ‘language’.

So, for example, just as we can read this sentence in English, a scanner installed with the QR symbology can read a 2D barcode encoded with the QR symbology. However, without the appropriate symbology, the scanner would not be able to decode a Data Matrix barcode, just as we would not understand this sentence if it were written in, say, Swahili: we would recognise the letters, but not be able to extract any meaningful information from the sequence in which they are placed in the words or sentence.

Error Correction

Just as in 1D barcodes, each 2D symbology includes error detection. More importantly though, 2D symbologies also contain error correction measures to make sure that a barcode can still be read and all its information captured, even if an error is detected. Human brains have similar error correction, for example if you cover up the bottom half of all the letters in a sentence you can still read the words without too much trouble. The barcode provides enough redundant information and mathematical encoding to reconstruct the original information even with significant chunks missing.

E.g. Like the words above, a damaged barcode can still be read perfectly well

Proprietary and Non-Proprietary Symbologies

So, in summary, to be able to scan a barcode, we must have the symbology in which it is encoded, and as we have said, there are many different types. These types can be sorted into two categories:

  1. Non-proprietary – the symbologies of these barcodes are public domain, and so are freely available to anyone. They are also regulated by various organisations to ensure they have a standardised specification and are suitable for commercial use. QR, Aztec and Data Matrix are all examples of non-proprietary barcodes

    Examples of non-proprietary barcodes all containing the same information (the text from http://www.masabi.com/passengers/the-future/)

  2. Proprietary – these symbologies are privately owned and developed, so they can only be decoded by software that is owned or licensed by the company that owns the symbology. These are usually developed by companies to suit a specific purpose.

The Rise of the QR Code

The QR barcode was first used commercially in Japan in 2002 by the mobile phone manufacturer DoCoMo. Since they controlled the vast majority of the handset market, they were able to introduce QR barcode scanning support on all of their handsets, and QR barcode use expanded very quickly.

A typical user experience would be to take a picture of a barcode on a movie poster, and then the encoded data tells the phone to take you to the movie’s website. Now that the technology has come to the West, this currently seems to be the sum of most people’s experiences with 2D barcodes, and consequently, we as consumers are only aware of half of the 2D barcode’s true value.

QR vs. Aztec

The essential difference between the more common QR code and Aztec is that QR codes are better for being read by consumers’ phones. Aztec, however, is better for being displayed on consumers’ phones – essential for high-speed scanning in a busy transport environment.

Aztec barcode train tickets on small, medium and large screen devices

Although QR and Aztec codes can both support text or binary data, at different sizes, it’s how the scanner understands how to read each symbology that makes them different. The most noticeable aspect of this is the positioning of the finder pattern – the squares that allow the scanner to find and orient the barcode, adjusting for any skew, scaling or rotation and interpreting the pixels accordingly.

For QR, the reader needs to see all four corners of the barcode because the finder pattern squares are placed in three corners.

Additionally, QR (and Data Matrix) barcodes need a quiet zone – an area of white around them to distinguish them from their surroundings – so that the scanner can clearly read the finder pattern in the corners.

The red arrows indicate the finder pattern squares, which are always in the same three corners

For Aztec, however, the finder pattern squares are placed in the centre, which means that the scanner only needs to see the centre of the barcode clearly to orient it. This is because the user might misalign the corners of the barcode when turning the screen away from them and towards a reader. As a result, all the user needs to do is put the phone screen roughly in the centre of the reader to scan the barcode. This gives Aztec faster scan times with fewer problems, making it ideal for mass-market use as a mobile ticket.

Moreover, because the finder pattern is in the centre, Aztec barcodes do not need a quiet zone. This means that even on phones with a small screen (where the barcode fills the entire screen), Aztec barcodes can be displayed and scanned properly.

Even surrounded by a colour that may confuse a reader (e.g. the black frame of a phone), the barcode can still be read

Dynamic Barcodes for Transport Ticketing

Barcode use for transport ticketing has exploded around the globe over the last few years. Why? Because barcodes work across all smartphones without any technical set up issues. In fact, all the mobile tickets Masabi issues contain encrypted (secure) and dynamic barcodes. A dynamic barcode means the actual barcode changes every few seconds. This is important as it means the ticket (barcode) cant be copied by someone else and used in a fraudulent manor.

For more information see our blog: Mobile Ticketing: Why Barcode?

Conclusion

In conclusion, we can now say that barcodes are not simply a series of bars or dots, but are a complicated and diverse set of machine languages, many with specific uses and some that suit more general purposes. They are a visual, encoded representation of binary data that can be read by computers and translated into code or text, and include built-in measures for error detection – and in the case of 2D, error correction – to safeguard against damage, tampering or improper scanning.

We can classify them according to dimension (i.e. 1D or 2D), their symbology and whether they are proprietary or non-proprietary. Masabi are currently working with Aztec barcodes to bring transport tickets to your mobile phone.

All the barcodes for this blog were all made using barcode-generator.org .Try making your own!

Any questions? Get in touch: Contact@masabi.com or visit www.masabi.com