The goal of this blog post is to share how I build the live demo thru the story of IoT and analytics with SAP’s technologies, HANA Cloud Platform and Lumira. So this blog is considered as an extended use case leveraged from Patrick Colucci‘s post which showing “The Easiest Way to Stream your iPhone’s Sensor Data to HANA Cloud Platform“.
This post is also inspired by another blog from Anthony McLeod who built a SAPUI5 dashboard using SAP Web IDE to visualize the streaming sensor data from SensorPhone application. Please check out Anthony McLeod’s blog post here.
I usually start telling the story with IoT technology, SensorPhone app is the great example of showing them various types of real-time sensor data including movements of accelerometer and gyroscope, GPS coordinate, altitude and audio level from primary microphone. This is where the demo start by showing SensorPhone app stream the data to HCP.
Once the data is ready on HCP, let’s consume this data using SAP Lumira
Before we get started, here is what you will need:
- iPhone with the SensorPhone application installed (version 1.3.2 or higher)
- HANA Cloud Platform account (follow this LINK for free trial account)
- Confgured and completed setup of IoT Service as outlined in this POST.
- HANA Cloud Platform SDK (Download and install the latest version from this LINK) Any versions would work, I am using “Java EE 6 Web Profile” SDK version 2.98.6 as of the time of writing this post.
- SAP Lumira installed (Mine is version 1.30 as of the time of writing this post.)
Step 1: Opening a Database Tunnel
A database tunnel is required in order to connect SAP Lumira to SAP HANA database in HCP instance. To open a database tunnel use the “open-db-tunnel” command from the “tools” folder of your SDK installation.
Execute command: neo open-db-tunnel -i <Instance Name> -a <Account Name> -h <Host Name> -u <Username>
After entering your password, the tunnel will be successfully opened. You will need to keep this window open while connecting your application to HANA database.
Important: The Password will change everytime you open the tunnel. And the tunnel will be automatically closed after 24 hours.
Step 2: Getting your Table Name from HCP IoT Services
Step 3: Connecting your Lumira to IoT Table
Here we are in the Lumira Visualize room.
If you are seeing this screen, you have successfully linked Lumira to IoT table. Please note that Lumira acquired Dataset from source connection and stored for your visualization. Meaning, your Dataset will not be automatically updated until next manually refresh (the icon on the top-right on the toolbar.
Step 4: Creating Stories, Personalized Your Own Demonstration.
Here we are at the stage of building up the nice presentation to deliver the message from data by using Lumira’s features.
Following is only an example I built for demonstration. Also it is for you to follow if you are not yet familiar with Lumira already. I take the Latitude and Longitude data to plot in ESRI map which is bundled feature in Lumira. This only means to show the location of iPhone where the messages have been sent at the moment of posting.
The data type of Latitude/Longitude data are created as character type. To make use of this, we need to convert them into number data type. Click on the “gear” icon at “C_LATITUDE” column, and select “Convert To Number”. (In this example, I change the name of converted column to “N_Latitude”)
You will need to do this on C_LONGITUDE column in the same way.
Next I create the geographic hierarchy by using the previous columns of latitude and longitude data. In my case, I created this hierarchy on top of G_DEVICE as a target dimension. This column contains IoT device ID. Click on the “gear” icon at “G_DEVICE” column, select “Create a geographic hierarchy” then “By Latitude / Longitude”.
I simply choose G_DEVICE column again for measurement. I create a measure based on this column. The result of this will be Count(All) column in MEASURES section. There I change the measure name to “SendingCount”, just to make it easier to understand.
Next, I add the Geographic Charts, select the “Geo Map” type. This is where ESRI map will be loaded onto your Visualize room. (You will need internet access to do this). Then drag and drop Geographic dimension column we created into “Geo Dimension” box.
Now it is time to make you own stories. Create more charts ! I have actually done other charts showing Audio Level, and Altitude data in Bar charts. But that would not be so complicated. So I leave that for you to try out.
So this is an alternative illustration to leverage SAP HANA Cloud Platform by connecting from desktop tool, SAP Lumira. As an on-premise solution, By using database tunnel, it is allowing you to direct access to the cloud schema. I do really hope this is useful and gives you an idea of expand the demonstration to particular use cases further.
Mac, Aphirat C.
Product Specialist, Platform Solutions
SAP (Thailand) Ltd