Codesys IIoT Libraries

CODESYS - IIoT Libraries

KatjaX
Community Manager
Community Manager

The product IIoT Libraries contains numerous libraries to support different communication protocols, for example MQTT and HTTPS, and includes tools for encoding and decoding data structures, for example JSON and XML. Moreover, libraries with POUs for direct communication with cloud services of individual providers (AWS, Azure, etc.) are provided.
The components contained in the CODESYS package are ideally suited for
communication in the IIoT environment.

Libraries for communication
Web Client

The CODESYS software package includes a library with function blocks for communicating with a web server via HTTP or HTTPS.

  • The HTTP method GET requests data from a web server.
  • The HTTP methods POST and PUT submit data from the controller to a web server.
  • When using DELETE, data is deleted from a web server.
  • The HTTP method HEAD returns the HTTP header.

The HTTP header of a request can be extended without any restrictions. In addition, function blocks are included for HTTP basic authentication and authentication via OAuth (Version 1a and 2).

MQTT Client

MQTT (Message Queuing Telemetry Transport) is an open-source IoT protocol that allows for the transmission of telemetry data as messages between devices. Device communication always takes place by means of an MQTT broker, e.g. Eclipse Mosquitto. Messages are sent and subscribed to based on topics. A topic corresponds to a path, e.g. device1/temperature. Subscribing to messages is done by specifying a topic filter. Wildcards are also permitted (+ for one level and # for multiple levels). The message format is not fixed, which means that a JSON string or any data structure can be transmitted.

With the MQTT Client library, messages can be sent from a CODESYS controller to an MQTT broker, and messages can be subscribed based on topics.

Mail Service

This library contains function blocks for sending, receiving, and deleting emails by means of SMTP and POP3 protocols. Communication with the mail server can be established either encrypted (TLS) or unencrypted. A sample project demonstrates how to use the function blocks.

SMS Service

With this library it is possible to send, receive and delete short messages via a GSM modem.

SNMP Service

This library makes it possible to read device information of printers, routers etc. via the SNMP protocol. The library provides function blocks to send and receive SNMP messages. The package contains the SNMP library and example applications.

Supported SNMP features:

  • SNMP GET: Request a value.
  • SNMP GET_NEXT: Request a value and get the OID from the next value.
  • SNMP Agent: Enables devices to request values from the control (agent).
  • SNMP TRAP: Send and receive TRAP/INFORM telegrams.
  • SNMP SET: Set values via SNMP.

The package SNMP Service SL.package contains following components:

  • SNMPServiceSL (Namespace: SNMP)
  • Project with example applications
  • CHM help
  • Product data sheet

SNTP Service

The library SNTP Service contains function blocks for easy implementation of SNTP client and server components on a CODESYS control (SNTP V3, SNTP V4). The function block SNTPGetUTCTime can be used to request the UTC time of a SNTP/NTP server. The function block SNTPServer can be used to build a simple SNTP server.

Function blocks (FBs) of the SNTP library:

  • SNTPGetUTCTime: FB to request the time of a SNTP server (SNTP client)
  • SNTPServer: FB to send the local server time (SNTP server)

AWS IoT Core Client

The AWS IoT Core service is a managing cloud platform from Amazon in which connected devices can work together easily and safely with cloud applications and other devices. The “AWS IoT Core Client” library provides function blocks for sending and receiving messages. Communication is encrypted and takes place by means of the MQTT protocol. In the AES environment, messages are typically transmitted in JSON format. The “JSON Utilities” library can be used for parsing and creating JSON files.

Azure IoT Hub Client

The Azure IOT Hub cloud service from Microsoft directly links IoT devices. For more detailed information, refer to IoT Hub I Microsoft Azure. The Azure IoT Hub Client library provides function blocks for sending and receiving messages. A sample project demonstrates how to use the library.

Google Cloud IoT Core Client

The Google Cloud IoT Core cloud service from Google is a service for directly connecting IoT devices. For more information, see Google Cloud IoT Core.

The Google Cloud IoT Core Client library provides function blocks for sending and receiving messages. A sample project demonstrates how to use the library.

JSON Web Token

The JSON Web Token library contains a function block for creating a JWT (JSON Web Token) on the controller. For this purpose, the algorithms HS256, HS384, HS512, and RS256 are supported.

The JSON Web Token package contains the following components:

  • IEC 61131-3 library JSON Web Token SL (namespace JWT)
  • Sample project JSON Web Token SL Example.project
  • Programming reference as integrated CHM help
  • Product data sheet (German and English)

Libraries for reading and writing of data structures
CSV Utility

The library CSV Utility provides function blocks to read and write CSV files. The library contains the components CSVReader (read a CSV file) and CSVWriter (write a CSV file). All function blocks can be used in a classical or object oriented way. An example project demonstrates the usage of all components.

INI File Utility

The product INI File Utility is a library to read and write INI files. The library contains function blocks to read, write and find values of INI files. An example project shows the usage of the library and their function blocks.

Content of the package:

  • Library INI File Utility SL (Namespace: INI_UTIL)
  • Example project with visualization to read, write and find values of INI files
  • CHM help file

JSON Utilities

The JSON Utilities library provides the following functionalities:

  • Read JSON files (UTF-8 and UTF-16)
  • Read JSON byte arrays
  • Write JSON files (UTF-8 and UTF-16)
  • Read JSON byte arrays
  • Search for keys, values, and child and parent elements

The data is stored in an array of structures. Data access and element search is performed by means of methods from the JSONData function block. The simple creation of a JSON-File can be realized with funcion block JSONBuilder. The function blocks JSONByteArrayReader and JSONFileReader read data in JSON format and save the values in the JSONData function block. Writing files and byte arrays is performed by means of the function blocks JSONFileWriter and JSONByteArrayWriter.

A simple REST client can be implemented easily in connection with the library "Web Client".

XML Utility

The library XML Utility contains function blocks to read and write xml files or xml strings on a control. All elements of the xml file are stored in an array of structures. The library also contains function blocks to find elements by name and attribute. The usage of the library is demonstrated by two example applications.

The library contains following components:

  • IEC 61131-3 library XML Utility SL (Namespace XML)
  • Example project XML Utility SL Example.project
  • Integrated CHM programming reference
  • Product data sheet (de und en)

MQTT Client App

MQTT Client AppMQTT Client App

Prerequisites
Support

ctrlX AUTOMATION Forum CODESYS - PLC Add-ons

Related Links

The Company

The CODESYS Group is one of the world's leading software manufacturers in the automation industry. At its headquarters in Kempten/Germany and its subsidiaries in China, Italy and the United States, the group currently employs 200 people. The CODESYS Group focuses on developing and marketing the manufacturer-independent IEC 61131-3 automation suite CODESYS and the associated product portfolio. CODESYS covers the complete software side of automation. Core products of the market-leading automation suite are the CODESYS Development System, the corresponding platform-independent control system CODESYS Control and the CODESYS Automation Server, the cloud-based industry 4.0 platform. The customers of the group, founded in 1994 by Dieter Hess and Manfred Werner, come from all areas of automation: manufacturers of industrial controls as well as their users or operators who automate or operate machines and systems with CODESYS.
CODESYS Group

StefanH
StefanH
Hi, I am Stefan and I work as a Product Manager in the ctrlX AUTOMATION software team. Contact me if you want to learn more about our solutions.
Editorial work by: KatjaX
Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist