What is a QR code?
Let’s keep this simple.
You are probably familiar with the barcodes on the back of packing of items in shops. Here’s a quick example of one:
This is an UPC-A standard barcode. The combination of thick and thin bars are a way of encoding numbers that you and I can read into something that can be scanned and read by a computer. Note that there are only 13 number in this particular type of barcode – it can’t tell you anything about the product, just what record the computer should look up in a big database (in this case, the UPC database). So, great if you use them for product ID, but not very flexible outside the retail environment and not really useful to you and I.
Now, you can use a slightly different type of barcode (a different ‘symbology’) that lets you use letters as well as numbers: CODE128 lets you create alphanumeric barcodes of unlimited length:
We can even encode a website address in it.
Pretty good. Except that the more characters you include, the longer it gets, until it becomes a bit silly and just not practical:
Now, the above are all ‘1D’ barcodes – i.e. 1-dimensional – the scanner only reads from left to right to decode the information. If you scan the top half of the barcode, you get exactly the same information as if you scanned the bottom half. If we go 2-dimensional (‘2D’), so that data is encoded both vertically as well as horizontally, we can squeeze a lot more information in the same space:
See how we can include a lot of information in the barcode, while keeping it to a usable size.
There are different symbologies available:, PDF417 and QR Code. Both are freely usable by you and I, but the QR code is one you are more likely to encounter as they are more popular in uses for the general public. So we will concentrate on this type of barcode here.
I wandered lonely as a cloud,
That floats on high o’er vales and hills,
When all at once I saw a crowd,
A host, of golden daffodils
In fact, you can squeeze a lot of information into a QR code. The official limit is 4,296 characters – about 715 words. Practically, the limit is about 250 characters, this sample has 217 characters:
Space: the final frontier.
These are the voyages of the starship Enterprise.
Its five-year mission: to explore strange new worlds,
to seek out new life and new civilizations,
to boldly go where no man has gone before.
And just for fun, here is the whole ‘To be, or not to be’ speech from Hamlet in a single barcode. 276 words / 1,488 characters (Note your QR decoder might struggle with one this size: some phones/online decoders cannot handle one of this size)
To be, or not to be: that is the question:
Whether ’tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing end them? To die: to sleep;
No more; and by a sleep to say we end
The heart-ache and the thousand natural shocks
That flesh is heir to, ’tis a consummation
Devoutly to be wish’d. To die, to sleep;
To sleep: perchance to dream: ay, there’s the rub;
For in that sleep of death what dreams may come
When we have shuffled off this mortal coil,
Must give us pause: there’s the respect
That makes calamity of so long life;
For who would bear the whips and scorns of time,
The oppressor’s wrong, the proud man’s contumely,
The pangs of despised love, the law’s delay,
The insolence of office and the spurns
That patient merit of the unworthy takes,
When he himself might his quietus make
With a bare bodkin? who would fardels bear,
To grunt and sweat under a weary life,
But that the dread of something after death,
The undiscover’d country from whose bourn
No traveller returns, puzzles the will
And makes us rather bear those ills we have
Than fly to others that we know not of?
Thus conscience does make cowards of us all;
And thus the native hue of resolution
Is sicklied o’er with the pale cast of thought,
And enterprises of great pith and moment
With this regard their currents turn awry,
And lose the name of action.–Soft you now!
The fair Ophelia! Nymph, in thy orisons
Be all my sins remember’d.
So, as you can see, there is the potential for some clever stuff with these 2D barcodes. In my next few posts, I will share some of them with you.
If you want to have a play with making your own barcodes, try
http://www.barcode-generator.org/ as it lets you try creating barcodes in most of the common symbologies