How does a laser barcode scanner work?

Johanna October 22, 2024 4 mins read
app store

❓ How does a laser scanner transform the black and white lines of a barcode into human-readable information?

Answer

tl;dr: While the laser light of a laser barcode scanner runs back and forth over a barcode, it is reflected more or less strongly depending on the color of the surface. A light sensor converts the reflected light into an electrical signal, which is then further processed by integrated software.

Long answer: 

A barcode is a visual representation of data. Barcode symbologies generally fall into two categories: 1D and 2D barcodes. 1D barcodes are represented by parallel lines of varying widths and spacings, producing a zebra stripe pattern. 2D barcodes use a matrix of shapes (dots, squares, etc.). As they code data both vertically and horizontally, they can store far more information. The best-known 2D barcode symbology is the QR code.

Uninverted Code 128
Uninverted QR code

Extracting the information encoded in barcodes takes several steps, but it all starts with a barcode scanner. One type in particular has been around for some time and is well-established across industries: the laser barcode scanner.

In laser barcode scanners, built-in laser diodes emit a laser beam. Its wavelength is usually 650 nm, producing the characteristic red color. The beam is directed at a built-in rotating or oscillating mirror. Its movement makes the laser beam zip back and forth across the barcode rapidly, creating a scan line.

When the light hits a surface, it is either absorbed, reflected, or scattered. In a black-and-white barcode, the black lines absorb more light and reflect less than the white lines. A light sensor in the barcode scanner, either a photodiode or a charge-coupled device (CCD), then captures this reflected light. The sensor converts the varying light intensities (which correspond to the pattern of bars and spaces) into an electrical signal. 

This electrical signal is then processed by the scanner’s embedded electronics. Integrated software decodes the signal into a digital representation of the barcode data. Finally, the scanner firmware sends this data to a point-of-sale system or another backend for use.

Laser barcode scanners generally have a low error rate and accurately read codes even at a distance. However, they do have their limits.

Their biggest shortcoming is that they can only scan 1D barcodes. As the use of 2D barcodes spreads, laser barcode scanners are in danger of becoming obsolete. For instance, the GS1 Sunrise 2027 initiative plans to replace all 1D barcodes on product packaging with the more versatile 2D barcode by the end of 2027. Traditionally, point-of-sale workflows use laser scanners – but that may not be the case for much longer.

They also cannot scan inverted barcodes, nor can they read multiple barcodes simultaneously, which further restricts their application.

The modern, more versatile, and reliable alternative to laser scanners are camera-based barcode scanners. Camera-based scanners use image capturing to read whole barcodes all at once instead of scanning them by moving back and forth, as laser barcode scanners do. As they use advanced digital image processing technology, they are often more accurate than laser scanners, especially in challenging conditions.

Here is how they work: After taking a picture of a barcode, the software reduces image noise by converting it to grayscale and applying filters. Binarization reduces the image to only black and white pixels. All of this makes detecting and decoding the barcode much easier. The remaining black-and-white pattern is then converted into binary data, which is finally translated into the corresponding text or numeric information. Equipped with powerful barcode scanner software, even budget mobile devices become reliable barcode scanners – all they need is a camera. The Scanbot Barcode Scanner SDK scans all common barcode types, 1D and 2D, and works reliably even with damaged codes, in low-light environments, and with tiny or distant barcodes.