At the hackerspace in Aalborg (HAL9k) we wanted to mark equipment etc. with various information such as the owner of the equipment, possible instructions on how to use it and other relevant information.
We decided to make something based on stickers with QR codes where the user is redirected to the relevant subpage on HAL9k’s website. One requirement was furthermore that it should be possible to change the name of a wiki page or possibly change to a new wiki/CMS system without putting on a bunch of new stickers, i.e. something more dynamic than a direct link.
With regards to the stickers we ended up with a label printer attached to an Ubuntu Linux PC. We got 1300 stickers (resulting in 2600 QR codes) on Ebay for 350 DKK – enough stickers for the next foreseeable time..
Mikael from the hackerspace wrote some PHP code that we run locally on an Apache webserver on the PC, which basically generates a QR code (well actually two since we have two individual QR codes per sticker in order to end up with the right size), adds some (optional) text, saves the resulting image to a file and then calls the lp printing command.
The label printer was made to work with CUPS by using the instructions on this site.
Now back to the requirement about the desire not having to put new stickers on all the equipment when we change wiki/CMS, rename pages etc. We solved this by letting the QR codes point to http://qr.hal9k.dk/HQRxxx where ‘xxx’ is some number. The webserver at qr.hal9k.dk automatically redirects (307 Temporary Redirect) to the relevant page. In order not to have a manually maintained list that nobody would update anyway i wrote a Python script that every 5 minutes goes through all the pages on the HAL9k wiki using the page hal9k.dk/qr as an index. Every time it sees the string ‘HQR’ followed by a number on a given page, a reference is made and a .htaccess file is then updated so that the user is redirected to the correct page. The mappings between the keys and the wiki pages, logs etc. generated by the script is available at qr.hal9k.dk.
So the end result, besides having fun making it all, is that now users can easily print labels and put them on equipment at the hackerspace. If they forget to create the wiki page the user is automatically redirected to this page for a reminder about just that 🙂