Home

aliazzz hermsen i-campbell
There is a newer version of this page. You can find it here.


avg reading: 5 minutes

Introduction

Sparkplug™ is an addition on top of the regular MQTT specification. This addition extends regular MQTT with several very smart features.
A flexible architecture which allows you to auto-discover Edge nodes (Edges), devices and data (Metrics). You can add or remove nodes and devices on the fly to your setup. Whether your devices are state-of-the-art or legacy, the Edge is able to interface with all types of physical and/or software devices. Last but not least, your data can be delivered securely via the latest industry strength security specifications and with rich meta-data for added context.

So, imagine Industrial Internet of Things (IIoT) without the burden of re-inventing the wheel each time you change your installation. co⚡e: Sparkplug™ MQTT edge and host offers a flexible, modern, free and open way for any of your devices to exchange data using MQTT. You only need a proper MQTT broker and this library Just instantiate, configure and connect, done! This is what co⚡e: Sparkplug™ MQTT edge and host offers you.

Sparkplug™ Benefits at a glance

Sparkplug™ adds many powerful benefits on top of standard MQTT and is here to change the IIoT landscape.

Benefit Standard MQTT Sparkplug™ MQTT
Simple
Open
Pub/Sub
Last Will and Testament per MQTT node
Bandwidth efficient
State aware connections
Decouples devices from applications
Latest in TCP/IP security
By design Auto discovery of Edges, Devices, Metrics and node capabilities
By design Metadata for metrics, nodes and devices
By design State Aware metrics data, meta data, nodes and devices
By design Report by Exception (RBE)
By design Bi-directional data transfer between Nodes and Host
File Transfer *
Historical Store and Forward *
High Availability *
  • Advanced features are subjected to the roadmap

Goal

Providing the CODESYS ecosystem a full specification compliant implementation of Sparkplug edge and host nodes, which run on any sufficiently capable CODESYS based controller. Since the code is written 100% IEC code, the library is fully portable over various brands and types of controllers.

At this moment in time, there are two leading industrial IoT protocol families: OPC-UA and the MQTT family based protocols. Sparkplug is part of the MQTT family based protocols. Both OPC-UA and MQTT families of protocols are good, very reliable and very secure and share a partly overlapping use case. However, there are caveats in using OPC-UA or MQTT. OPC-UA itself is not implemented in open IEC-ST and several extensions are currently not available, like "Store & Forward", and so OPC-UA has a lot of untapped potential. MQTT is merely a means to get bytes from point A to B. MQTT does not prescribe the user how data should be mapped or how often it is updated. The user is free to use any data format and is responsible for adding context, if any. The user is also responsible for regularly sending the data. Whilst this seems great on first sight, this hinders quick, smart and vendor neutral data exchange. The 'magic' needed is not readily in place and needs to be implemented and tested in every project.

This is where Sparkplug steps in - it provides you with open, lightweight, vendor-neutral, well defined data exchange, a single source of truth, state aware transmission and state aware data on top of what MQTT already offers, while at the same time keeping CPU and bandwidth consumption to a minimum * .

In short, you don't have to do anything special in order to enjoy a modern, state of the art data exchange which is secure, reliable and fast ** .

This project aims to "marry" a CODESYS based controller with the Sparkplug IIoT protocol and open up the vendor-independent CODESYS ecosystem with the IIoT market using all advantages that the Sparkplug protocol offers.

** sub second data update rates can be achieved but depend highly on your specific network architecture.

Last but not least;
Our library has been built in open source, which should allow experienced programmers to add/remove or alter parts of the code. It allows a for peer to peer code review and to build/expand on the existing code base. The Sparkplug specification has been released with open-source in mind, and we are delighted to share our library also! Of course the CODESYS runtime and MQTT library we utilise are not open-source.

Flexible Architecture

An overview of the components in this CODESYS library mixed with third party capable SparkplugB MQTT devices;
SparkplugB CODESYS Architecture
Details on the different components in the infrastructure:

Development

Some tools we use to develop our library.

Ignition Primary Host node

We test our code against Ignition as Primary Host node and against the Sparkplug TCK when it is available.
However, we are also in full preparation of developing a CODESYS variant of a Primary Host.
To experience the full capabilities of Sparkplug in action, you can create your own free test system using this setup guide: Setup a test system.
When our Primary Host node has finished, there will be no explicit need for Ignition anymore.

