Case Study
As someone who’s worked with various industrial automation systems, I’ve often seen companies struggle with effective real-time monitoring and data logging. Even today, many organizations find themselves in a position where they can’t easily track production metrics or predict equipment failures, leading to unnecessary downtime and operational inefficiencies. In this article, I’ll walk you through how I tackled these issues head-on using the Advantech WISE-4050 module, a few clever integrations using Coreflux’s stack, and some good old troubleshooting.
The first challenge I faced was getting the module to communicate effectively with our existing infrastructure. Initially, the device was set up with its default IP (10.0.0.1) and i had to manually change my machine’s IP to access the web configuration interface. It wasn’t the most intuitive process.
After a few hours of severe punishment, reading a few manuals, and turning to the aid of a co-worker (Props to Nuno—The network and cloud expert!) I was in. Of course, it was necessary a little improv to access the connection, I got a little switch which was connected to the WISE-4050 and to my computer, in order to attribute a dynamic IP to the device. This would simplify future interactions with the equipment and reduce the need for manual IP configs.
Advantech's WISE-4050 in our Tech Lab.
With the module up and running, the next step was to integrate it with our MQTT broker. The WISE-4050 was configured to send signals to the broker, which would then be picked up by a little middleware script I created. Here, another f****** challenge appeared: ensuring that these signals were not just logged but transformed into actionable data that could be both stored and analyzed in real-time (what would I want with TRUE or FALSE, right?).
Initially, I designed a stored procedure in MariaDB to handle incoming data and simulate a machine production. The idea was very simple: every time the equipment sent a signal indicating a machine operation (a digital output signal of “TRUE”), the stored procedure would log a new production entry into the database. This stored procedure would then be used by Coreflux’s MariaDB asset, eventually inserting a new row each time a new payload came in the subscribed topic on the broker. However, I soon realized that this approach was somewhat limiting. We had not so consistent data, AND, I wanted to analyze pretty graphs as well…
To overcome this, I restructured my approach. Instead of relying solely on the stored procedure, I decided to create a Python middleware that would act as the brains of this operation. This script would subscribe to the MQTT broker, process incoming signals, and generate the necessary data entries—complete, with machine ID, operator names, product codes, production count, and more. The middleware then would send the new “Data” back to the broker, at the same time it would index it in the OpenSearch instance, and the MariaDB asset from Coreflux would handle storing this data in the database.
One key improvement was ensuring that the production count were persistent. My first thought was: “This freaking counter will surely reset every time I close the program… S***”, which obviously was not ideal. To fix this, I implemented a mechanism to load the latest production count from the database when the scripts starts and update them as new data comes in. This change ensured that our production data remained consistent and accurate, regardless of how often the script was restarted.
Like any project, this one wasn`t without its hiccups. I encountered an issue where the script couldn’t connect to the MariaDB database using environment variables (which turned out to be a syntax error, yay). Also, there was a little problem with the Database connection, that was easily solved when I stopped being stupid and noticed that using localhost as host for the connection wasn’t the ideal. My code is running in a WSL instance on my Windows 11. That would mean that the IP address for the database (which was running locally) couldn’t be 127.0.0.1. So I ipconfig-ed in my CMD to check the actual address of my device and updated it my .env: SUCCESS! There was connection with the broker, with the OpenSearch instance and also with MariaDB.
By the end of this project, we had transformed a basic signal-logging system into a comprehensive, real-time monitoring solution. After checking the indexes in the OpenSearch instance, I was able to create several dashboards with the generated data (yay, graphs!!! XD), track production counts with precision, and gain insights into operational efficiency that were previously out of reach.
More importantly, this setup not only reduced downtime of a “machine” but also enabled predictive maintenance by analyzing trends in the data. For instance, if a machine started showing signs of underperformance, the system would flag it, allowing a intervention before a breakdown occurred. I was also able to configure monitoring and alarms to be sent to my slack channel, every time some threshold was exceeded (now I’m continuously receiving spam alerts in my slack xD).
This journey was a reminder of how crucial it is to have flexible, scalable solutions in place for industrial automation. While the WISE-4050 is a powerful tool, its real potential is unlocked when integrated thoughtfully with other technologies like our broker (which you can get by accessing mqtt.coreflux.org ), one of our assets, a database, and OpenSearch.
Through this project, I learned that the key to overcoming these challenges is not just in having the right tools but in being willing to adapt, troubleshoot, and iterate on your solutions. I hope this will help others who are facing similar issues in their projects. If you’re struggling with real-time monitoring, data integration and with concluding your automation projects, take heart—there’s always a way forward, and sometimes the solutions are simpler than they seem.
If you got curious or interest about what more Coreflux’s stack can do, check out at www.coreflux.org
Solutions Engineer @ Coreflux | Fullstack Developer | C# | Python | Node.js | Javascript | React | MQTT | IoT
Coreflux is on a mission to #democratizeIIoT and empower each human being to extract the maximum potential from the technology they use in their industry.
Visit coreflux.org to power-up your IIoT project.