How Do Barcode Scanners Work?
So we’ll start with the simplest answer: a barcode scanner works on the basis of reflectivity, or more precisely on reflective differences in the barcode. Still interested? OK. Barcode scanners decode linear barcodes by finding the edges of the bars and spaces. Exactly how it does this depends upon the decoding program (decode algorithm) for the symbology being scanned. A scanner decodes a Code 128 by detecting four reflective attributes of the symbol:
- The distance from the left edge of the first bar and the left edge of the second bar;
- The distance from the left edge of the first space and the left edge of the second space;
- The distance from the left edge of the second bar and the left edge of the third bar;
- The distance from the left edge of the second space and the left edge of the third space.
The scanner isn’t really finding the edges—it is finding transitions from dark to light and light to dark; and neither is the scanner really measuring the distances between them, it times the transitions it finds using an internal electronic stopwatch. The red laser line you see from some scanners isn’t really a line, it is a rapidly moving laser dot. It is the known speed of the moving dot that makes it possible to clock the distances from the transitions and thereby discern bar and space width differences. Linear imager scanners, which shoot out more generalized a blast of red light, work basically the same way.
Parenthetically, this is why Traditional Verification of barcodes, which is based on comparing the accuracy of width measurement of the bars and spaces, did not work very well as a predictor of barcode performance. Scanners don’t work based on bar and space measurements—they work on the basis of reflective differences.
UPC, which is a modular symbology, presents a unique scanning challenge because the elements (bars or spaces) of four of the encoded characters differ in width by a fraction of a module—not a full module. Yes, you read that correctly. The module width of a nominal (100% magnification) UPC symbol is .013”. Characters 1, 2, 7 and 8 contain bars that differ in width only .001” or 1/13th of a module. To be able to distinguish these characters, the decode algorithm for UPC includes an additional measurement: the sum of the width of the two bars in each encoded character.
For this reason it is also very likely that UPC symbols with a lot of average bar gain will grade poorly or even fail the ISO parameter Decodability.
Digital camera-based scanners function similarly, even though they capture the image of the barcode and analyze it very differently. And digital camera scanners could be said to measure the element widths because they capture an image of the entire barcode at once.
The way barcode scanners work reveals why a scanner doesn’t make a good verifier. A scanner either decodes the barcode or it does not. It does not tell you the barcode is about to fail and if it does, it doesn’t tell you why. The rationale many people proffer for why they don’t need a verifier is they have never had a barcode fail. While we cannot dispute that fact, a scanner neither reveals how close nor how often they have approached the brink, an experience we are sure they would never forget.