Part 2 of this series on IBM® Internet of Things Foundation (IoTF) teaches you how to visualize published data using IBM® IoT Real-Time Insights service.

CodifyThings-Getting-Started-IBM-Internet-Things-Bluemix-247

In this tutorial, you are going to create a real-time dashboard to visualize IoT application data that you developed in part 1 of this series.

Learning Objectives

At the end of this tutorial you will be able to:

  • Add IoT Real-Time Insights service to your Bluemix app
  • Connect IoTF service as a data source for IoT Real-Time Insights service
  • Create a dashboard using IoT Real-Time Insights service

IBM IoTF Setup

Login to Bluemix, you will be redirected to the Dashboard.

Open your IoTF application (WeatherMonitoringSystem) and click on + ADD A SERVICE OR API.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

In Catalog, select Internet of Things > IoT Real-Time Insights service.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

On service properties screen leave Service name and default Plan as-is or provide your own values. Click Create button.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

In order to add this new service to your app, Bluemix will need to restage the application. Once prompted click Restage button.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Once restaging is complete, click on IoT Real-Time Insights service in your application.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Service details page will open with options to Add a data source, Go to DOCS and Launch IoT Real-Time Insights Dashboard. For insights service to work, you will first need to add a new data source. Click on Add a data source button.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

You might be asked to sign in again with your IBM ID.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Once you are on IoT Real-Time Insights dashboard under Setup > Manage Data Sources tab, click Add New Data Source button.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Enter Name, Organization ID, API Key and Authentication Token.

Note: You will be able to locate Organization ID, API Key and Authentication Token from your IoTF dashboard.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

From Bluemix Dashboard launch IoTF Dashboard.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

From IoTF Dashboard click on Access > API Key tab.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Click on Generate API Key.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Switch back to IoT Real-Time Insights dashboard and enter API Key and Authentication Token from the previous step.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Click tick to save Data Source.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

From Devices > Browse Devices, you should see the devices that you registered with IoTF. Currently, it might show No data point defined.

Go to Devices > Manage Schemas and click Add new message schema.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Click on + Link data source, a link new data Source dialog box will open.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Click on magnifying glass to search existing data sources.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Select the WeatherDS datasource that you created earlier.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Next, select Device Type as WeatherDT and leave Event as + (to capture all events being published by the device). Click Ok to complete data source addition.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Next, you need to add data points in the schema, these data points will be used for all visualizations (data points are objects/fields being sent as part of JSON message). Click on + Add data point to open Add Data Points dialog box.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

If your IoT app from part 1 is running and publishing data to IoTF then select Add from connected device. The system will automatically load data points being sent by the device.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Select the data points you might want to see on the dashboard and click Ok.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Both your data source and data points have been added, enter Message Schema name and click Ok.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Note: To plot a chart on the dashboard you will need to change the data type of both humidity and tempC from String to Float. This can be done by clicking on pencil/edit icon on the previous screen.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix
Once data points have been added you will see the newly added Message schema.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Switch to Dashboards > Overview to view the default dashboard.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

You are going to create your own dashboards. Switch to Dashboards > Browse Dashboards and click on + Add new dashboard.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Enter Dashboard name, you can change icons and a few other properties. Click the tick to add the dashboard.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Click on newly created dashboard Weather Realtime Dashboard.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Click on Add new component.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Select Chart.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Click on Add line to chart. Select DeviceParameter, and Color. Click on tick button.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Add both humidity and tempC data points as lines in the chart.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

You can add other available components as well, but for the purposes of this tutorial only real-time chart component has been added.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Final Product

Make sure your Arduino is powered on and code from part 1 has been deployed. As soon as the code has been deployed, open serial monitor and you will start seeing data publish messages.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix

Login to IoT Real-Time Insights dashboard and open your custom dashboard. The chart will start displaying all the sensor readings in real time.

CodifyThings - Getting Started with IBM Internet of Things Foundation (IoTF) and Bluemix