Using the Parser Function the Function Block Factory from SICK for easy data interpretation of IO-Link Sensors with in the PLC App on the ctrlX CORE using Ethercat IO-Link Master SIG350.
IO Link data could be difficult to parse if you do not have an IODD Interpreter on board. For this case we want to show you a very efficient way to solve this issue.
This instruction shows how to use the IO-Link Parser from the SICK Function Block Factory within the ctrlX CORE.
The instruction has been created based on
ctrlX WORKS V1.60
ctrlX CORE EtherCat Master App V1.60
ctrlX PLC Engineering V1.60
and exemplarily with following devices from SICK
SICK Sensor Integration Gateway // SIG350-0006AP100
SICK Condition-Monitoring-Sensor Multi Physics Box // MPB10-VS00VSIQ00
Please follow this Tutorial from WAGO for the integration of the SIG350 into the ctrlX CORE
Th e following procedure will increase your speed of the workflow because you do not have to parse the data manually. As you can see in the IO-Link Datasheet example below this could be a lot of work to parse all the data (20 bytes)
IO-Link Datasheet example
In this documentation I will show you how to parse the data fast and easy .
Step 1 - Install the library
After creating the library on cloud.sick.com (you need to register of course) in the function block factory with the concerning IODD for the device you will receive the file. First install the library.
Press Install on the right-hand side.
Choose the following two libraries in the folder which you have receive d.
Step 2 - I mplement those libraries into your project with the following steps
Double click on Library Manager.
Press Add Library
And choose the two libraries which we have installed beforehand.
Library 1 and 2 added
Step 3 - Implementation of the library in the code.
Connection between the variable and the Data layer.
Connection between variable and Data layer
In this picture you see the name of the function as well the name of the data structure we will need.
Function and data name
A function is not needed to be declared, because in the function there will be no data stored over one cycle. The data structure is necessary to be declared.
It looks like this.
Now we c o me to one of the last steps, calling the function.
Calling the function
All together it looks like this.
After translation and download you will see the correct parsed data within the data structure.
Sensor Integration Gateway SIG350
Condition-Monitoring-Sensoren Multi Physics Box
From factory automation to logistics automation and process automation, SICK’s sensor solutions are keeping industry moving. As a technology and market leader, SICK provides sensor intelligence and application solutions that create the perfect basis for controlling processes securely and efficiently, protecting individuals from accidents, and preventing damage to the environment.
... View more
This procedure is not addressed to the basic user, in order to fully understand what is happening and to debug the setup it is necessary to have a good knowledge about Arduino environment. Furthermore the document is not a complete setup to a production case.
Dealing with Arduino takes many advantages but also some challenges in an industrial setup:
It's not easy powering it
It's not easy to veiculate data
The user must be able to create (or buy) some "enclosure" to protect it
Coming to ctrlX AUTOMATION it could be the swiss pocket knife and could easily solve the first two problems in many common cases. How? ctrlX AUTOMATION can provide power using the USB port. The data can be easily obtained using the Arduino serial port over USB and managed with Node-Red.
Here we have the scheme of what we need:
ctrlX Arduino scheme
The test has been done with:
ctrlX CORE V1.14
Arduino Nicla Sense ME
Step 1 - Create your Arduino script
The first step is to create a suitable arduino script. The best way is to start from Nicla-Sense-Me: Getting-Started and follow all the main steps to setup the Arduino and Nicla's environment on the PC. We're going to use also the ArduinoJson library so this must be also installed inside the Arduino Environment: ArduinoJson.
The easiest way is to start from the Arduino standalone example and modify it including the Json streaming functionality:
Create Arduino script
Let's review together the example shown here.
In the first part of the script we have to:
Include the necessary libraries
Create a Json document reserving some space
Define an Arbitrary object ID
Define the sensor instances.
Setup json script
Initialization: we're using the standard Arduino setup function to start the serial interface with 115200 baud as speed and starting the sensors.
Arduino setup function
Runtime: we're just running constantly the sensor update and calling every 100 milliseconds the streamerSerialJson function.
Constant sensor update
streamerSerialJson: this function uses the Json Library to:
Clean any time the document
Pack in his structure the measurements and the ObjectID
Serialize the json string over serial
Send the "/n" character to terminate the message
Stream serial json
The serial port output would look like this:
Serial plotter output
The data are well organazied in a Json and there is the id of the object which is sending the measurements.
Opening the serial plotter it's possible to see an overview of what the board is sampling:
Step 2 - Retrieve data with node-red
To get the data from the Nicla board we need to setup a "serial in" block with the following setting: any time we receive a "\n" the input is splitted and provided as a string.
ge Get data from Nicla board
Once the data are inside ctrlX CORE the trick is done! Using the json object we can easily convert the string into a json object and manipulate the data.
String into json object
Arduino is the leading open-source hardware and software company in the world. Born to provide an easy-to-use platform for anyone making interactive projects, Arduino has reached a growing community and adapted to new needs and challenges, branching out into products for IoT, wearables, 3D printing, and embedded environments. As of today, the Arduino community includes approximately 30 million active users.
With the Pro Business Unit, Arduino caters to companies that are interested in going beyond the concept and rapid prototyping phase, to start mass production with the support of a qualified industrial partner and high-performance technological solutions.
... View more