DMC, Inc.
Using Cognex Barcode Scanners with TwinCAT

Using Cognex Barcode Scanners with TwinCAT

When working with clients in the biotech industry, barcode scanners and robust data tracking systems are key to ensuring accurate, traceable, and efficient workflows. Cognex’s line of fixed-mount barcode scanners, designed to withstand harsh conditions, pairs elegantly with Beckhoff’s IPCs, which boast high-speed computing and comprehensive data analysis capabilities. This blog will detail how to integrate an out-of-the-box Cognex barcode scanner (focusing on the DataMan 390 Series) into TwinCAT, Beckhoff’s automation software.

Note: This blog uses a DataMan 395X barcode scanner and a C6015-0010 IPC. Beckhoff’s EL6652 module is used to connect to DataMan over EtherNet/IP. The programming laptop is running TwinCAT 3.1.4024.67.

DataMan Setup Tool

Cognex’s DataMan Setup Tool is a useful standalone app to configure the settings of your barcode scanner and train the vision model with straightforward installation and UI. However, key changes must be made to ensure a seamless network interface with your IPC.

DataMan Networking

To begin, navigate to Cognex’s website and download the latest version of the DataMan Setup tool on your programming computer. This blog will use version 25.3.2. Upon installation, you will land on the “Connect” page, where all valid network devices will populate.

Cognex's Dataman Connect Page

To ensure that you can view the barcode scanner within the setup tool, your computer must be on the same subnet as the barcode scanner. New inbound rules in your operating system’s firewall settings, allowing TCP/UDP communication through the DataMan Setup Tool, may also need to be enabled.

ip addess of Cognex's dataman 390 series model

By default, the IP address of a DataMan 390 series model is 192.168.0.200. If you have trouble detecting it or the IP address was previously configured, you can download another standalone Cognex app – Cognex Device Discovery Utility. This allows detection and configuration of network settings based on the serial number or MAC address of your product and can be downloaded from Cognex’s website.

If you successfully detected your barcode scanner in the DataMan Setup Tool, change to the “Communications” tab. Here, you can set the static IP address to whatever is desired. Keep in mind that this IP address will ultimately need to be on the same subnet as your IPC.

If you have discovered the barcode scanner over UDP, it is then recommended to connect to your device securely.  This can be done with an Ethernet to USB-C adapter, for example, plugged directly into your programming computer. I changed my scanner’s IP address to one that my adapter could detect, but also one that is on my IPC’s subnet, which we’ll get to later.

Cognex's DataMan

DataMan Configuration

After securely connecting to your DataMan device and discovering it on the “Connect” page of the DataMan Setup Tool, double-click on your barcode scanner. You will be met with the “Introduction” screen shown earlier and can step through the setup wizard.

Calibration of the vision model, unique delimiters characters, partial results, and other settings can be configured here.

For integration with TwinCAT, the most important tab is the “Communications”, and again, verify that the IP address is on the same network as your IPC. The EtherNet/IP industrial protocol box must also be checked to allow detection by the EL6652 module.

Cognex's DataMan Configuration

TwinCAT Integration

I/O Setup

For this example, we’ll start with a blank TwinCAT XAE Project. I’ve added the I/O to match with my PLC hardware setup, which includes an EK1100 bus coupler, connected via RJ45 to the I/O port on my C6015-0010, and the EL6652 EtherCAT terminal.

I/O Setup

             
Now, we must add a new device by right-clicking the root of our device tree and selecting type EtherNet/IP Scanner (EL6652).

Adding a new device EtherNet/IP Scanner (EL6652)

At this point, you’ll want to load the input/output mapping of our DataMan 395X from a configuration file. By navigating to Cognex’s website, you can find and download the necessary file pertaining to your specific DataMan series, with extension “.eds”.

Dataman 390 EDS and GDS Files

Then, back in TwinCAT, we can import the .eds file by browsing our file explorer.

TwinCAT

Next, right-click on the EIP Scanner and select ‘Add New Item’, which will allow you to select the .eds file corresponding to the DataMan model you have.

EIP scanner

Now, double-click on your new DataMan Box under the EIP Scanner, and set the IP address to what you had previously configured in the DataMan setup tool.

Setup IP address in Cognex's dataman setup tool

Now, there are just a couple more settings to configure! One of them is to install the RealTime Ethernet Driver on the IPC, and the other is to create an IP address of the EIP Scanner itself. These are detailed in the “Task 2: Configure LAN Port for Ethernet/IP” of this DMC blog.

Ready to take your Automation project to the next level? Contact us today to learn more about our solutions and how we can help you achieve your goals.