How Are Barcodes Read and Decoded?
scanners use some sort of a light source and photodetector as
the basis of the scanning system. In general, light is
projected onto the barcode symbol. If the light strikes a
black bar it is absorbed and little light is reflected. If
the light strikes a white space, most of it is reflected back
in the general direction of the source of the light. By
having an optical system that only looks at a very small
area, roughly the size of the smallest bar or space in the
code, each individual bar and space can be read by the
optical portion of the reader. This involves moving this
small reading area over the code symbol, or if the reading
area is in a fixed position, then the code is moved past it.
Somehow this small reading aperture must sweep across the
code symbol from first bar to last. This results in an
electrical signal that represents the barcode with narrow
electrical pulses representing the narrow bars or spaces and
wider electrical pulses representing the wider elements of
the code. It is then necessary to determine what this pattern
of wide and narrow elements is to decode the barcode. This is
usually accomplished with some type of microcomputer of
microcontroller circuit. The decoder performs three basic
functions. It times the duration of the electrical pulses and
classifies them as wide or narrow bars or wide or narrow
spaces. Once this is done it translates the bar and space
pattern into the actual characters that make up the barcode.
The last function is to transmit this barcode data to some
other device that will use the data. This is usually done by
transmitting the data as ASCII characters through a serial or
parallel computer interface.