MQTT Engine Module
Implementing MQTT in Ignition: Video 87 min video / 7 minute read
< Previous Video | Next Video >
Travis Cox installs and configures the MQTT Engine Module for Ignition. The module allows us to connect to an MQTT server and subscribe to data. It will automatically discover all the data that’s there and turn that data into usable tags in Ignition that you can add configuration to.
Travis: In this session, we're going to install and configure the MQTT Engine Module for Ignition. The Engine Module allows us to connect to an MQTT server and subscribe to data. Engine will automatically discover all the data that's there, and turn them into usable tags in Ignition that we can add configuration to history or alarming or be simply used in our screens. The first thing we have to do is install the module. For that we go to the configuration area, go to Modules, come down and install or upgrade a module, choose the MQTT Engine Module that we've downloaded previously, and install. Now, that we have it installed, the first thing we're to do is get it connected to one or more MQTT servers, so that we can discover that information. And for that, we go here to my MQTT Engine settings and we go to the server's tab. Here, we can identify one or more server connections. Now, you'll notice there's already a connection that's configured here by default, and it's set to go into our local MQTT server.
In the previous session, I installed the MQTT Distributor Module and it's already here on this machine. We also have Transmission that's publishing real data to that server right now. So this one is in fact connected, but if we need it to, we can go edit that connection, change the IP address or change username/password that we want to connect with, or of course we can add a brand new connection to a brand new MQTT server. We're going to specify that URL again, the authentication for how we connect, whether it's TLS and there's some advanced properties here, like if you want to identify the client ID.
So, coming back here, we already have that one connected, and that's it. Really, we're going to auto-discover all the information that's there. So we need to open up the Ignition Designer so that we can see those tags that are there. Let's go ahead and log in and we'll open up our project. Okay, the MQTT Engine Module adds a MQTT Engine provider to Ignition and so we can see that here, under our all providers inside the tag browser. So if I expand the MQTT Engine, you'll see there's a folder here for edge nodes. So there's anything publishing to that MQTT server, we're going to see them. So in my particular case, I've got the Transmission publishing in a group ID called Ignition with the edge node ID called Edge and the device called Device. Inside there, I've got process information and I've got simulation information. As you can see, these tags are publishing and are live right now.
So we automatically discover all these tags, and as you can see here, I can actually double-click on these tags, go in and apply configuration. Like if I want to add history to these or if I want to add alarming to these or add metadata, whatever it might be. However, if from the edge, you have identified metadata, that will automatically show up on these tags. So in this particular case, my accumulator level, the Engine units are already set for me, as well as the low and the high limits and any documentation or tool that we might have will automatically come up as well. These tags are discovered with context and that allows to really use that fully inside of Ignition.
Now also in the previous session, I sent up UDTs along with Transmission. And for Engine, we automatically turn that into UDT instances. So you'll see here, under my data types that I've actually got a motor data type that's being published. In my motor's folder, I've got all of those motors that are configured and the values are coming through. And all I gotta do here is go to my motor definition and I can apply configuration to that like history alarming, and that's going to apply to every single instance. So I just have to do it in one place. Really makes it simple, especially if you have multiple Edge Nodes are out there publishing on the same UDT. It makes it really easy for our configuration 'cause we only have to do it once.
Not only are we getting the tags that are being sent up, but we are also getting a lot of metrics that are being sent up as well. So, for example, for this particular device, I can see there's device information. I can see basically if it's online, what the last data message size was, and updates in time of when it was last online or last offline. A lot of metrics that are really important for us to know so that we can trust this information. Of course, if we were disconnected, we're going to get bad quality on all these tags. We'll get overlayers on our screen, so we would know what's going on there. Not only are we getting that per device, we're also getting that for each edge node. And we can see node information here on that particular edge node or edge gateway, like whether it's connected, how many bytes have been sent and received, and if there's new latency, what that latency looks like in a sequence so we can see that it's continuing along there.
A lot of information, as well as we get some node control where we can basically tell it, "Hey, go to the next server that's available with net server set or do a rebirth or do a reboot, to have some control on that, it would go and send that down to the edge gateway on the edge node, and it would take care of that. There's also information just on Engine itself, so there's a lot of message diagnostics here and information for Engine. So we can see the total amount of bytes received and transmitted we can see all of the MQTT servers and whether it's connected, if it's online, what the latency is with those as well as we can see how many nodes, edge nodes are online, how many are offline? We get a full data set of that and we can note... We can see what was the last one to actually connect. And we can also, look at devices and see how many devices are actually in the system and are online or offline.
We can use all this information on our screens and really provide a lot of details into what Engine's doing. But of course, if we were to go publish any new data that would automatically come into Engine. And so that's really easy to show. On this particular one, I'm using Transmission to publish a data, so under the simulation, let's add something new to this, so we're going to go up here to our tag database and under our tags, and this is under simulation we're going to add a new memory tag. I'm going to call it simply Test and make the integer a value of one. And I want that to get published up. So under my Transmission, I'm going to have it send that up. So we're going to go to read-write mode, I'm going to refresh Transmission, so that's now going to... And find that new tag that we added and it's going to publish that to the broker that we can then see here on Engine, so Engine will automatically discover that information coming in.
So if I go back to Engine now, let's refresh everything, go to Engine, my Edge nodes there, I'm going to see under Edge, under my Device, under Simulation, I'll now see that test value that's coming through. Not only that, I had another edge, I had another group that just came in that we got published, as well where I can see data from that one here and this was just from some test tags that we put in there too, so it discovered both of those at the exact same time, again automatically brought them in here to Engine. Now, of course, Engine does support reading and writing. Right now, it's in a read-only mode. In the next session, we're going to talk about how we can actually ensure that we can write down to the PLC.
Want to stay up-to-date with us?
Sign up for our weekly News Feed.