Friday, July 29, 2011

Making your own bar code key fobs

My broken gym bar code fob
My gym uses bar code fobs which keep breaking.  So I made my own. Unlike RFID fobs it's trivial to make your own. Here is how I did it:
  1. Get the code 
  2. Identify the bar code type (the "symbology"). 
  3. Use a web app to make a bar code
  4. Print, cut and attach to your key ring 
The code is usually printed under the bar code. If not, you can use a smartphone mobile app such as ZXing to scan the code.  ZXing will also tell you what symbology is used. (Obviously if the fob is broken like mine, you'll need to hold the pieces together as best you can before scanning).

The bar code "symbology" is how the code is encoded into bars. You might get away with using the wrong symbology, depending on how the bar code scanner is configured. If you scanned with a app like ZXing it will tell you what the symbology is. If not, try making bar codes with all the different symbologies until you find a code which is visually identical to your broken fob.

Making the bar code

There are many free web pages and apps to make and print bar codes, but many produce output pages what are cluttered with unnecessary stuff. So I wrote my own little mini-app: based on the Barcode Coders library.

When you've got the right code, print and cut out and attach to your key ring. I'm using the reverse side of my Tesco fob. Do not cut the bar code too tightly: bar codes require white space (the "quiet zone") to the left and right of the code.

An improvised bar code key fob

It's not going to last forever, but heck, it can't be any worse than the ones the gym supply. In any case I printed a few spares so that I can quickly replace it. Of course it doesn't have to be a tiny fob. I'm thinking of printing an A5 sized version of the bar code, laminating it and attaching it to my gym bag.