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.
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.
In Catalog, select Internet of Things > IoT Real-Time Insights service.
On service properties screen leave Service name and default Plan as-is or provide your own values. Click Create button.
In order to add this new service to your app, Bluemix will need to restage the application. Once prompted click Restage button.
Once restaging is complete, click on IoT Real-Time Insights service in your application.
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.
You might be asked to sign in again with your IBM ID.
Once you are on IoT Real-Time Insights dashboard under Setup > Manage Data Sources tab, click Add New Data Source button.
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.
From Bluemix Dashboard launch IoTF Dashboard.
From IoTF Dashboard click on Access > API Key tab.
Click on Generate API Key.
Switch back to IoT Real-Time Insights dashboard and enter API Key and Authentication Token from the previous step.
Click tick to save Data Source.
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.
Click on + Link data source, a link new data Source dialog box will open.
Click on magnifying glass to search existing data sources.
Select the WeatherDS datasource that you created earlier.
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.
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.
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.
Select the data points you might want to see on the dashboard and click Ok.
Both your data source and data points have been added, enter Message Schema name and click Ok.
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.
Once data points have been added you will see the newly added Message schema.
Switch to Dashboards > Overview to view the default dashboard.
You are going to create your own dashboards. Switch to Dashboards > Browse Dashboards and click on + Add new dashboard.
Enter Dashboard name, you can change icons and a few other properties. Click the tick to add the dashboard.
Click on newly created dashboard Weather Realtime Dashboard.
Click on Add new component.
Select Chart.
Click on Add line to chart. Select Device, Parameter, and Color. Click on tick button.
Add both humidity and tempC data points as lines in the chart.
You can add other available components as well, but for the purposes of this tutorial only real-time chart component has been added.
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.
Login to IoT Real-Time Insights dashboard and open your custom dashboard. The chart will start displaying all the sensor readings in real time.