Connecting Ignition to Keyence PLCs
With the world’s supply chain currently in chaos, companies are branching out to try new PLC hardware options. At of the time of this writing, Allen Bradley hardware of any type is either 10x the price from resellers, or has an “at least 6-month” lead time from any Rockwell Distributor. Even our friends over at Opto22 have moved from “everything is in stock all the time” to a 4-6 week lead time for PLCs and output cards.
We’ve used Keyence PLCs in the past, and were recently tasked with a project where we would have normally thrown in a CompactLogix PLC. The customer chose a Keyence PLC as they have other Keyence hardware in their facility—and liked the customer support they had experienced. They were using Ignition for their SCADA system, and we were building a new HMI for this project on their gateway.
OPC-UA to the Rescue
The first step for using any new PLC platform with Ignition is to understand how you will communicate with the hardware. In this case, Keyence offers a built-in OPC-UA Server on their hardware. This is similar to the offering on Siemens S7-1500 and S7-1200 PLCs. For the purposes of connecting with Ignition, the built-in OPC-UA Server makes the process a breeze.
The first step is to enable the OPC-UA server in the Keyence PLC, and set an IP Address. To do this, right click on the PLC in the tree in KV-Studio and go to OPC-UA Server Settings:
Once inside the OPC-UA Server Settings dialog, select “Enable” for the OPC-UA Server Enabled option, and set your IP address for the OPC Server. This should be the same as the IP for the PLC, but with a different format including the opc.tcp and port number:
Next, click the ellipsis button next to <Setting> to see the OPC-UA Server settings. Here you will set up your various security and certificate settings. For this project we will keep it simple with anonymous login—but your mileage may vary.
The next step is to set up the tags that will be exposed on the Keyence OPC-UA Server. To do this, double click on the “Variable” menu in the tree to open the variable editor. Here you can define the names of the tags for the OPC-UA server, what address they reference in the PLC, and how they will be accessed by Ignition.
We have a number of variables defined, mapped to various R addresses as booleans, and they are InOut type on the OPC-UA connection. This means Ignition can read and write their value to the PLC.
Connecting Ignition to the Keyence OPC-UA Server
Next we will go into our Ignition Gateway. You’ll want to go into the Config page, then scroll down to OPC-UA Client->OPC Connections, then “Create New OPC Connection”. Select OPC-UA and then click “Next”.
Here, you will enter the endpoint URL from the Keyence PLC, in this example case: opc.tcp://192.168.100.20:4840
Click Next, and then you will be able to select the server. In this case, it is the only option available.
Click “next”, then on the following screen you will select how you want to connect to the OPC-UA Server. In our example, we will use the first option.
Click "next” then select “yes” to trust the certificate.
Click “next” and then you will be able to confirm the settings. Click “finish” to go to the final screen.
Once you click “finish” you will be taken to the device configuration page. For now you can click “save” to see the device and that it is connected.
The main KV OPC UA Server configuration page in the Ignition Gateway
Now that the device is created, you can go into the Designer, open the OPC Browser in the Tag Browser pane, and see that all of the tags in the Keyence PLC available for use in Ignition!
Wrapping Up
Congratulations, you now know how to connect a Keyence PLC to your Ignition Gateway using OPC-UA!