Signore Galilei

Let's Explore!

Blog

Videos

About

There are too many types of barcode

A few weeks ago, I embarked on another technology quest. This time, I wanted to digitize my library card, so I could get books using just my phone. I figured it would be simple – the card just used a barcode. All I would need was a picture of the correct barcode.

At first, I tried just using a picture of my library card, but it wouldn’t scan at the kiosk. No big deal, that wasn’t my only option. I just needed to get a digital version of the same barcode.

My library card conveniently had a number just below the barcode, which I figured was the information encoded in the code. So I looked up a barcode generator online and typed in the number.

This didn’t look right. It was much taller than my library card bar code, and didn’t have the same pattern of stripes. The problem quickly became apparent: there must be more than one type of barcode.

Luckily for my library card project, there are websites that will happily identify which kind of barcode you’re looking at. The barcode generator was using a format called “Code 128”, while my library card was an older format called “Codabar”.

I also learned that my card had a secret “A” at the beginning and “B” at the end to match up with the Codabar standard. With this information in hand, I generated the correct barcode and was able to check out books.

It turns out that Codabar and Code 128 are far from the only barcode standards – there are at least several dozen. But why are there different barcodes in the first place?

Basically, there are different kinds of scanners and different applications. You’re probably most familiar with bar codes at the grocery store. These are “Universal Product Codes” (UPC). They were designed in the 1970’s to be read with the electronics of the day. There are full size UPC-A and compact UPC-E codes.

 

Both the black bars and the white gaps encode information in a UPC. UPC-E is roughly square shaped, while UPC-A is split into two square halves with different encodings (the right half swaps black for white and vice versa compared to the left half). The square shapes make it easy for the codes to be read using an X-shaped scanning light. These codes also include check digits, which make it possible for the scanner’s computer to recognize and correct errors.

Other kinds of bar code work similarly, but are designed with different advantages. UPC only needs to store numbers. Code 128 can also store letters, and is primarily used in shipping labels. Codabar is designed to be printable using older dot-matrix printers or even stamps. A set of older standards encoded digits by picking 2 positions out of a group of 5, and are uncreatively called “2 out of 5” codes.

And this is all just linear, black and white barcodes. There are plenty of 2D bar codes and codes incorporating colors. These are especially popular now that digital cameras are so cheap and ubiquitous, but they’re actually just as old as linear barcodes. The first barcode to be used commercially was “KarTrak”, which identified moving train cars using colorful 2D codes.

Like so many of my technology projects, my quest to get my library card onto my phone exposed a hidden world of detail behind something we see every day. Something to think about next time you go to the store.

Coming Soon: Happy Public Domain Day!

KarTrak picture credit Quinn Rossi, CC BY 2.0

Leave a Reply

Discover more from Signore Galilei

Subscribe now to keep reading and get access to the full archive.

Continue reading