Barcodes would be absolutely worthless without the technology and devices to read them. Barcode scanners have to have the ability to read the black-and-white zebra lines on products instantly and feed that information to a computer or checkout terminal, which can process and identify them immediately using a defined product database.
Here’s how they do it.
For the sake of this simple example, let’s assume that barcodes are simple on-off, binary patterns with each black line corresponding to a one and each white line a zero. (Real barcodes are much more sophisticated and complicated than this, but let’s keep things simple for educational purposes.)
1. Scanning head shines LED or laser light onto barcode.
2. Light reflects back off barcode into a light-detecting electronic component called a photoelectric cell. White areas of the barcode reflect the most light, while black areas reflect the least.
3. As the scanner moves past the barcode, the cell generates a pattern of on-off pulses that correspond to the black and white stripes. So for the code shown here (“black black black white black white black black”), the cell would be “off off off on off on off off.”
4. An electronic circuit attached to the scanner converts these on-off pulses into binary digits (zeroes and ones).
5. The binary digits are sent to a computer attached to the scanner, which detects the code as “11101011”.
In some scanners, there’s a single photoelectric cell and, as you move the scanner head past the product (or the product past the scanner head), the cell detects each part of the black-white barcode in turn. In more sophisticated scanners, there’s a whole line of photoelectric cells and the entire code is detected in one go.
In reality, scanners don’t detect zeroes and ones and produce binary numbers as their output: they detect sequences of black and white stripes, as we’ve shown here, but convert them directly into decimal numbers, giving a decimal number as their output.