IBM/iot-edge-predictive-models-dsx

Name: iot-edge-predictive-models-dsx

Owner: International Business Machines

Description: Advanced analytics can be applied in various areas of IoT like "Change Point detection using IoT Sensor data" and "Predictive Analytics using IoT Sensor data". Once a Descriptive or Prescriptive model outcome is arrived, it needs to be translated into action. This journey demonstrates how such a communication to the Edge layer can be implemented.

Created: 2017-12-19 15:56:06.0

Updated: 2018-05-11 10:40:50.0

Pushed: 2018-05-11 10:40:49.0

Homepage:

Size: 2275

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

1 Edge communication using Predictive and Change Point models in Watson IoT and IBM DSX (IoT)

Internet of Things (IoT) have evolved tremendously in all spheres of our lives like Industrial
applications, Social interactions, Remote management of facilities and equipment to name a few.

In general application areas, IoT data collected by Sensors can be used for monitoring as
well as predicting the outcomes. If any deviation from the norm is detected, corrective action can be
prescribed either manually or by an automated process. Such actions may come out of Rule based anomaly
detection or a Statistical Change point detection or a Predictive model that predicts a faulty
condition ahead of time.

The Process steps for applying Analytics on IoT data can be broadly classified as below

  1. Collect IoT data from sensor
  2. Change Point detection using IoT Sensor data
  3. Predicting Equipment failure using IoT Sensor data
  4. Sending Decisions based on Analytics insights to the edge for Automated Action

This IBM Code Pattern is a composite pattern that brings together the end to end flow of IoT Analytics systems.
Specifically focussing on points 2,3,4 above.

png
Image from blog Advanced Analytics Applications in IoT

While Rule based anomaly detection uses point in time data, which may be sudden spike in some parameters
with a possibility of getting back to normal ranges, statistical Change point detection can differentiate
and identify a Change in operating parameters that might not return to normal by itself. And so a more
reliable corrective action can be initiated.

The Statistical method and flow for detecting change points in IoT Sensor data and related steps are
covered in the IBM Code pattern below:

One step further, using Advanced Analytics, predictive models can be built that could predict a failure
condition in an equipment or a system like say a Compressor in a refrigeration unit well ahead of time.

This approach goes a long way in implementing Predictive maintenance which is more prudent approach
than Scheduled Preventive maintenance which is periodic in nature.
Predictive Analytics on IoT is covered in the journey below:

Also, by using multivariate data collected from different sensors mounted on an equipment, more
sophisticated Predictive models can be built that can pinpoint upcoming failure of a specific
equipment or subsystem.

Once an anomaly is detected, a prescriptive action needs to be taken.
This journey in specific covers, Detecting the need for any corrective action and then
communicating Decisions based on Analytics insights to the edge for Automated Action

Prerequisites:

Users who want to implement this IBM Code pattern are expected to have the below knowledge as
Pre-requisites. Before proceeding, it is strongly suggested to familiarize yourself with the
below pre-requisites.

  1. Node-RED:
    a. Creating your first sample flow
    b. Creating your second sample flow
  2. Node-RED in IBM Cloud (previously IBM Bluemix):
    a. Running Node-RED on IBM blue mix
    b. Deploying IoT platform starter on IBMcloud
  3. Node-RED on Raspberry Pi:
    a. Running Node-RED on Raspberry Pi
  4. Configure a Raspberry Pi with Watson IoT Platform and connect it to the cloud

2 Flow

png

  1. Temperature Data is read from a sensor attached to an edge device, in our case CPU temperature
    sensor in Raspberry Pi
  2. .json files are imported to create 2 Node-RED flows in Raspberry Pi or the Edge layer
  3. Node-Red Emitter running on Raspberry Pi will collect the CPU temperature sensor data and dispatch it to
    IBM IoT service in Cloud.
  4. Node-RED flows running on IBM Internet of Things (IoT) platform in IBM Cloud will receive the data from
    Raspberry Pi and Analyzes the data to detect if any action needs to be taken at the edge
  5. .json files will be imported to create the Node-RED flows in the IBM Cloud ? IoT service
  6. Node-RED flows running on IBM IoT platform will once again run the logic on the data and then
    translate it into an action and communicate the action to be taken back to the edge layer, Raspberry Pi
  7. Analytics logic to detecting the action to be taken at the Edge will be embedded in the Node-RED
    flow in IBM Cloud ? IoT service
  8. Node-RED Collector flows in Raspberry Pi will also receive commands for action from IoT platform
    in IBM Cloud and initiates action

3 Included Components

4 Featured Technologies

5 Watch the Video

6 Steps

  1. User sets up Node-RED in Raspberry Pi and connect to Network
  2. User imports Node-RED flows in Raspberry Pi
  3. User configures Emitter, Receiver Node-RED flows in Raspberry Pi
  4. User signs up for IBM Internet of Things Starter service on IBM Cloud
  5. User imports Node-RED flows in IBM IoT Cloud service
  6. User configures Emitter Node-RED flows in IBM IoT Cloud service
  7. User checks the CPU temperature from Raspberry Pi transported to IBM IoT service
  8. User checks the action received at the Raspberry Pi Edge node from IBM IoT service


6.1 User sets up Node-RED in Raspberry Pi and connect to Network

Follow this Video which will walk you through the below steps.

  1. Setup and Connect Raspberry Pi to Local Wifi Network with Internet
  2. Connect the Raspberry Pi to the same WiFi network as your Laptop
  3. Login to Raspberry Pi from your Laptop using putty or any other SSH
  4. Start Node-RED service on Raspberry Pi
  5. Start IoT service in Raspberry Pi if not started already
  6. On your laptop / desktop web browser, open the Node-RED web editor running on Raspberry by entering the URL
       raspberrypi ip address:1880. In the example shown below the IP address for Raspberry Pi is 192.168.1.26.   You can check your WiFi router (or hotspot) configuration for the finding the Raspberry Pi IP address.


6.2 User imports Node-RED flows in Raspberry Pi

Import ?Emitter? Node-RED flow ?Rpi2BMX? in Raspberry Pi from RPi2BMX.json

png
Leave the tab that shows this flow open.

Import ?Collector? Node-RED flow ?BMX2RPi? on Raspberry Pi from BMX2RPi.json

png
This will create a second flow “BMX2RPi” in a second tab. Leave this open as well.


6.3 User configures Emitter,Receiver Node-RED flows in Raspberry Pi

Make a note of the above 2 Device IDs
You will need them later in Node?RED flow in IBM Cloud


6.4 User signs up for IBM Internet of Things Starter service on IBM Cloud

png

png

png

png

png

png

As a trial, drag and drop the input node that says ibmiot into the blank tab Flow 1.   You can see a description of the functions of this node. You can experiment further to get yourself comfortable with
the flow. Discard or Save any flow you might have created, we will be using from pre-built flows that are made available
in the git repo.


6.5 User imports Node-RED flows in IBM IoT Cloud service

png


6.6 User configures Emitter Node-RED flows in IBM IoT Cloud service

png


7 Run the Node-RED flows and View the Results

Note: Steps on how to Run the flow is not explained in detail as these are basics covered in the Pre-requisites.

8 Troubleshooting

See Debugging.md

9 License

See Apache 2.0

10 Further enhancements

The following areas are suggested as further enhancement areas for a User to explore by self.
These are consciously been omitted from this IBM Code pattern as thse will require additional
hardware and knowledge of basic electronics


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.