23.2. How does linear barcodes work?

Linear barcodes are created by translating the supported characters that should be displayed into combination of narrow and wide bars which are combined into a barcode. To identify the start and end of a barcode special "guard" patterns are used to indicate to the scanner that the barcode starts and also identify what type of symbology is used.

To illustrate this Figure 23.1 shows an enlarged and amended barcode thats uses the Code 25 symbology and encodes the numeric string "123". In order to illustrate the different parts we have colored the start and stop pattern and the three digits to make it clear how it is encoded.

Figure 23.1. Understanding linear barcodes. Example with Code 25 symbology

Understanding linear barcodes. Example with Code 25 symbology

We have chosen to illustrate the principle with the code 25 symbology since it is easy to understand. Each character is encoded with 5 black elements with spaces in between, 2 wide and three narrow elements, hence the name 2 of 5 (or 25). The width of the thinnest element is also known as the module width. Other symbologies have more complicated patterns to achieve higher density (more encoded characters in a given width) but the principle still stands.

The typical scanner sends out light which is reflected and is them measured as the scanner swipes from left to right. The relative size of the black and white areas are measured and translated back to a the encoded data.

The human readable string, usually at the bottom of the barcode is strictly speaking not a part of the barcode. It is only there to help a human reader interpret the barcode.

Some barcode symbologies also add a check digit at the end of the data. This check digit (or digits) is used to verify that the interpretated data has been read correctly.