Welcome back! This is the last of my three-part series on physically connecting a barcode scanner to a computer. In the first blog, I outlined how to use a Serial Cable. The second blog detailed the ins and outs of using a Keyboard Wedge. For this final blog, I will explain a USB connection.
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.
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.
Now that you’ve read my series, I want to know what kind of questions you still have about barcode scanner interfaces. Leave me a comment below!