Applying AI and Edge prediction to IoT data

In this tutorial, I present the high-level steps from my hands-on workshop that shows you how to implement an edge computing architecture. You learn how to integrate sensors, wireless connectivity, a multiprocessor edge device, a low-power microcontroller, and sensor libraries into this IoT edge architecture. You learn how to connect your edge device to the IBM Cloud and to Watson IoT Platform to create a new Node-RED application. Using the Watson Studio data science portal, you learn how to create a machine learning model that will be deployed to your edge device. Most importantly, you learn how to run a machine learning prediction model on the edge device.

If this tutorial looks a bit daunting, perhaps you’d like to start with another workshop, “Configuring mesh networking for the IoT Edge.”

I hope that even if you cannot follow along in the steps in this workshop exactly that you can use them as a model for building your own IoT edge solution using similar hardware and software.

These steps are the main steps for this tutorial:

  1. Set up the edge device

  2. Create the Node-RED apps

  3. Create, deploy, and run a machine learning model

The journey follows this series of steps.

Sensors to Insights steps

Prerequisites

The edge device in this workshop is the STM32MP1 Discovery Kit with the IKS01A2 sensor expansion board attached.

You can complete this tutorial using an IBM Cloud account:

Step 1. Set up the edge device

After setting up the development board and connecting the sensor expansion board, you’ll learn how to power up OpenSTLinux on the edge device, detect the wifi IP address, and connect to the edge device. Then, you’ll run the environmental sensor programs to observe that environmental sensor data. Lastly, after connecting your browser to Node-RED that is running on the edge device, you’ll send the sensor data to Watson IoT Quickstart.

  1. Unbox and set up the development board

  2. Power up OpenSTLinux and connect to the edge device

  3. Run the environmental sensor programs to view the sensor data

  4. Connect to Node-RED on the edge device

  5. Send data from the device to Watson IoT Platform Quickstart

Step 2. Create the Node-RED apps

Before you can start creating your Node-RED apps, you need to create an IoT starter application running in IBM Cloud, open Watson IoT Platform to confirm that you can send/receive data from your edge device, and register the edge device in Watson IoT Platform. Next, you’ll configure Node-RED, install additional nodes, and import a pre-built flow, and then you’ll create your first Node-RED app that outputs the sensor data.

Next, you’ll create your second Node-RED app – a Node-RED dashboard – in IBM Cloud, which lets you experiment with chart types and plot real-time sensor data. You’ll also trigger alerts when that sensor data exceeds a threshold value.

Finally, you’ll create your third Node-RED app that stores the sensor data in a Cloudant database, format the time series database record, read datasets from the Cloudant database, and create a chart of the historical data.

  1. Create an IoT Platform starter application

  2. Register the edge device to Watson IoT Platform

  3. Set up and configure Node-RED in IBM Cloud

  4. Send your sensor data from the edge device, over MQTT, to Watson IoT Platform

  5. Receive the sensor data in Node-RED app in IBM Cloud

  6. Analyze the real-time sensor data in Node-RED dashboard charts

  7. Store the sensor data in a Cloudant database in IBM Cloud

  8. Analyze the historical data in Node-RED dashboard graphs

Step 3. Create, deploy, and run a machine learning model

In this final step, you’ll use Watson Studio to create a machine learning model. Next, you’ll use Node-RED in IBM Cloud to send the model to the Node-RED running on the edge device. Finally, you’ll run the model on the edge device against incoming sensor data in order to make a prediction as to if the sensor is being held.

  1. Set up and configure Watson Studio in IBM Cloud

  2. Create the training data for training a machine learning model

  3. Read the sensor data from the Cloudant database and create a model to classify the sensor data

  4. Deploy and run the machine learning model on the edge device

Summary and next steps

With this tutorial, I tried to show how you can go from sensors to insights, from the edge to the cloud. If you’d like to try your hand at other edge computing solutions, check out the Edge Computing and IBM Edge Application Manager hubs.