Send sensor data to HANA and visualized it in Fiori web application

Tags: Fiori, IoT, Internet of Things, SAP, HANA

In a university project cooperated with NETLIFE Consulting, I tried SAP HANA Internet of Things services. I made an interesting demo, where I connected two sensor to HANA Cloud Platform with a Raspberry Pi. After I successfully gathered data from device, I created a Fiori web application where I visualized that data.

In the world of IT, a new buzzword raised recently: The Internet of Things (IoT). It can be the next “Big Thing” and SAP SE wants to be part of it. In late September SAP announced a 2 billion dollar investment plan for IoT development over 5 years.

Internet of Things are the vast network of devices connected to the Internet , including smart phones and tablets and almost anything with a sensor on it – cars, machines in production plants, jet engines, oil drills, wearable devices, and more. These “things” collect (and exchange) an incredible amount of data.

The SAP HANA Cloud Platform – Internet of Things Services could be a great choice to handle this data. It allows clients to develop, customize, and operate IoT applications in cloud. This service is able to send or receive data if we connect our devices with it, and we can set a processing method for this data.

In a university project cooperated with NETLIFE Consulting, I had the chance to try the service recently.

My task was to send sensor data to HANA Cloud Platform with IoT Services, and visualized that data in Fiori web application.


The task

First, I got two TI SensorTag Bluetooth sensor and a Raspberry Pi 2. I registered a HANA trial account, and I activated the Internet of Thigs services.

The IoT services has two main services:

  • Remote Device Management Services (RDMS). It can manage the device lifecycle from onboarding to decommissioning and device and data modeling. Receive device information, configure devices remotely, and send data to devices.
  • Message Management Services (MMS). It supports various transport protocols and messaging formats for sending, receiving, and storing IoT data in the persistence layer of SAP HANA Cloud Platform.


IoT Services overview

Both have a graphical interface. On RDMS’s interface we can add message types, device types and devices.


MMS cockpit


RDMS cockpit

In order to create a new message type, I needed to add the message type name and the attributes with data types that I wanted to send or receive. After this I got a message type ID-s, that I need use in the device.

To create new device type, I had to add the name, and the message types what the devices use to communicate. I also had to add the directions of the message types, which can be “From Device”, “To Device” or “Bidirectional”. After creating the device types, we get a “Device Type ID”, and an OAuth token, which can be used to authenticate the connections on the devices, in case you don’t want to add each device unique identification; otherwise, we have to add devices separately.

I chose to add devices separately. I had to add the name of the device, and I selected the device type that I wanted to use. I could also add additional attributes with values, like MAC address or any custom details. Each device got a unique ID and OAuth token just like with the device types.

The HANA IoT Services can send messages through multiple protocol, like HTTP Request, WebSocket, or even MQTT over TCP/SSL or WebSocket. I chose simple WebSocket.


Internet of Things

After I configured my devices and message types on HANA, I created a connection between the sensors and HANA Cloud platform with the Raspberry Pi with Raspbian Linux and Node.js framework. For the connection with the Bluetooth device, I used the “sensortag” npm. For the WebSoket connection I used “nodejs-websocket” library. In a JavaScript file I retrieved the data from the sensors and forwarded to the HANA server with a specific WebSocket connection. In that connection I used the Message Type ID, the Device Type ID and the OAuth token for each device. As host address I used my MMS’s URL.

After that I had a full functional connection between the sensors and the HANA Cloud Platform’s IoT services. The MMS saved that data in a default database, because I didn’t configure any specific data processing method.

The last step in my project was the visual interface. For that I used a SAP Fiori web Application. First I needed a data connection. I used the MMS embedded oData services, which made it easy to access my tables. I crated a table for each device, where I can see all data what the sensor gathered. Also I created a VizFrame line chart, where I can see all data changing over time.

With that and lot of documentation I finished my project and in the end I had a functioning model for the use of the SAP HANA IoT platform.


by Balázs Horváth


  3. #1
  4. #2