Even though you can still buy a computer with both a serial port or a PS/2 port, USB ports are the most popular interface for connecting peripherals to a computer. Over the last few years, barcode scanners with a USB interface cable have become top sellers. These devices physically connect to the computer’s USB port via a male A connector. USB cables have become increasingly common over the past years.
The USB cable is the physical connection. Logically, the barcode scanner interfaces to the computer in one of the following two ways:
- As a keyboard or HID (human interface device)
- As a COM (or serial) device
These two logical interfaces are almost identical to barcode scanners physically connected using a keyboard wedge or serial cable.
Because most barcode scanners support interfaces other than USB, you must ensure that you first configure the scanner to use this connection. You must also decide between the various logical interfaces that a physical USB connection supports: USB keyboard, USB HID, USB COM port, etc.
Like a physical keyboard wedge interface, the operating system (OS) cannot distinguish between data that comes from the keyboard and data that comes from the barcode scanner. Because of this, an application does not require specific functionality to support a barcode scanner connected via USB keyboard. If the application allows input from the keyboard, it will accept input from such a barcode scanner. In fact, the application cannot differentiate between data from the keyboard and the scanner.
Like a physical serial interface, the USB COM interface requires application support to retrieve the scanned data. One of the benefits of this is the ability of an application to retrieve barcode data even if it is not the foreground application (also called having the focus). If you will have multiple applications open at the same time and want the barcode data to go to just one application, a USB COM interface can accomplish this. A USB COM interface differs from a physical serial interface in that you do not (usually) have to configure the parameters of the COM port on either the OS side or the barcode scanner side.
Most barcode scanners connected with a USB cable get their power from the computer’s USB port. Some USB cables allow for an optional external power supply. This can serve to either power the scanner or, for cordless barcode scanners, to charge the battery. You should check the documentation for your device to determine if it requires an external power supply.
As I mentioned, a USB interface is the most widely available of the standard barcode interfaces. I recommend using it in the following instances:
- Your hardware only supports a USB interface.
- You want to ensure you can connect your barcode scanner to future computers you may own.
- You want the option of switching the logical interface (keyboard or COM port) in the future without having to buy another cable.
L-Tron Corporation is a value added reseller and trusted distributor of data acquisition and collection products. Formed in 1975, L-Tron's product and service offerings have evolved to remain on the cutting edge of global business demands. L-Tron is currently a leading supplier of numerous business solutions and application software offerings.
Other articles on the fundamentals of barcoding can be found under the Learn - Barcoding 101 section: