How Barcode Scanners Work
Barcodes are a graphical representation of information that can be easily read by machines. People read text easy enough but machines find this to be too complex so we use barcodes to simplify the process.
Barcodes can store numbers, letters and all the special characters. What can be stored in the barcode depends on which type of barcode is being used. But the basics of how a barcode works is the same regardless of what type of code it is, what information is stored in the barcode or what type of scanner is being used.
It all starts with the scan. The scanner, regardless of which type you are using, will examine the barcode image. The lines (or blocks in the case of 2D barcodes) will either reflect or absorb light. When we look at the barcode, we tend to see the dark stripes and think of those as the important parts. Those are the parts that absorb the light and the white parts reflect the light. So the scanners tend to see the barcodes in reverse of how we think of them. But the dark and light portions of the code on their own don't automatically become the information stored in the code. In most cases, it is the relative placement and size of each dark and light stripe (or block) that make up the information. There are also special markers that help the scanner know which direction the barcode is facing when it is scanned. This allows the scanning process to work even if the barcode is upside down when it is scanned. The scanner simply processes the scanned data in reverse in this case.
Taking a look at an oscolloscope screen as a scanner passes over barcode, you can see that the stripes reflect back light and the scanner registers the changes as high and low levels. So what looks like a simple image is really a rather complex set of layered encryption to store the data. The encryption isn't done to hide the information in this case. Instead it is done to make it easy for the machine to read the information. Since the base language of machines is binary (1 and 0) it is easy for them to read this type of information even if it takes several steps to turn this back into something that people can understand.
The size of each high and low are combined to make binary data. A series of 1 (one) and 0 (zero) values which are strung together then decoded into the actual information. Up to this point, the process is the same for all barcodes regardless of how they are stored. Getting the lines or dots into binary is the easy part for the machine. The next step is to make this binary code into something useful to people. That step depends on which type of barcode is being scanned. Each type of barcode has its own encoding methode. Just like human languages, what seems to be two similar words (or barcodes in this case) could actually be two very different values even though they have the same basic letters (or bars).
So you can see that the scanning devices need to know not only how to turn the bars or dots into binary, but after they have done that they need to know how to turn that binary string into the original information. But regardless of the encoding process the basic steps are the same. Process the light and dark areas, convert them to binary, decode the binary, pass the information on to the receiving device which is normally a computer program of some sort.
Once the decoded data reaches the computer program, there is no telling how the information is to be used. The grocery store will use the information to keep track of the products you purchased as you go through the register. A manufacturer will use the code to identify where they are storing their parts. And shipping companies use the codes to keep track of the packages they are delivering.
Now that you know a little about the mechanical portion of the process, take some time to learn about the different types of barcode scanners and the different ways the information can be encoded into barcodes.