Questions? Search our site or call us at 1-800-722-6004

How a Barcode Reader Works

Barcode scanners can be extremely simple devices made up of a light source, a photo diode and a simple decoder or complex CCD or camera based scanners. Learn how barcode scanners work and how to scan barcodes into a computer.

There are currently four different types of barcode scanners available. Each uses a slightly different technology for reading and decoding a barcode. There are pen type readers (i.e. barcode wands), laser scanners, CCD readers and camera based readers.

Pen Type Readers and Laser Scanners

Pen type readers consist of a light source and a photo diode that are placed next to each other in the tip of a pen or wand. To read a barcode, you drag the tip of the pen across all the bars in a steady even motion. The photo diode measures the intensity of the light reflected back from the light source and generates a waveform that is used to measure the widths of the bars and spaces in the barcode. Dark bars in the barcode absorb light and white spaces reflect light so that the voltage waveform generated by the photo diode is an exact duplicate of the bar and space pattern in the barcode. This waveform is decoded by the scanner in a manner similar to the way Morse code dots and dashes are decoded.

Laser scanners work the same way as pen type readers except that they use a laser beam as the light source and typically employ either a reciprocating mirror or a rotating prism to scan the laser beam back and forth across the barcode. Just the same as with the pen type reader, a photo diode is used to measure the intensity of the light reflected back from the barcode. In both pen readers and laser scanners, the light emitted by the reader is tuned to a specific frequency and the photo diode is designed to detect only this same frequency light.

Pen type readers and laser scanners can be purchased with different resolutions to enable them to read barcodes of different sizes. The scanner resolution is measured by the size of the dot of light emitted by the reader. The dot of light should be equal to or slightly smaller than the narrowest element width ("X" dimension). If the dot is wider than the width of the narrowest bar or space, then the dot will overlap two or more bars at a time thereby causing the scanner to not be able to distinguish clear transitions between bars and spaces. If the dot is too small, then any spots or voids in the bars can be misinterpreted as light areas also making a barcode unreadable. The most commonly used X dimension is 13 mils (roughly 4 printer dots on a 300 DPI printer). Because this X dimension is so small, it is extremely important that the barcode is created with a program that creates high resolution graphics (like B-Coder).

CCD Readers

CCD (Charge Coupled Device) readers use an array of hundreds of tiny light sensors lined up in a row in the head of the reader. Each sensor can be thought of as a single photo diode that measures the intensity of the light immediately in front of it. Each individual light sensor in the CCD reader is extremely small and because there are hundreds of sensors lined up in a row, a voltage pattern identical to the pattern in a barcode is generated in the reader by sequentially measuring the voltages across each sensor in the row. The important difference between a CCD reader and a pen or laser scanner is that the CCD reader is measuring emitted ambient light from the barcode whereas pen or laser scanners are measuring reflected light of a specific frequency originating from the scanner itself.

Camera Based Readers

The fourth and newest type of barcode reader currently available are camera based readers that use a small video camera to capture an image of a barcode. The reader then uses sophisticated digital image processing techniques to decode the barcode. Video cameras use the same CCD technology as in a CCD barcode reader except that instead of having a single row of sensors, a video camera has hundreds of rows of sensors arranged in a two dimensional array so that they can generate an image.

The factors that make a barcode readable are: an adequate print contrast between the light and dark bars and having all bar and space dimensions within the tolerances for the symbology. It is also helpful to have sharp bar edges, few or no spots or voids, a smooth surface and clear margins or "quiet zones" at either end of the printed symbol.

Interfacing a Barcode Reader to a PC

All application programs support barcode reading as long as you have the right equipment. Barcode readers are available with two types of output - either "keyboard wedge" output or RS232 output. The barcode readers with keyboard wedge output plug directly into the keyboard port on your PC and they also provide a pigtail connector so that you can plug in your keyboard at the same time. When you scan a barcode with the keyboard wedge barcode reader, the data goes into the computer just as if it were typed in on the keyboard. This makes it extremely easy to interface the barcode reader to any application that is written to accept keyboard data.

The keyboard wedge interface is extremely simple however it has a few drawbacks. If you swipe a barcode, the cursor has to be in the correct input field in the correct application otherwise you end up reading barcode data into whatever application has the focus. This can cause all sorts of potential problems as you can imagine. The keyboard output also is limited in that you cannot modify the data in any way before sending it into the program that is to receive the data. For example, if you needed to parse a barcode message into multiple pieces or remove some of a barcode message or add in a date or time stamp you would not be able to with a normal keyboard wedge reader. 

The other possible output option is to get a barcode reader with an RS232 or "Serial" interface. With these types of barcode readers, you connect the reader to an available serial port on the back of your PC. You would then need a program called a "Software Wedge" to take the data from the barcode reader and feed it to the application where you want the data to go. The disadvantage to this approach is that it is a little more complex however you gain much more control over how and where your data ends up when you read a barcode. 

Our WinWedge product line is designed just for this purpose. WinWedge is an executable program that can pass serial data back and forth to other programs using either DDE (Dynamic Data Exchange) or by converting incoming serial data to keystrokes (i.e. it stuffs the keyboard buffer with the incoming serial data). With WinWedge, you can control exactly where the data goes in the target application and you can also perform all sorts of modifications on the data before it is sent to the application including parsing or translating the data as well as adding additional keystrokes or date and time stamps to the data.

WinWedge is extremely easy to use and is designed to have you up and running sending and receiving serial data directly from within your application in just a few minutes. Because WinWedge can pass data using DDE, you can set your application up to insure that the barcode data always goes where it is supposed to go and you can also have your application running in the background and still accept barcode input while you run some other program in the foreground. WinWedge is without question the most robust way to interface a barcode reader to a PC with the least amount of effort.


"TALtech provided unbelievable technical support, the best I've ever had. The support engineer went above and beyond anything I expected. He provided fantastic support."

Dave Eckerskey Harris Rebar

"I would like to compliment you for your assistance and patience. It is so refreshing to work with a vendor with customer service such as yours."

Bill Keen Intertek ETL SEMKO

News & Updates