TCK Toolkit

We will test and verify our library against the TCK toolkit once it comes publicly available.

MQTT Explorer

MQTT.fx supports limited SparkplugB payload protobuffer decoding so it is a very good & flexible test client.

http://www.jensd.de/apps/mqttfx for more information
MQTT.fx is published under Apache License, Version 2.0.

MQTT Client Library Usage

Under the MIT license you are free to use the co⚡e: Sparkplug™ MQTT edge and host library. You are even free to implement and use another MQTT client implementation. If you do, we urge you to implement a stable and 100% MQTT v3.1.1 capable library. However, in this project we will use the following library;

https://store.codesys.com/iiot-libraries-sl.html
Without a valid license, the software runs for 30 minutes in demo mode.

Progress

Timeframe

Our software is aimed to be "best in class" and easy in use. It is being developed by professionals as individuals, not as a company. We chose to to give this project our valuable resources: time and effort. This experimental and open form of development stimulates our creativity in full freedom without any boundaries or limitations. This means that we do not have any hard deadlines to meet apart from those we impose on ourselves. Of course we set milestones and progress is being made as you can see.

11 may 2021: Public Preview of CODESYS based SparkplugB PrimaryHost Node now available for download

Since we did a "forced" revision on the Edge and Device, we now are reaping the benefits of that revision in the Primary Host node.
Development of the standard version of Primary Host Node is now in such a stage that we feel confident to show a preview.
You can find a fully working example with a preview version of standard "Primary Host Node" and fully working standard version
of "Edge and Device" in the downloads section.

31 mar 2021 : Major updates for Edge / Device and Primaryhost

The primaryhost, edge & devices now use a common 'FB_Metric' Function Block.
Usage of host-, edge-, and device-metrics is equalised which helps simplify and streamline your code significantly.
Edges and Devices publish data predictably and reliably, because of a major overhaul to the publish data notification architecture.
The change has proven to work outstandingly with large amounts of payload data in combination with a sub second update rate.
The Primaryhost utilizes this mechanism for sending NCMD's or DCMD's in due time.
Some bugs in the Device still exist and will be dealt with first.

5 mar 2021: CODESYS based Primary Host node sneak preview

The CODESYS based Sparkplug Primary Host acts as a lightweight CODESYS alternative to Ignition's Primary Host Node (Primary SCADA). Any compatible CODESYS runtime can be turned into a Primary Host and can detect any connected Edge Of Network node, Device, Metrics and capabilities associated, just like Ignition's Primary SCADA Host can!
Since we will (obviously) not implement a full fledged SCADA in the PLC, you can bring your own SCADA aka BYOS. Just install a SCADA of your favorite choice on a machine somewhere in your architecture and connect it with the CODESYS Primaryhost. No SCADA? No problem! You can always run a local target or web visualisation in the CODESYS controller on top of your project or even do both!

The current Primary Host version supports detection of Groups, Edges with metrics and Devices with metrics. Received NBIRTH certificates are processed and the detected resources are claimed from resource pools. Furthermore NDATA payloads and NDEATH certificates are processed and the corresponding Edges and Metrics are updated. DBIRTH, DDATA, DDEATH implemented.
The PrimaryHost will be extended with exciting new features during the next period, so check this page regularly.

