Note: This pattern is part of a composite pattern. These are code patterns that can be stand-alone applications or might be a continuation of another code pattern. This composite pattern consists of:
- Take corrective actions at the edge based on predictive analytics of IoT sensor data (this pattern)
- Detect change points in IoT sensor data
- Predict equipment failure using IoT sensor data
Once an anomaly is detected in an IoT system or sub-system using change point detection, a failure prediction based on predictive analytics models can identify an upcoming failure condition in advance. Based on this detection, a proactive prescriptive action can be taken. This proactive action in traditional applications are typically scheduled maintenance activities. Even though it is possible for us to predict and initiate actions using IoT sensor data, the edge layer is not always equipped with hardware that can receive such instructions and take the corrective action. In more advanced systems, the equipment supports such 2-way communication and the hardware is wired at the edge such that corrective actions can be initiated through the actuators.
This IBM Code pattern is a composite pattern that brings together the end-to-end flow of IoT analytics systems. This pattern focuses on sending decisions based on analytics insights to the edge for automated actions.
You can use this code pattern to experiment, learn, enhance, and implement a method for predicting equipment failure using IoT sensor data. Sensors mounted on IoT devices, such as automated manufacturing devices like robotic arms or process monitoring and control equipment, collect and transmit data on a continuous basis which is time stamped.
The first step in implementing this advanced IoT analytics system would be to identify if there is any substantial shift in the performance of the equipment using time series data generated by a single IoT sensor. For a detailed flow on this step, refer to the Detect change points in IoT sensor data pattern.
The next step after detecting a change point in one key operating parameter of the equipment is to try to predict if this recent shift will result in a failure of the equipment. For a detailed explanation of implementing a bivariate prediction algorithm using Python 2.0 software, refer to the Predict equipment failure using IoT sensor data pattern.
Finally, the last step is to analyze the data and determine if an action needs to be taken, and if so send the command for the corrective action to the IoT device on the edge. This pattern will provide the details for how to implement this last step in the end-to-end advanced IoT analytics system.
When you have completed this pattern, you will understand how to:
- Read IoT sensor data stored in the database
- Configure the features and target variables for the prediction model
- Train the model using logistic regression and measure the prediction accuracy
- Score the test data and measure prediction accuracy
- Evaluate the model’s predictive performance further by computing a confusion matrix
- Run experiments by changing the configuration parameters
- Setup Node-RED on the Raspberry Pi
- Send and receive data between Raspberry Pi and Watson IoT Platform
- Develop Node-RED flows that can send commands to the actuators attached to the edge device
- Temperature data is read from a sensor attached to an edge device. In our case, a CPU temperature sensor on a Raspberry Pi.
- JSON files are imported to create two Node-RED flows on the Raspberry Pi on the edge layer.
- The Node-Red Emitter is running on the Raspberry Pi and it will collect the temperature sensor data and send it to Watson IoT Platform in IBM Cloud.
- The Node-RED flow that is running on Watson IoT Platform in IBM Cloud will receive the data from the Raspberry Pi and analyze the data to determine if any action needs to be taken at the edge.
- The JSON files will be imported to create the Node-RED flows in the IBM Cloud – IoT service.
- The Node-RED flow that is running on Watson IoT Platform will once again run the analytics logic on the data, translate it into an action, and communicate the action to be taken back to the edge layer on the Raspberry Pi.
- The analytics logic that is used to determine the action to be taken at the edge will be embedded in the Node-RED flow in the Internet of Things service in IBM Cloud.
- The Node-RED Collector flow on the Raspberry Pi will also receive commands for action from Watson IoT platform in IBM Cloud and initiates a corrective action.
Find the detailed steps for this pattern in the README. The steps will show you how to:
- Set up Node-RED in Raspberry Pi and connect the Pi to the network
- Import the Node-RED flows in Raspberry Pi
- Configure the Node-RED flows in Raspberry Pi
- Set up the Internet of Things Starter service on IBM Cloud
- Import Node-RED flows in IBM Internet of Things service on IBM Cloud
- Check the sensor data that was sent from the Raspberry Pi to the Internet of Things service
- Check the action that the Raspberry Pi edge node received from the Internet of Things service.