Predictive Maintenance with TinyAutomator
Equip your production lines with a predictive maintenance solution for real-time monitoring of asset conditions and performance. 📈
Things used in this project
Industrial Shields 012002000200 × 1
NTC Sensor (B57301K0103A001 EPCOS) × 1
Software apps and online services
Hand tools and fabrication machines
Wire Stripper / Crimper, 10AWG - 20AWG Strip
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
🏭 Equipping machinery with a predictive maintenance solution vastly improves the Overall Equipment Effectiveness (OEE) by offsetting production line downtime costs. Heavy industrial machinery being expensive and the waiting time for delivery and replacement being long, tracking the signs of malfunction and taking preventive measures saves a lot of resources by alerting the plant manager about potential machinery failure.
🦉 Before moving on, check out our Introduction to TinyAutomator tutorial if you haven’t already, to ensure you have the stack installed on your compatible hardware.
Our Use Case 🏭
The facility in which we deployed this device is equipped with a lot of injection moulding machinery and, while most are less than 5 years old, some of them have been moulding plastic for longer than 20 years and monitoring their running parameters is critical in preventing failures, reducing the cost of replacing an entire machine, as well as reducing factory downtime.
Our machine, pictured below, is a MEGA T 4435/610 injection moulding machine from 2000 by SANDRETTO.
Hardware requirements 🧰
- Industrial Shields RPI based PLC - running a TinyAutomator instance (Industrial Shields 012002000200);
- Power supply - 24V, 1.5A;
- WiFi-enabled data gathering modules/relay module - We've used a NORVI IIOT ESP32 Based Industrial Controller (NORVI-IIOT-AE02-V);
- NTC Temperature sensors - B57301K0103A001 EPCOS;
- Accelerometer - Adafruit ADXL335.
For developing this predictive maintenance solution, we have picked the Industrial Shields 012002000200 RPI4B-based development board, equipped with 2GB of RAM, perfectly suited for running TinyAutomator. Our development board of choice is perfectly adapted to the industrial environment, being equipped with a DIN rail mount and being 24V tolerant. It is advisable to use a quality SD card with at least 16GB of storage.
Unusual patterns in motor vibrations or temperatures above a certain level can indicate the machine is not working properly. The sensors we picked for this application are the Adafruit ADXL335 accelerometer and the B57301K0103A001 EPCOS NTC sensor. We have decided to use Analog sensors due to their increased accuracy in representing changes in physical phenomena, such as sound, temperature and position.
Regarding tools, a crimping tool, a wire stripping tool and ferrules are necessary for wiring, as industrial PLCs use screw terminal blocks for connections.
Data gathering 📊
For our use case, we had to monitor the temperature and vibration at different points on the production line.
Here is the code used by the NORVI-IIOT-AE02-V to read the temperatures and vibrations from the monitoring points indicated by the employees. These points in the past were indicators that something might go wrong but it's hard to do this manually in the long run and you can only observe in the later stage when things are starting to malfunction (the Read3NTC_ReadADXL_SendMQTT.ino file from the Github repository).
The code after reading the temperatures and vibrations sends them through MQTT to the TinyAutomator install. Be careful to replace the WiFi SSID (ssid), the password (password), and the IP address of your device running TinyAutomator (mqttServer).
The cool thing about TinyAutomator is that once you send data over MQTT the resources are created automatically and they are stored locally on the devices via the InfluxDB that is included in the Docker install.
Besides monitoring the temperatures and vibrations automatically in TinyAutomator, it’s a good idea to also take note of use time and products being manufactured on the machine since they will impact the data from the sensors. This information will help you create a model that can be applied automatically by labelling these intervals accordingly. The most important parts are what you consider the machine running in good parameters. Any different activity will be interpreted as a possible issue in the functioning of the machine.
Creating an ML model using Edge Impulse 🧠
Now that we’ve gathered some data from the sensors, we can build, train, and deploy a Machine Learning model. For this task, we recommend using Edge Impulse that helps you create an ML model from a dataset in a visual way using low-code programming. We also recommend reading this tutorial to get a proper understanding of all the available features on Edge Impulse.
Start by registering on Edge Impulse and creating a new project. We’ve named ours Predictive-Maintenance.
We'll need to push some training data from Waylay TinyAutomator to Edge Impulse. For the time being, you can export the data in the JSON format from Waylay TinyAutomator using the following command:
(the apiKey and apiSecret are default values used locally directly on the Tiny Automator install, if you want to use it remotely we recommend changing it to some strong credentials).
However, the data needs to be formatted according to the Edge Impulse Data Acquisition Format so your JSON should look something like this:
Then, we’ll need to upload the JSON data exported from TinyAutomator to Edge Impulse. Go to Data acquisition -> Let’s collect some data -> Upload data (Go to the uploader). Select the JSON file and click Begin Upload. Now you should be able to see the device and the data:
Once you've added enough data samples, you'll need to label them (e.g. bad/good) and split them equally between the Training data and Testing data categories.
Now you can move on to the next step: designing an impulse.
After tuning the ML model to your needs, generating the features, and training the neural network, we can deploy the model to the Industrial Shields PLC.
We will also need to install the Linux Python SDK:
You can download the model file either via command line:
or directly from the Edge Impulse interface:
And you can use this example to run the model on the device:
As you can see the model detected the machine as not being idle and with a higher percentage of working in a better state than a dangerous one. Of course as with any Machine Learning the more you train it and the more data you pour in and label the better and more accurate the results will be.
What’s next? 🚀
A Predictive maintenance ML model gets more accurate if you have more data samples that are labelled based on your observations and other indirect data like running times, parts produced and so on (factors that can influence the vibration and temperature readings). While this may sound cumbersome the benefits in the long run far outweigh the initial process and save you from downtime and thus delays in delivering your goods to clients.
We have other tutorials from which you can learn to use TinyAutomator for industrial use-cases: