Set Charts in IoT Platform
In this tutorial I will show you how you can visualize sensor data in IBM Bluemix. The simplest way is to set a chart in IoT platform that will display data in some format (line chart, bar chart…). In order to do that, launch Internet of Things platform dashboard and go to boards.
There should be a board called Usage Overview that is automatically created. This board contains cards that sums up usage of the Internet of Things platform service. You can set charts in this board or you can create a separate one. To create a new board, there is a button in the right corner.
Click on the board and add a new card by clicking on the button in the right corner.
You will see several types of cars you can use to monitor your sensor data.
We will us realtime chart in this tutorial. Click on it and pick a particular device form the list of all your devices.
Now you have to add a new dataset. Assuming you are using the same payload as before (parts 4 and 5), fill the event field with status (see publish topic). Choose property (temperature or humidity), units (optional) and click create.
Choose the size of the card that will be displayed in the board and click next. Then, give it appropriate name, pick the desired color and click submit button. You should see a chart that plots temperature values your device sends in real-time.
That’s it, a very simple way to visualize your data. You can experiment with other types of cards (bar, donut…).
Although the previous method is very simple and convenient for data visualization, we want a more elegant solution. We want to avoid logging in into Bluemix and launching IoT dashboard each time we want to take a look at data sent by a particular sensor. Instead, we will develop an application hosted on separated domain that we can access from any browser. Since there is an open-source app, we don’t have to build anything from scratch. However, if you have experience with node.js, you can modify this app to suit your needs. Download zip file here and extract it. You can see more details of the app here. We will deploy this app in our Bluemix space. In order to do that form a command line of your PC, you have to do a few steps. You have to download and install Cloud Foundry and IBM® Bluemix® command line interfaces. You can see instructions and download them from here. After you complete these steps, you are ready to deploy the app. Launch command line interface. In order to login to your Bluemix account, type command cf login. It will ask for your email and password.
If you have more organizations or spaces, it will ask you to select ones you want, if you have only one, it should target that organization automatically.
You can choose organization and space while logging in with command cf login -u username -o org_name -s space_name. Make sure that you are using appropriate API endpoint which has to correspond to the region where your organization is. To change it, use commands cf api https://api.ng.bluemix.net for US South and cf api https://api.eu-gb.bluemix.net for UK. You can obtain which region, org and space is currently set by typing cf target. After you successfully log in, set region, organization and space, you have to do one more step before deploying the app. Open app folder and find manifest file. Open it in text editor and put your desired app and host name.
In command line, navigate to the app directory with cd <yourDirectory>. Deploy your app in Bluemix with command cf push <appName>.
The process of staging the app takes some time. After it finishes, you should see a new app in Bluemix dashboard.
Launch the app by clicking on the link <appName>.mybluemix.net
In order to start plotting sensor values, you will need API KEY and TOKEN of IoT platform. Launch IoT platform dashboard and go to Access > API keys and click Generate API Key.
When you open the app, enter these two values.
You should see device list in drop-down menu. Select one and if that device is publishing events, app will start plotting data.
That is the end of the 6th part of this IoT series in which you have seen two different ways of visualizing your sensor data in IBM Bluemix.