The Industry 4.0 concept includes the incorporation of Internet-Of-Things (IoT) to the industry as one of its strong points. We would like to use the myRIOs that we have in the laboratory as IoT prototypes, but it is not straightforward because the device is not ready for that and the network at our laboratory has limitations too.
But we are stubborn, and we have shown it is possible!
First, we have to choose the protocol to make our device behave as an IoT thing. There are many, but one of the trends right now is to use MQTT. MQTT is a very lightweight protocol, so it can be implemented in very simple devices. The main idea is that we have topics (a sort of postbox) that can be created (published) or subscribed to, and after that we can read/write messages there. If you want to learn more about MQTT, there you have a good site:
https://developer.ibm.com/articles/iot-mqtt-why-good-for-iot/
To make MQTT work, we need a sort of server in the other extreme, called broker. The topics will reside in that broker. We will make our tests with MQTT.fx, but there are many others. We have installed that in our PC, and we have to run it and connect it to make it work.
https://mqttfx.jensd.de/
In our thing, the myRIO, we use LabVIEW for programming it (most of the times). LabVIEW is OK for communications, but it does not have any MQTT native library, so we had to install one from daq.io. After that, we need to do the following steps with the myRIO:
- Give Internet connection to it connecting it to a Wi-Fi
- Install on it the software package named "HTTP client with SSL support"
- Change the admin user's password to something not empty
- Program the myRIO with something similar to the next figure
And that's it! WE can check that it works in MQTT.fx as you can see in the last figure. In our case, we send ON or OFF depending on the state of a push button. [For some reason, the first time you run the program each time you create a new topic, it fails, but it runs OK the second time and further. We will try to fix that].