How to Use FrameworX as an MQTT Gateway with Sparkplug B | Industry 4.0 Demo

In this hands-on demo, Scott Gray (Senior Solutions Consultant at Tatsoft) shows how to configure FrameworX’s built-in Sparkplug B MQTT broker to bridge the gap between OT and IT systems.

You’ll learn:

  • What Industry 4.0 and Unified Namespace really mean
  • Why traditional polling architectures fall short
  • How to create real-time tags, simulate PLC values, and use MQTT clients
  • The difference between Sparkplug B and standard MQTT
  • How FrameworX acts as a smart gateway to ERP and IT tools

By the end, you’ll see how FrameworX enables a lightweight, scalable, event-driven architecture perfect for modern industrial applications.

Perfect for: Engineers, SCADA developers, and anyone working on digital transformation or smart manufacturing.

Full Transcript:


Hello everyone, my name is Scott Gray. I am a senior solutions consultant at tatsoft, the makers of Frameworks SCADA HMI software. Today I’m going to be showing how to configure the built in sparkplug B MQTT broker in Frameworks to create an OT to IT gateway. Before diving into the software, I want to discuss the Advantages of Industry 4.0 and describe the demo that I’m going to create. First, let’s talk about where the term Industry 4.0 came from. It is the fourth industrial revolution. The first revolution was the use of steam power in the 1700s. Second was in the 1800s and included electricity and assembly methods that facilitated the mass production. In the 1970s, programmable logic controllers and human machine interface started to replace relays and mimic panels. And there was the use of electronics in manufacturing processes. 


Today we have Industry 4.0 which uses technologies like the industrial Internet of Things, artificial intelligence and the cloud to share data and allow companies to make better decisions and to increase efficiency, lower costs and improve quality. The move from Industry 3.0 to Industry 4.0 is sometimes referred to as a digital transformation. And companies that utilize industry 4.0 are called smart factories or have what’s called smart manufacturing. This is the Automation Pyramid, which is the industry 3.0 way of visualizing data sharing. The idea was that data would be pushed up from field devices all the way to business systems like ERP software. Because the more data software has, the better the decisions that can be made. In reality, very few facilities had data make it all the way to the top of the pyramid. Why? 


Because the interfaces were done through things like APIs which were very complicated plus operational technology. People in IT rarely cooperated because they had different priorities. Companies understood the importance of capturing processed data. So they would use SCADA software to store the information in a relational database. The problem was is that no one would look at the data or use it. And in order to optimize the process. This shows the pyramid as individual software and controllers. As you can see, it is very complicated. Every software that wants data must have a connection to the source of the data, possess the correct driver to communicate and request the data at a specific interval, typically every second. Which is why we call it a polling architecture. For large applications with thousands of values, the amount of network traffic can become a problem. Also is not very scalable. 


This is the Industry 4.0 version of data sharing, which we call a unified namespace. In this case it is a ring topology with a broker in the middle which manages the communication and clients connected to the broker. We call this a PUB sub architecture because clients either publish data topics on the broker or subscribe topics on the broker. A value is only published to the broker and the client is only updated when the value changes. We call this an event driven architecture and it results in far less network traffic. The value of the topic is referred to as the payload. The protocol that the broker uses to communicate to the clients is called mqtt, which is a lightweight PUB sub messaging protocol for the Internet of Things. 


For the industrial Internet of Things, sparkplug B is used as a protocol which is based on MQTT but imposes a topic structure that includes a time and date stamp and the group node device that defines where the data came from, which makes it more useful industrial applications. The other thing sparkplug B does is provide a last will and testament, meaning the broker will issue a birth certificate to all clients when a particular client comes online, or a death certificate when a client goes offline. This is important for software that is making real time decisions such as AI or dynamic scheduling because they need to be analyzing valid data if they receive a death certificate. The structure defines where the data is from and they can make decisions appropriately. 


The demo I’m going to create will use the Frameworks broker to communicate real time data via sparkplug B to a client and production summary information to a client via mqtt. In this way, Frameworks is acting as a gateway between the real time OT environment and the IT environment. This is important because IT software tends to be MQTT compliant, but not sparkplug B. So finally we’ll be getting data all the way to ERP and other business software. To do this I’m going to create two tags, Product A and Product B. Then I’m going to configure the driver to communicate to a modbus simulator to simulate communicating to appeal C, which is how Product A and Product B are going to get real time values. 


Then I’m going to create a tag called Product Total and create a script that every five seconds will add Product A and Product B together to simulate a product total. I’m going to publish Product A and Product B to the framework’s broker, which will communicate to a sparkplug B client called mqttfx. Then we’re going to publish the product total to the broker and it’s going to communicate to another client called MQTT Explorer, which is only MQTT compliant and it is going to subscribe to product total. When you start Frameworks, it launches the Solutions Manager in the center. You see your solutions. The ones that appear are in the folders that you select. So you can dictate which solutions appear in the Solutions Manager. I’m going to create a new solution and the first step is to choose the license your solution will run on. 


