Barcode Scanner Interfaces – Let’s Get Serial

Posted by | Date:

You have a barcode scanner.

You have a computer.

What’s next?

There are three primary methods of physically connecting a barcode scanner to a computer: Serial, Keyboard Wedge, and USB. This is one in a series of three blogs to explain these interfaces, beginning with serial.

A serial interface is the most complicated of the standard barcode interfaces to configure. It also provides the most flexibility and control of the scanned data. I recommend using it in the following two instances:

  1. Your hardware only supports a serial interface
  2. You have multiple applications running at once and require all of the barcode data to go to one application

 

A barcode scanner with a serial cable usually has a DB9 connector that plugs into the computer. Some specialized Point of Sale (POS) systems, such as some VeriFone terminals, use a modular connector. There is no “standard” connector for a serial barcode scanner. Some fork truck mounted computers use an industrial connector that screws into the computer for a more secure connection. The images below illustrate the differences between DB9, modular, and industrial connectors.  Some programmable logic controllers (PLCs) use screw terminations to connect the barcode scanner cable to a serial “port.”

DB9 Male & Female ConnectorsModular ConnectorIndustrial Connector

 

Most barcode scanners that support a serial connection use the RS-232 standard. Most computers also support this standard but some specialized computers also support the RS-422 and RS-485 standards. The rule of thumb is simple: Ensure that the barcode scanner you use supports the type of serial port you plan to connect it to.

 

When connecting a barcode scanner to a computer via a serial port, it is imperative that you determine how the scanner will get power. Some PLCs and fork truck computers supply power directly on their serial port, usually on pin 9. If this is not the case, you will require an external power source. You will plug this power supply into the interface cable, so make sure the cable supports this.

 

Because most barcode scanners support other interfaces besides a serial one, you must ensure you configure the scanner to use this connection. The last business of connecting a barcode scanner to your computer via a serial interface is to set the parameters of both the scanner and the computer to match. This typically includes the baud rate, number of data bits, stop bits, and parity. If these parameters do not match exactly, it is unlikely the computer can communicate with the barcode scanner.

 

Unlike the keyboard wedge interface, the serial interface requires application support to retrieve the scanned data. The computer’s operating system (OS) puts scanned data into a COM port buffer. Your application must support retrieving data from a COM port. This typically includes the ability to configure the port number, usually between 1 and 255. If your application does not support this, you should not use a serial interface. 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 serial interface can accomplish this.

 

That’s it!  Feel free to contact me if you have further questions and be sure to check back for my next blog in this series: Keyboard Wedge.