Connect Your HMI/SCADA to Barcode Scanners

5 min read

Jan 28, 2016 1:59:16 PM

Barcode scanners are one of those types of devices that are extremely common in a variety of industries, whether it's for use in a manufacturing process or for cataloging inventory or a multitude of other possible uses.  But how do you go from scanning a barcode to making that barcode data available to your monitoring applications such as an HMI or a SCADA?

Over the years of working in the automation software realm, I've seen dozens of clients have this seemingly basic need to bring barcodes up into various software packages.  Regardless of the make/model of the scanner, the process is almost identical.  For example, you could connect to a DataLogic scanner in under five minutes. (Click for How-To Video)

This post will cover the steps for bridging that gap between your scanners and your client applications.

Step 1: Protocol/user manual for your scanner

Step 1 - Find Your Scanner Documentation

  • We're looking for the following information in the manual:
    • Format of the actual data string with the barcode information that will be transmitted by the scanner to the host computer it is connected to.
      • Are there any starting characters like STX at the beginning of the data?
      • Are there any terminating characters like ETX, LF or CR at the end of the data?
    • Information on the actual physical interface of the scanner to the host computer.
      • Is this a native serial COM scanner (RS-232/422/485)?
      • Is this a USB scanner that can be installed such that it emulates a serial COM connection?
      • Is there special configuration required to make the scanner emulate a COM connection? (Such as a special driver to install on the host PC and possibly a special configuration barcode to scan to properly set the mode of the scanner itself)
      • What are the default serial COM parameters (Baud rate, Data Bits, Parity, etc)?

Step 2: Connect your scanner to the host PC

Step 2 - Connect Your Scanner

  • If this is a native serial COM scanner:
    • Make note of which COM port on the host PC you connect your scanner to (COM1, COM2, etc.)
  • If this is a USB scanner with COM emulation:
    • Make sure the proper USB COM driver from the scanner manufacturer is installed on your Host PC (if necessary - it usually is).
    • Once connected, you can check the device manager on your Host PC operating system to confirm which COM port has been assigned to the scanner and make a note of it.

Step 3: Configure OmniServer to connect to your scanner and process the barcode data

Step 3 - OmniServer Gets You Connected

  • OmniServer is a universal I/O server designed for use with a variety of devices such as barcode scanners, weigh scales and other ASCII-based protocols where there isn't an existing communications driver or server.
    • Through a user interface, OmniServer provides the ability to create what is referred to as a "Protocol" profile that defines the pattern of barcode data that will be received from your scanner and assign which bytes in that data will be passed into an "Item" variable.
    • This is all possible without any custom code needing to be written.
    • OmniServer can connect to serial COM devices, USB devices that can emulate a COM port and to Ethernet devices.
  • In OmniServer, there are three pieces to configure for the connection to your scanner:
    • Device - Here you will configure a COM device matching the COM port number and the serial COM parameters that were detailed in the user manual.
    • Protocol - Here is where the pattern of data is configured - OmniServer provides a standard sample BARCODE protocol profile that is the best place to start when interfacing to a barcode scanner.
      • The sample uses the standard format <Barcode><CR>, meaning OmniServer will expect the scanner to transmit the barcode value followed by a terminating CR character, which is a very common format.
    • Topic - Here you associate the COM device you configured that corresponds to your physcial connection to the scanner with the BARCODE protocol.
      • The Topic, along with the Item name "Code" is what you will reference from your HMI or SCADA application.

Step 4: Connect your HMI/SCADA application

Step 4 - Configure Your Client Connection

Wonderware Certified Partner Product

  • If your client application has an OPC DA interface:
    • The OmniServer OPC DA ProgID is:  SWToolbox.OmniServer
    • If your client supports browsing, you will be able to browse to the name of the Topic you configured and see a list of available Item names - Code is the Item corresponding to your barcode value.
    • If your client does not support browsing, the fully qualified OPC DA Item syntax is:  <Topic Name>.<Item Name> - for instance, Topic1.Code
  • If your client application has a Wonderware SuiteLink interface:
    • You would configure your Suitelink Access Name using the following:
      • The OmniServer Suitelink Application Name is:  osrvpoll
      • The Topic would simply be the name you configured for your Topic in OmniServer
      • And for the BARCODE protocol, the Item Name corresponding to your barcode value is Code
  • If your client application has a DDE interface:
    • The OmniServer DDE application name is: osrvdde
    • The Topic would simply be the name you configured for your Topic in OmniServer
    • And for the BARCODE protocol, the Item Name corresponding to your barcode value is Code
  • If your client application has an OPC UA interface:

Step 5: Scan something!

Step 5 - Scan your barcode

  • Once you're connected to the Code item in OmniServer from your client, you're ready to test out receiving barcode from your scanner.
  • If the raw data format from your scanner matches the <Code><CR> format, this should work immediately and you should see the numeric string value of the barcode you scanned displayed as the item value.

If you're not seeing a value, the format from your scanner is likely different from the BARCODE protocol default format.


These steps should generally allow you to get started interfacing with just about any make/model of scanner with the right physical interface.  Since the majority of HMI or SCADA applications out there support at least one of the client-side interfaces we discussed, this makes it straightforward to gain real-time access to your barcode data.

Watch Video - Connect to Your Scanner in 5 Minutes

Kevin Rutherford
Written by Kevin Rutherford

Software ToolBox Technical Blog

We're engineers like you, so this blog focuses on "How to" appnotes, videos, tech team tips, product update announcements, user case studies, and other technical updates.  Subscribe to updates below. Your feedback and questions on posts are always welcomed - just use the area at the bottom of any post.

Subscribe to our Blog

Recent Posts

Posts by Topic

See all