Frameworks is the unlimited license. That’s unlimited tags connected to external sources and unlimited clients. But also it includes all of the functionality of Frameworks. Other systems. When they say unlimited, they mean tags and clients, but you still need to purchase the modules to get the functionality you require. That tends to drive up the cost and a lot of the time it costs a lot more than Frameworks, typically more than double. Factory Studio also has all the functionality but is limited in the number of tags connected to external sources. There’s no limit on the number of internal tags and the number of clients. Machine HMI are also licenses that are limited in the tags and clients and also dashboards and reports are unavailable because they tend to be more supervisory functions. And Edge Connect is the edge computing license. 


There are unlimited tags, but there’s no graphics. The functionality is limited to things like data collection, scripting, database connectivity and MQTT and Spark Plug. I’m going to select Frameworks and then hit Next. Next you choose the platform and the choices are Multi Platform and Windows. If you are running on Windows, you may think you should select the Windows platform, but actually we recommend that you select Multi Platform which includes Windows. The reason is Multi Platform is based on Net8, also known as Net Core, which is faster and has a smaller footprint. The Windows only platform is based on. NET 4.8, also known as NET framework and you should only use it if you want to utilize Windows features like Active Directory. Finally you name your solution. I’m going to call mine Video Solution. 


You select the directory you want to create it, in which I am going to change it to demos with the other ones and then you select a template. I am going to select Trend and Alarm Pages template and then create a new solution. The new solution now appears in the Solutions Manager. To edit this solution you can either double click it or we can select it and hit Edit. The first thing we have to do is create the tags. So under Unified Namespace I click tags, then I can hit the plus to create a new tag. This one’s going to be called Product A and I’m going to leave all these other fields blank except Visibility. So there’s three choices under visibility. Private Protected and Public Private the tag is only available to the local solution and its redundant pair protected. 


The tag becomes visible to external connections for read only, you cannot write to it. And public, the tag is accessible to external connections for both reading and writing. So I’m going to select public. I’m going to create the next one. Now, for product total, I’m going to leave it as private because we’ll configure its accessibility under the MQTT driver in this demo. Product A and Product B contain real time data. I don’t have a plc, so I’m going to use a modbus simulator. The first thing I do is to configure the driver. So under channels I’m going to add the modbus protocol, I’m going to select TCPIP and then I can actually run the simulator. This is a freeware modbus simulator, but we’ve created a button in the driver setup that allows you to launch the program. Next I’m going to go to nodes. 


This is where you’d set up an actual PLC on that modbus network. And here is where you’d put in the IP address of the plc. I don’t have one connected, so I’m just going to use local host, then hit test. It’s okay. And now I’m going to create the connection from the tags to registers in the modbus. So first I’m going to do Product A, select the modbus protocol and I’m going to use the default address. Next I’m going to create a link from Product B again select the modbus and in this case I’m just going to Change that to 2. Now we want to publish these two tags to the Tatsoft internal Sparkplug B broker. 


To do that go to Runtime, click on startup and if you see this checkbox, we click that and any tags where the visibility is set to protected or public will now be published to the built in MQTT sparkplug B broker. I’m going to run the solution and because we chose the trend and alarm template we have some built in displays. This is the home screen. There’s a trend screen, an alarm screen, but I haven’t created any animations to show the values of Product A and Product B. So I can come down to the startup window. This shows all the modules running or their state and whether they are running or not. And then also allows you to start and stop each one individually. If I click watch, I get a watch window. I can select tag. 


And now you see Product A and Product B and their value. If we look back at the simulator you can see they’re the same. So it confirms that I’m communicating to the simulator. We want to see the values in a sparkplug B client. So I use MQTT fx. I’m going to connect to the tatsoft broker hit subscribe. I’m going to scan. You see here it says tag. You see product A and product B and their values 112 and if I bring back the watch window you can see that they’re the same. Before setting up the MQTT communication I want to show a couple things. This is the MQTT client that I use which is called MQTT Explorer. I click on the I pre configured the communication to the tatsoft built in broker connect. Notice how there’s no information here. 


The reason is that it’s an event driven architecture so there’s nothing giving it information yet. So let’s go and start our application notice now it says sparkplug B. That’s because we only published product A and product B to the broker and the default is sparkplug. And again we talked about the fact that you get a imposed structure of group node device which you can see here. We also talked about the last will and testament. So you can see that I started this, I started the solution after I opened MQTT Explorer. So we have a birth certificate. The problem is that this client is only compatible with mqtt. So if I click here it can’t parse the data. It’s all just gibberish. And that becomes the problem in communicating in some instances from a real time system to IT systems that are only MQTT compliant. 


Now we’ll set up the MQTT communications and you do that through a driver under devices. So just like when we set up the modbus we’re going to create a MQTT channel, then a node instead of modbus I need to select mqtt. This is the communication information. It defaults to the local host which is what I want. If I hit test it says ok so I can communicate to the broker and then we have to go in and create a point here I’m going to select product total MQTT and we have to create a topic on the broker. It doesn’t have to be the same as the tag name. But just for simplicity’s sake I am going to do that in this. 


Remember I set the visibility or left the visibility for product total at private because you can set up the access type in the MQTT driver. Here’s where we do that. It defaults to read, but I will change it to read Write. So now if we bring up MQTT Explorer again, connect to the tatsoft broker. You can see that we have the Spark Plug B, but now we have product total and the value is displayed in a format that we can use. And that’s it. That’s how you connect tags within tatsoft to a sparkplug B client and to an MQTT client, thus providing a gateway between the operational side of the business to the information side. Thanks.