The Internet of Things in SAP Cloud Platform (Practical Demo)
Internet of Things
Under the term “Internet of Things”, you can easily imagine any device that is connected to the Internet. Well, by any, I mean really any – a door, a car key, a fridge, a washing machine. Whatever. Wireless chips (WiFi), due to their mass production and technological progress in production, have become so cheap and small-sized components that they can be used effectively almost anywhere. That is why, for example, the “Smart home” devices have become so spread recently. Whether you’ve forgotten to turn off the stove, close windows or turn off lights, you can find it out through a mobile app anywhere in the world just because the sensors from each home appliance are connected to the internet. Only a few years ago it was the privilege of ultramodern households and the Smart Home solution was worth hundreds to thousands of euros.
How to do it?
For demo purposes, I decided to create a “weather station” that would measure the temperature and humidity of our office and send such data every 30 seconds to SAP Cloud Platform – before I get to work, I can see whether the heating or air conditioning in summer is working or I opt for another outfit :-).
Just kidding, the purpose was to verify how, and whether it is possible to link the device up to EUR 10 with a solution from SAP. The shopping list was very short and consisted of:
- NodeMC ESP8266
- Digital DHT11 thermometer and humidifier
I used SAP Cloud Platform in Trial version (Neo Trial), which can be used free of charge for an unlimited period after you register with any mail (you do not have to be an SAP Partner). Therefore, the “Trial” label is not related to time but a functional one. After launching the “Internet of Things” service and initial setup from the SAP Cloud Platform, the “iotmms” application automatically appears in the Java applications in the Stopped state.
After the app is running successfully, it is time to register the device that we will use along with the message type (which form of message we will send to the SAP Cloud Platform).
Only temperature and humidity is needed for the demo. Messages will be sent via HTTP (OData). MQTT and WebSockets are also available.
Using the “Messaging through HTTP” link, you can test whether all the settings are correct and whether the system is receiving messages. If so, a table in the form T_IOT_ “message typed” is created in the database and there is created one record in it.
In addition to the C_TEMPERATURE and C_HUMIDITY attributes, the system automatically added the G_DEVICE (unique registered device ID) and G_CREATED (received message timestamp) fields. At this moment, everything is ready to receive real data from our device and the appropriate temperature sensor. Within the infinity cycle, the program reads the current temperature and air humidity every 2 seconds, and the average of the last 15 measurements (i.e. every 30 seconds each) sends over the HTTP POST request to the SAP Cloud Platform where the records are stored in the corresponding HANA table.
The only limitation I encountered with using the Internet of Things in the SAP Cloud Platform was the limitation of the use of the HANA database created, which is a general limitation of the Trial version. After 12 hours, the database automatically switches to Stopped and stops writing data that comes from our device. If you leave it off for more than 14 days, it automatically clears and with it all the records you have stored in it. Of course, you can run it again every 12 hours, but you have to do it manually, which is not always possible (= requires physical presence by PC). That’s why I’ve decided that I’ll send them to ThingSpeak (https://thingspeak.com/) in addition to sending data from the sensor to SAP Cloud Platform, which does not have such a limitation.
Visualization of acquired data
Data from the database should be visualized to add value to the user. For visualization, I used the IoT Starter Kit from SAP (https://github.com/SAP/iot-starterkit) and from there UI5 Consumption. I have modified these for our needs so that the last 100 values can be displayed in the graph.
Due to the wide selection of sensors, the possibilities of use are practically unlimited. By verifying integration, we have gained credible evidence that SAP is also ready for these industry opportunities. Thanks to In-Memory technology, the HANA database is also the ideal means to analyze the amount of data from different sensors. Implementation, for example, in the machinery industry for monitoring parts wear, transporting efficient traffic lights or larger cities in parking management is a very near-future issue.
Experts will advise youAnodius is an official certified SAP partner. We have a team of professionals to help you with your SAP Hybris solution design, implementation, user training, and any post-implementation services.
Michal Babinec, Sr. Developer
You have successfully subscribed to our mail list.
Too many subscribe attempts for this email address.