Quick Response (QR) Codes

Introduction

What are QR Codes?

QR codes are black and white square codes that encode data in a 2 dimensional grid. They can be scanned by dedicated QR code scanners or by smartphone cameras.

Why do we need them?

1 dimensional barcodes have a big problem – They can only encode a limited amount of data (usually 10 digits).

This means that they:

  • The amount of data encoded is limited to 10 to 20 digits
  • Can only be used to encode numerical data.
  • Only large manufactures can use them as the first 5 digits are for the manufacturer code.

QR codes can around this problem by encoding the data in two dimensions and allowing the encoding of characters as well as numbers.

This allows far more data to be stored in a single QR code, meaning that:

  • Data other than product codes can be stored (such as URLs)
  • Individual items can be tracked, rather than just product types.
  • You don’t need to be a manufacturer, anyone can used them.

How QR Codes Work

How QR Codes Work

QR codes work by storing data digitally in a grid of black and white dots.  QR codes need to be read quickly and accurately, in multiple lighting conditions, even if scanned upside down and from different distances. This means that they need to include more than just the data being stored in order work effectively.

Source: Wikipedia

 

The position and alignment components are needed to ensure that the QR code can be read even if presented upside down, or at angle.

The timing information is required because QR codes can store different amounts of information and therefore the reader needs to know how much information is being stored.

Dog

The quick brown fox jumped over the lazy dog.

QR Codes include Solomon-Reed error correction data so that the code can be read even if some of the data is obscured.

 

How QR Code Scanners Work

How QR Code Scanners Work

Step 1 – The Code is illuminated.

The first step in the process is where the QR code is illuminated. On some devices this is done using an infrared light, however if you are scanning a QR code using your smartphone then it may use the in-built flash, or simply rely on ambient light.

Step 2 – The light hits the image and then bounces back

The emitted light hits the image, with the darker parts of the image absorbing more light. The light the bounces back.

Step 3 – The returning light hits the lens in the scanner and is focused onto the surface of a Charge Coupled Device

The returning light arrives at the scanner lens where the light is focused onto a CCD. The CCD is a 2 dimensional array of millions of photo sensitive cells. Each cell varies the electrical signals that it outputs depending on the amount of light that hits the cell.

Step 4 – The electrical signals are converted to digital by the ADC

The electrical signals from the cells are passed onto an Analogue to Digital Convertor, which convert the signal into digital form.

Step 5 – The scanner combines the digital data into an image

The digital signals are combined into a matrix of digital values, creating a digital version of the QR code.

Step 6 – The image is processed by the scanner

The scanner now processes the image, using image recognition and manipulation software. This is the stage where the position and alignment data is used.

This includes:

  • Rotating the QR code so that it is the correct way up
  • Warping the image so that any distortion is removed
  • Altering the contrast and exposure of the image so that it can be decoded.

Step 7 – The data is read from the QR code

Now the data can be read from the QR code, line by line in a zig-zag manner, until all the data is read. Once read the error detection and correction algorithms are applied.

This stage is where the version, format and  timing data are used.

Step 8 – The data is used by the device / software

Finally software on the device processes the QR code data as required (such as opening up an URL in a web browsers if opening a QR code on your phone).

 

Quiz

 

 

Resources