The following preview shows a fully configured Primary Host (topmost FB) and some GetMetricByName() calls (bottom 4 FB's).
The GetMetricByName() calls are ideally suited in any M2M usecase (planned and in preparation).
If you only have need for a Primary Host, you can omit all optional GetMetricByName() calls and your are ready!

Roadmap

This roadmap is subjected to change without prior notice. No liabilities shall be taken!
Milestones which have been completed are clearly marked.

v1.0.0.0

  • Basic MQTT Publisher/Subscriber implementation (FB_MQTT_PubSub),
  • Basic Google Protobuf payload encoder / decoder (FB_Payload_Simple),
  • Basic Metric Support for Bool, Real, DWord, Int, Byte etc, etc (FB_SparkplugBSimple, etc, etc.),
  • Basic SparkplugB implementation, responsible Topics & sending messages (No support for receiving commands apart from Rebirth),
  • Basic EoN Node, responsible for publishing Node/Device metrics (FB_Edge_Of_Network_Node),
  • Basic EoN Node TLS Connection Support,
  • Basic EoN Node Server Command support: Rebirth,
  • Debugging / Optimization/ Refactoring of Minimal Viable Product.
  • Release ofPackage v1.0.0.0

v2.0.0.0

  • Basic datatypes metrics support,
  • Device support, acts as a digital representation of a physical device sending metrics,
  • Receiving Server commands, setpoints etc,
  • Bind multiple Devices to an Edge (on the fly capable),
  • Machine to Machine communication,
  • Primary Host node, CODESYS based Primary Host Node Implementation,
  • Support for Templates
  • Support for Aliases,
  • Debugging / Optimization/ Refactoring of Standard package,
  • Release of Package v2.0.0.0

v3.0.0.0

  • File transfer,
  • Historical data support,
  • Payload compression,
  • IoDriver,
  • Debugging / Optimization/ Refactoring of Advanced package.
  • Release of Package v3.0.0.0

Requirements

System requirements and restrictions Info
Programming System CODESYS Development System Version 3.5.16.0 or higher
Runtime System CODESYS Control Version 3.5.14.0 or higher
Licensing A separate CODESYS IIoT libraries SL per PLC or Machine
Required Accessories Any 100% fully compliant MQTT v3.1.1 broker or cloud service. Sparkplug requires the following: QoS 0 and 1, Retained Messages, Last Will and Testament, A flexible security system.
Restrictions Brokers or cloud services like AWS IoT Core, Azure IoT Hub or Google Cloud Iot Core are not supported. They do not not implement MQTT v3.1.1 in full. Ask Google, Amazon or Microsoft for a fully compliant MQTT v3.1.1 implementation.

NOTES

  • If you have no CODESYS licenses available, you can still enjoy Sparkplug with the following limitations in mind:
  • Any unlicensed CODESYS runtime runs in a DEMO trial period for 2 hours, after that period you must restart the runtime,
  • Any unlicensed IIoT SL library runs in a DEMO trial period for 30 minutes, after that period you must re-download the runtime
  • On pricing of a CODESYS runtime read this FAQ [questions:#9]
  • Because this library is MIT licensed you can exchange the licensed MQTT Client SL for any other flavour MQTT client as you see fit, but you must do so yourself.
  • Offcourse we are happy to provide you with our advice and / or some assistance.
  • Ignition's SCADA as host is not necessarily needed since we implement a 'lightweight' primary host node, but if you wish you can always choose it;
  • Ignition Enterprise SCADA runs in a DEMO trial period for 2 hours or choose to opt in for a FREE maker Edition.

Download

By downloading and using our software you abide by the MIT License
The Sparkplug library itself is MIT licensed and open sourced, but to run it for more than 30 minutes you will need to purchase an IIoT Libraries Bundle SL from the CODESYS Store, as we make use of the MQTT Client contained in it.

Sparkplug Preview Library v1.4.2.13

11 may 2021: First Public Preview of a CODESYS based SparkplugB PrimaryHost Node


v1.4.2.13 First Public Preview of a CODESYS based SparkplugB PrimaryHost Node

  • For a list of full capabilities see Roadmap
  • See Requirements for requirements
  • Numerous bugfixes and improvements
  • Implemented Bidirectional communication between CODESYS based Primary Host Node, Edge of Network (EoN) or attached Devices.
  • Implemented handling of multiple Devices connected to an Edge,
  • Updated TLS Security handling,
  • Updated MQTT Client version,


Download PREVIEW SparkplugB v1.4.2.13 library

Download PREVIEW SparkplugB v1.4.2.13 example

A small guide on how to run the example can be found here
Preview how-to

SparkplugB v1.0.0.0 Basic Package

1/1
IEC SparkplugB v1.0.0.0 Installation
  • Turns your CODESYS controller into a SparkplugB Edge of Network Node (EoN).
  • This package contains all components in a convenient single installer.
  • See Roadmap for a list of basic capabilities.
  • See Requirements for information on system requirements and restrictions.

Download v1.0.0.0 Package


@hermsen

@i-campbell

Sparkplug™ and the Sparkplug™ logo are trademarks of the Eclipse Foundation
Copyright © 10/11/19 Eclipse Foundation, Inc. https://www.eclipse.org/legal/efsl.php