Creating and Using Custom Barcodes and UPCs

After establishing a simple barcode scanner using a raspberry Pi and camera I wanted to learn more about them. Barcodes, especially UPCs are everywhere you look and even a casual understanding of them makes it obvious they are powerful. Below are a few questions that help me wrap my mind around what is possible using just 2D encoding techniques.

Who sets the standards for Barcodes and QR Codes?

There are hundreds of standards for how barcodes are laid out. Organizations can develop their own while the most common are controlled by international standards organizations including ISO and GS1.

If a corporation or group is large enough to support development of the encoding and readers there is no requirement to stick to the standard. Open source computer vision systems, low cost high-resolution cameras, and accurate printing technologies enable almost anyone to develop their own code.

Essentially the Raspberry Pi project here could be trained to look for specific blocks. In essence this is what happened with some of the broader standards. One internal group developed them but in order to gain adoption and effectively commercialize the technology they released the designs.

QR codes were developed by a Japanese company, Denso Corp, in the mid 1990’s. Though they filed and were awarded a patent for the system but they announced that they would not pursue protecting the patent in order to encourage the adoption of the format. GS1 for registering them: http://www.gs1.org/barcodes

How much data can a barcode store?

Answering this question requires a lot of clarification on the type of code being read and the type of reader. In theory any amount of data can be encoded in 2D form. You could write all of War and Piece by stringing together a bunch of barcodes, but that is not very efficient.

Practically speaking each standard of barcode is designed to capture enough data to be useful. In the case of one dimensional codes this is usually only a handful of characters, which is further limited by the character library.

In the case of Universal Product Codes – E, which is a 6 digit encoding limited to numerical characters only, there are 2 Million possible numbers available. That is plenty for internal use categorization and even for small industries.
The UPC-A standard allows for 12 digits, 11 of which are for information and 1 is a “check” character. This jumps the number of possible encoded values to 100 Billion.

Expanding the characters to a full alphanumeric spectrum increases the values possible for encoding but also for accurate strings to be embedded. Rather than capturing a library of values that must be further decoded it is possible to simply embed the string “Costs$9.99” if you so please.

For 2D barcodes, the most popular of which seems to be a QR code, these strings are exactly what is passed. Many smartphones now have QR code readers which means that the QR code can be simply a web url and the reader can open a browser for that page.

Even with this expansion in encoding values limits exist. For QR code the limitations are on the effective height and width of encoding spaces. Effectively split into a grid of pixels QR codes are standardized by their height and width with the largest standard being a grid of 177×177 values, this is referred to as version 40.

Version 40 QR codes require a bit more leeway though. Many standards built in checks and redundancies such that if any one section of the code is unreadable or misinterpreted the end value is not affected. In essence this reduces the values available in favor of reliability.

Can you create your own?

This is the part that is most exciting. Creating a barcode with your own custom data embedded is super easy. Tons of tools exist online to do so if all you want is to embedded some specific number string or series of text. Here is one such tool, and the one that I used to create a library of QR codes for the above mentioned raspberry pi based scanner.

If you plan on using the barcode on a product though things get a little more complicated. Mostly because you will have to verify the standard you are using depending on the product type, and ensure that your code is registered such that it truly is unique.

For most products, at least in the US, that means relying on the GS1 standard. For a nominal fee of $250 you can create company specific prefix that will ensure all of your UPCs start with the same digits and are universally accepted in the retail and consumer space. If you just need one individual code there are clearinghouses that use their own prefix and sell individual codes one at a time.

One thought on “Creating and Using Custom Barcodes and UPCs

Leave a Reply

Your email address will not be published. Required fields are marked *