Implementing Predictive Maintenance with t6 IoT Platform and Temperature Sensors
This recipe article provides a step-by-step guide on implementing predictive maintenance with t6 and temperature sensors. We will walk you through the process of setting up the t6 IoT Platform, collecting and preprocessing temperature data, building and training a predictive maintenance model, and triggering alerts based on model predictions. By the end of this article, you will have the knowledge and tools to optimize equipment reliability, reduce downtime, and revolutionize your maintenance strategies.
Tagged on #Predictive Maintenance,
In today’s fast-paced industrial landscape, maximizing equipment reliability while minimizing downtime is crucial for businesses to maintain a competitive edge. Traditional maintenance approaches often rely on scheduled inspections or reactive repairs, resulting in unnecessary costs and unforeseen disruptions. However, a paradigm shift has emerged with the advent of predictive maintenance, a proactive approach that leverages data and machine learning to forecast equipment failures before they occur.
Setting up the t6 IoT Platform
To set up the t6 IoT platform, you will need to follow these steps. Firstly, create an account on the t6 platform through dedicated front-end user interface. This account creation grants access to the platform’s features and functionalities.
Once the account is created, you can generate an access token by making a POST request to the /v2.0.1/users/accessTokens
endpoint (more detailed documentation), providing the API key and API secret as headers in the request. The access token, which has a customizable lifespan, will serve as the authentication mechanism for subsequent API interactions.
You’d then need a Flow to store your temperatures measured, you can use the technical documentation Api to create one.
The step further would require a classification for Training. You can define categories (classes), including one for non-issue classification and another for issue classification. These categories will be used for training the predictive models in subsequent steps.
One category for normal (1)
curl --location "https://api.internetcollaboratif.info/v2.0.1/classifications/categories" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "x-api-key: {{api-key}}" \
--header "x-api-secret: {{api-secret}}" \
--data "{
\"name\": \"normal\",
\"color\": \"#38761d\",
\"description\": \"This category will group all datapoints identified as normal.\"
}"
Another category for failure (2)
curl --location "https://api.internetcollaboratif.info/v2.0.1/classifications/categories" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "x-api-key: {{api-key}}" \
--header "x-api-secret: {{api-secret}}" \
--data "{
\"name\": \"failure\",
\"color\": \"#BF4F51\",
\"description\": \"This category will group all datapoints identified as failure.\"
}"
After creating the Flow and setting up the categories, engineers can begin injecting datapoints. The datapoints injected into the Flow will serve as the basis for monitoring and predicting potential failures in the IoT system.
t6 Api allows multiple datapoints to be posted simultaneously, and have restiction to avoid long lasting Api calls on t6 Saas - please contact us to extend your own user capabilities if make sense to you.
curl --location "https://api.internetcollaboratif.info/v2.0.1/data/" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "x-api-key: {{api-key}}" \
--header "x-api-secret: {{api-secret}}" \
--data "{
\"flow_id\": \"{{flow_id_for_temperature_container}}\",
\"value\": {{temperature_measured}},
\"meta\": {\"categories\": [\"{{uuid_category_1_or_2}}\"]},
\"save\": true,
\"retention\": \"retention1w\",
\"unit\": \"31c38904-2482-4cce-b0de-6dc9efbc2d33\",
\"publish\": true,
\"rules\": [ ]
}"
By following these initial steps of account creation, Flow setup, category definition, and datapoint injection, engineers can establish the groundwork for leveraging the t6 IoT platform’s machine learning capabilities to gain valuable insights and enable predictive maintenance.
Preprocessing and Feature Engineering
By employing effective feature engineering techniques, data scientists and engineers can enhance the performance of their machine learning models, improve prediction accuracy, and uncover deeper insights from the available data. It requires a deep understanding of the data, domain knowledge, and experimentation to iteratively refine and optimize the feature engineering process. Hence, Exploratory Data Analysis (EDA) t6 module can bring usefull insights.
Ruled based decisions
Feature Engineering can also use Rule Engine to reject datapoint when measurement is not relevant (a negative temperature could, in some circumstances not be possible).
Data-Fusion to leverage accuracy
In feature engineering, data fusion techniques can be applied when dealing with heterogeneous data sources or when there is a need to combine different types of data to extract more comprehensive insights.
For example, it may involve combining temperature data from temperature sensors with humidity data from humidity sensors to create a new feature that represents the heat index. By fusing these different types of data, the model can leverage the synergistic information and potentially improve its predictive capabilities.
Feature Transformation
Modifying the existing features to make them more suitable for the model. This can involve applying mathematical transformations such as logarithmic or exponential transformations, scaling features to a specific range, or normalizing features to ensure they have similar scales. Rule Engine can also be useful in thoses transformations.
Building and Training the Predictive Maintenance Model
Selecting an appropriate machine learning algorithm or model architecture is crucial for predictive maintenance. Creating a Model on t6 is very simple. The fonctionnalities may evolve in the future and bring additional parameters.
curl --location "https://api.internetcollaboratif.info/v2.0.1/models" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "x-api-key: {{api-key}}" \
--header "x-api-secret: {{api-secret}}" \
--data "{
\"name\": \"Unbranded Cotton Fish\",
\"retention\": \"retention1w\",
\"normalize\": false,
\"splitToArray\": false,
\"validation_split\": 0.5,
\"batch_size\": 100,
\"epochs\": 1000,
\"flow_ids\": [
\"{{flow_id_of_your_temperatures}}\"
],
\"continuous_features\": [
\"value\"
],
\"categorical_features\": [],
\"categorical_features_classes\": [],
\"datasets\": {
\"training\": {
\"start\": \"2023-07-01 00:00:00\",
\"end\": \"\",
\"limit\": 10000,
\"balance_limit\": 5000
},
\"testing\": {
\"start\": \"2023-07-01 00:00:00\",
\"end\": \"\",
\"limit\": \"\"
}
},
\"compile\": {
\"optimizer\": \"adam\",
\"learningrate\": 0.001,
\"loss\": \"binaryCrossentropy\",
\"metrics\": [
\"accuracy\"
]
}
}"
Iterative Training and Continuous Improvement
The model can be trained using an asynchroneous endpoint. The engineer will be notified by a push-notification once the training is completed.
curl --location "https://api.internetcollaboratif.info/v2.0.1/models/{{model_uuid}}/train" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "x-api-key: {{api-key}}" \
--header "x-api-secret: {{api-secret}}" \
--data ""
A model can be trained again with the same values or by adjusting hyperparameters
There is a custom endpoint to test input data prediction using the trained Model :
curl --location "https://api.internetcollaboratif.info/v2.0.1/models/{{model_uuid}}/predict" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "x-api-key: {{api-key}}" \
--header "x-api-secret: {{api-secret}}" \
--data "[
{
\"value\": {{temperature_to_evaluate}},
\"flow_id\": \"{{flow_id_of_your_temperatures}}\",
\"meta\": {
\"categories\": []
}
}
]"
Using the classification model on Rules for Predictive Maintenance Use Case
Once the predictive maintenance model is trained, engineers can deploy it within the t6 platform. The model takes temperature data as input and predicts whether the Object is in a normal or potential issue state. By utilizing the classification model, engineers gain valuable insights into the health status of the equipment based on real-time temperature measurements. This information serves as a crucial input for initiating proactive maintenance actions.
curl --location "https://api.internetcollaboratif.info/v2.0.1/data/" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "[
{
\"value\": {{temperature_to_classify}},
\"flow_id\": \"{{flow_id_of_your_temperatures}}\",
\"save\": true,
\"retention\": \"retention1w\",
\"publish\": true,
\"datatype_id\": \"9ccce350-bf4c-41af-8945-9a15c4fe141e\",
\"rules\": [
{
\"conditions\": {
\"all\": [
{
\"fact\": \"flow\",
\"operator\": \"equal\",
\"value\": \"{{flow_id_of_your_temperatures}}\"
}
]
},
\"event\": {
\"type\": \"model_classify\",
\"params\": {
\"model_id\": \"{{model_uuid}}\"
}
},
\"priority\": \"1\"
}
]
}
]"
Hence, the predicted Class for that datapoint added will then be available for any other model training.
Tagged on #Predictive Maintenance,