QR codes (QR Code or Quick Response Code) are a type of 2-dimensional code (one matrix) that was developed in Japan in 1994 by Denso Wave for the automotive industry. The main idea was to have a code capable of emmagating more information than a conventional bar code and that, at the same time, it could be printed in small spaces (for example, a piece of the engine) without making it difficult to interpret.
QR codes (QR Code or Quick Response Code) are a type of 2-dimensional code (one matrix) that was developed in Japan in 1994 by Denso Wave for the automotive industry. The main idea was to have a code capable of storing more information than a conventional barcode and, at the same time, that could be printed in small spaces (for example, a piece of the engine) without making it difficult to interpret.
Some of the uses that are currently being given to QR codes are the coding of:
- Text
- URL
- Phone
- SMS message
- Contact details (vCard or MECARD)
- GPS Position
- Calendar event
- Electronic running
- WiFi Network
The basic structure of a QR code (usually black on a white background with a clear area around it to make it easier to read) can be divided into 5 different areas containing the following information:
- Code version used
- Format
- Data and error correction keys
- Compulsory patterns (position, alignment, timing)
- Free zone
The main advantages of the QR code over conventional barcodes are as follows:
- High information capacity (a barcode can display about 20 digits, while a QR code can display up to several hundred times more information).
- Small print size (as it contains information both vertically and horizontally, the same information can be encoded in one-tenth the size of a traditional barcode)
- Kanji and Kana character encoding (JIS Level 1 and Level 2; 1 Kanji or Kana character can be encoded in 13 bits)
- Resistant to damage and brutality (in carrying error correction keys, it is possible to recover up to 30% of bytes depending on the damage suffered by the code).
- Readable from any 360º angle (thanks to the address detection patterns located in 3 of the code’s corners).
- Concatenation of the code (a QR code can be divided into smaller QR codes which, when concatenated, contain the same information as the original code).
Although the QR code is an ISO standard (ISO/IEC18004), its use is not subject to any type of licence as Denso Wave has released the specification of the code and does not exercise its patent rights. For this reason, on the website you can find multiple QR code generators (usually free of charge, although there are also more specialized paid services that allow you to use and manage the generated codes, track their use, include customizations, etc.) and libraries (API) so that we ourselves can create an application capable of generating and/or reading them.
Some of the most popular QR code generators are the following:
- goQR.me (Free/Commercial). Allows you to encode Text, URL, Phone, SMS and vCard using the QRServer API. The result can be downloaded in PNG format or embedded in a web page. You can select the level of error correction, the colors of the modules and the background, the size of the resulting image in pixels and the free area around the code.
- ZXing (Free). Allows to encode Calendar Event, vCard/MECARD, Email, GPS Position, Phone, SMS, Text, URL and WiFi Network. The result can be downloaded in PNG format or embedded in a web page. You can only select the error correction level and three fixed sizes of the resulting image (small, medium, large). It should be noted that the size of the free zone around the generated code is larger than strictly necessary.
- Delivr (Free/Comercial). It allows to encode URL, Services (Android Market, Facebook, iPhone App Store, Twitter, YouTube, etc.), MECARD, Email, SMS, Text and others. You can select the level of error correction, the size of the margin (0-10 modules), the size of the image (1x-4x) and the color of the code. The result can be downloaded in PNG, EPS and SVG format.
Some of the libraries and APIs that allow working with QR codes are the following:
- QRServer API: API used by goQR.me
- Google API (abandoned since April 2012)
- ZXing: Java library for managing multiple 1D/2D codes, including QR codes
- QrCode.Net: .Net library for managing QR codes
When working with a QR code, the following factors must be taken into account:
- Symbol size (from 21 x 21 up to 177 x 177 digits in increments of 4 digits per side)
- Type and quantity of data (numeric, alphanumeric, binary and Kanji)
- Level of error correction (Low = 7% of bytes recovered, Medium = 15%, Quality = 25% and High = 30%)
- Concatenation (maximum 16 symbols to print in a narrow area)
Given a QR code version, a certain level of error correction and the type of information to be encoded, the maximum information capacity that the QR code can contain is established. This is important to keep in mind because it is a limitation when reading the codes using a mobile phone because these, unlike an industrial scanner, can not read all existing versions of QR codes. Similarly, the printing size of a QR code version (which is equivalent to X modules as mentioned above) will depend on the size in millimeters of each module. As you might expect, the larger the size of the module, the easier it will be to read. Therefore, when printing, the largest module size allowed by the printing area shall be used, leaving, at least, a space equivalent to 4 modules around it (free area). Delivr gives some recommendations when printing QR codes so that they can be read by the maximum number of mobile phone models:
- 32 x 32 mm, not including the free area, is the minimum size that guarantees that all camera phones on the market can read the QR code correctly
- 26 x 26 mm, without including the free zone, it covers 90% of the telephones on the market
- The latest phone models with macro capabilities can handle QR codes smaller than 10mm (e.g. iPhone 4) but phones with 2 Mpx cameras without autofocus cannot
- The contrast between the background and the color of the modules is important (it must be a dark color on a light background and, even better, black on white)
- 37.5 cm x 37.5 cm is a good size for signage since most QR code readers can read them at a distance of between 1.5m and 5.5m
It should be noted that the application used to read the QR code plays a very important role in the process of obtaining the data encoded in the code. This is because the reading of the code is done in two steps: a) the camera of a mobile phone is used to obtain a picture of the code and b) the program uses different algorithms to decide that certain points of the image correspond to code modules. If the algorithms are good, the program will be able to compensate for the lack of sharpness caused by poor camera optics, our polish when holding the mobile phone, the lack of light and contrast in the image and use the error correction data to obtain the information that has been encoded. Some of the most popular programs to read these codes are:
- Android: Barcode Scanner, QR Droid, QR Reader
- iOS: Barcode Reader
Finally, it is important to note that Spain also uses another type of bidirectional code called Bidi. Although their functionality is similar, Bidi codes are not the same as QR codes. Unlike QR codes, Bidi codes are generated using a proprietary, private and non-free encryption algorithm from Scanlife. The mobile phone company Movistar was the first to launch this system in 2008 to advertise its products (although other companies such as Vodafone and Orange and even car manufacturers, banks, clothing brands, etc. have joined in since then).
Although at first glance there is no difference between the two types of code, it can be seen that the Bidi lacks the 3 squares of positioning in the corners that have the QR. For this reason, Bidi codes can only be read with the cameras and specific applications of each brand implemented in their own mobile devices (p. ex. Android o for iOS). These applications may not read or partially read a QR code, as they are specifically prepared for Bidi codes. For this reason, it is advisable to check that the application installed “as standard” on our mobile phone is compatible with QR codes.
Com es pot comprovar amb una simple cerca en Google Images, existeix molta confusió entre els dos tipus de codi i es veuen codis QR anomenats Bidi i viceversa. For example, in the presentation of the General State Budget 2012 it was initially indicated that the code used was a Bidi when in fact it was a QR. As of today, the page has been corrected, but there are still traces of the cry in the URL of the page or in the press.