Getting started with IoT and Data Visualization using IBM Cloud
The term IoT (Internet of Things) is not new to us. It is now almost everywhere making our lives easier. According to Wikipedia, The Internet of Things (IoT) is the network of physical devices, vehicles, home appliances, and other items embedded with electronics, software, sensors, actuators, and connectivity which enables these things to connect, collect and exchange data. Every day we come across different use cases of IoT in our daily lives, whether it is precision farming, or manufacturing activities, or a smart streetlight system or a smart home, or a smart grid. All these IoT devices and sensors generate a huge amount of data every day.
Have you ever thought of “what an IoT system is capable of doing with such large volumes of data”?
These large volumes of data can be used to help the systems take data-driven intelligent decisions. We can also train different Machine Learning models using these data to predict a variety of things and perform actions accordingly. This will lead to an infinite number of possibilities for IoT systems and their applications.
Keeping in mind the above points, in this post, I am going to show you how we can collect and visualize the data from the IoT devices.
Smartphones are one of the most common devices found everywhere and they can be easily transformed into an IoT device (so no need to buy any device for getting started!). Interesting, isn’t it?
So for this demonstration, We are going to use our Android smartphones’ accelerometer data and the IBM cloud platform.
We can broadly divide the whole process into 4 simple steps:
- Creating the main IoT app in the IBM Cloud
- Registering the smartphone
- Preparing the smartphone
- Visualization of the smartphone data
Believe me, it is going to be simple and fun ;)
So, Let’s get started…
Step 1: Creating the main IoT app in the IBM Cloud
First of all, we need to Login to our IBM cloud account. If you don’t have one, please sign up for the same(the Lite plan is free and no credit card information required!). After logging in, you will end up in the Dashboard of your IBM cloud account. Here you will find an option “Catalog” on the top of the page. Open the “Catalog” page by clicking and you will find yourself on a page like this.
Now select the Starter Kits from the left menu and then select the Internet of Things Platform Starter.
Now you will be asked to fill in the details of the app. Go ahead and fill in the details as shown in the example below.
You can choose any unique name for the app. Leave other fields to their default values. You may change the region/location field if you want this to be deployed in any other region. After this, click on Create to create the app. The Internet of Things Platform Starter boilerplate automatically adds the Internet of Things Platform service and a Cloudant NoSQL Database service to your app. It also includes a Node-RED runtime environment for your app.
After creating the app go to the dashboard and if everything has gone well till here, you will find your app’s status as running.
If your app is not running, you can always restart your app by clicking the options (shown below) on the right and it will be up and running.
Now once you are up and running, click on the app’s name on the Dashboard and you can see the application’s details like one shown below.
Step 2: Registering the Smartphone
Now in this step, you need to register your smartphone in the Watson IOT Platform before you can connect it to the IoT. The Watson IOT Platform service automatically allocates an IOT organization to you. An IOT organization is a space that is used for connecting and managing devices to the Watson IoT Platform so that your applications can access their live and historical data.
In the Overview view of your app(the above window), under Connections, click the Internet of Things Platform service and then click Launch.
The dashboard for IBM Watson IoT Platform opens in a new browser tab. The organization ID is assigned to your app and is displayed in the upper right. You will need this ID later for configuring the mobile app. Below, the organization ID is (q6gtbz).
Now to add a device (Android smartphone in this case), click Add Device button on the top right. Then, you will have to assign a Device type and a Device ID. In an organization, you can have multiple device types each with multiple devices. A device type is a group of devices that share characteristics; In our case, the device type name must be “Android” (this device type name is required by the app that you will use later). You can give any unique id to your device. After this, click Next.
You can skip the Device Information Section (as you don’t require them for this demo) and land into the Security section. Provide a value for the authentication token. Remember this value for later. Then, click Next.
After this, you will get a summary page. Review your information and click Done. Your device will be added.
Now, It’s time to turn your Smartphone into an IoT Device… (Excited!)
Get Rishabh Dev Manu’s stories in your inbox
Join Medium for free to get updates from this writer.
Step 3: Preparing the Smartphone
On your phone, go to Settings > Security. Under Device Administration, enable Unknown sources. Now you can install .apk files from outside of Google Play.
Now, Open the browser on your phone, and enter this URL: https://github.com/deveops/iot-starter-for-android/releases
Search for the iotstarter-v2.1.0.apk link, and click the link to download the .apk file.
Finally, Install the app on your Android phone.
After skipping the initial guidelines, you will get the below screen.
Fill all the details with the same values as there in your IBM Watson IoT platform and click Activate Sensor.
You will find your accelerometer data on your app’s screen as well as on your IBM Watson IoT Platform dashboard(in JSON).
Try changing the orientation of your phone and you will see the changes in the data.
Step 4: Visualization of the smartphone data
Now we are going to visualize the data from the smartphone using graphs.
For that, click on Boards from the left-hand side menu.
Add a new board here, by selecting the ‘+’. Give a Board name and description(optional).
After creating the board, select the same board and click Add new card. Then select Line chart from the option.
Then select your device from the list. In my case, it is Device Id 117. Click Next.
Then click on “Connect new data set”. After that, Click on the Event box and select “accel” (refers to your phone’s accelerometer events).
Then click on the properties box and select “acceleration_x”, i.e., the acceleration data in the direction of the x-axis of your phone. Click Next.
Click Next again and Done. You will now get to see the accelerometer’s data (x-axis). Similarly, You can create three different cards for the x-axis, y-axis, and z-axis simultaneously and visualize it at the same place as shown below.
So, this was one of the most simple examples of IoT and data visualization. We can make different use cases using different data and can take actions accordingly and this will have a very wide set of applications.
I hope you found this post interesting and informative. Your feedback and thoughts regarding this are most welcome.
Keep Exploring. Keep Learning.
Thank You.







