Introduction: UCL - Connecting Node-red to a Siemens PLC Using KEPserver
Requirements
Node-red: https://nodered.org/docs/getting-started/installation
KEPserver: https://www.kepware.com/en-us/kepserverex-6-6-release/
Step 1: Step 1: Set Up the KEPserver
First set up an IoT Gareway in KEPserver. Simply create a new agent under IoT Gateway.
The new agent needs to be a REST server
Set the network adapter to local and chose a port. Note the address in blue as this is where to read using node-red.
Step 2: Step 1,1 : Set Up the KEPserver
Set the network adapter to local and chose a port. Note the address in blue as this is where to read using node-red.
The KEPserver is now configured.
Step 3: Step 2: Read the Data Using Node-red
Insert a HTTP request in node red.
The HTTP request needs to be set up to return a JSON object.
The URL is the same as was noted earlier, however it needs a bit more. http://127.0.0.1:55555/iotgateway//read?ids=” Channel name”. ”device name”. ”Tag name”
Reading this value will give you the data in a JSON format.
Step 4: Step 3: Setup Your Siemens PLC
First in order to communicate to KEP set "allow put/get" to true on your PLC. This setting can be found under "devices and network", by selecting the PLC and look in properties.
Save the data you want in a DB. Set the DB as unoptimised. Every value should now have an "offset" value. This is the address the KEP server reads.
The PLC is now ready to communicate with KEPserver.
Step 5: Step 4: Setup Your UR5 Arm
GDS files for your UR5, and a more in depth guide to setup, can be found in the link below
https://www.universal-robots.com/how-tos-and-faqs/...
The Short version is first install the GDS files. There after drob in an "URIODev1" in topology view. Press the blue text and assign it the PLC. Select the URIODev1 and in device view add all the modules in order.
On the UR5 enable "PROFINET IO Device". It can be found under "Installation".
a fully configued siemens project has been included. The project reads the orientation and temprature of each joint.
Attachments
Step 6: Step 5: Read Data Using KEPserver
The KEPserver can read data from unoptimised Data Blocks in TIA portal. In the included program a DB with some data. First setup the PLC in KEPserver. This is done by adding a "new channel" in KEP under "connectivity". In the "channel wizard" choose "siemens TCP/IP Ethernet". The channel name and device name is what is read in node-red. Simply leave the rest of the settings as they are.
The photos included show the syntax of a KEP tag, and the semiens variable "Joint_Temp_0" is what KEP reads using those settings.
Step 7: Step 6: Move the Tags Form Channel to IoT Gateway.
In the top of your KEPserver there is a function "Add multiple items". Mark you IoT server and press this button. In the tag browser select your configued device, and add the tags as needed. The name of the tag is the last part of the address node-red reads. A simplyfied flow-chart has been included showing the dataflow.