Gamificated IoT Showcase Part 1: The Big Picture
What is this about?
This is the second post in a series of blog posts covering a gamificated approach to Big Data and the Internet of Things using SAP technologies. In this blog post I am going to describe the big picture and various parts of the showcase.
There is a lot of buzz around the terms Big Data, Digital Transformation, Industry 4.0 and Internet of Things (IoT) recently. Extracting, storing, connecting and analyzing all kinds of data from various different sources (OLTP systems, Social Media, machines, sensors, etc.) enables the business to get better answers to their questions and even opens up a wide range of new possibilities (and even business models).
We at TEAMFACT thought for a simple and fun way to evaluate different technical options for IoT and Big Data scenarios delivered by/connected to SAP. As a consulting company we don’t own any products/machines containing sensors and searched for a fun yet powerful IoT device… and found Sphero.
The IoT device: Sphero
A Sphero (build and sold by a company with the same name) is small ball in a nearly unbreakable and waterproof polycarbonate shell. With an internal guidance system including motors, gyroscope and accelerometer sensors it is possible to control a Sphero via Bluetooth and roll with a maximum speed of 8 km/h (7 ft/s). The Sphero (there is even a BB-8 version for Star Wars fans) at its core is a device for children who want to play and get introduced to things like geometry and programming using one of the 30+ available smartphone apps. But as the Sphero also contains a powerful SDK it enables full programmable control of the device and access to the sensor data. Sphero sensor data (Gyroscope, Odometer, Accelerometer) can be streamed with a maximum rate of 400 samples per second and it’s even possible to get information about collision events, battery state and the position in an internal coordinate system.
The business use case
With the Sphero and its sensor data at hand, we thought for a way to show the idea of IoT and came up with a racing scenario. Two or more Spheros, each controlled by a driver, can race each other on a self build race track. The transactional and structured race data is being stored in a database and enables us to ask the following business questions:
- What was the racing time for a driver in a race?
- Who finished at which place in a race?
While those are some basic questions, the integration of IoT and sensor data allows for a much deeper insight and a whole new set of questions to be answered:
- What was the top/medium speed for a user/within a race?
- What was the distance rolled in a race?
- How often did a driver collide in a race/overall?
- What was the highest collision speed?
- Who found the shortest/longest route?
We could even add some predictive questions and scenarios (which are not covered in this blog series):
- Can we create a predictive model when the battery needs to be recharged?
- How many collisions will a Sphero last until it needs to be replaced?
- Make the Sphero learn the fastet way on the race track.
While this is not a real world business scenario, it does show how the integration of sensor data can add value to analytics. And going one step further, it is also possible to introduce changed/new business models: Instead of making only the fastest driver a winner, we could also have a price for the most economic (shortest route) or the safest driver (least collisions) or calculate the overall winner based on all KPIs.
The showcase technology
Concerning data acquisition, storage and analysis, we find a wide range of technologies in the SAP world. While there are even more tools like Data Services, Business Warehouse (BW), System Landscape Transformation (SLT), etc, the core of SAPs Big Data strategy is around SAP HANA and its connection to the Apache Hadoop/Spark world.
Covering all those technologies within this blog series won’t be possible (we may add some details on those technologies in a later blog post). Instead we will focus on easy to start with tools, which are freely available on trial accounts.
The final architecture is being shown in the next illustration:
At the core, we will leverage a lot of functionality offered by the HANA Cloud Platform (HCP). We will store both, the transactional as well as the sensor data within a HANA database inside HCP. The racing app will be a SAPUI5 application talking via OData to a backend running on HANA XS. The sensor data will be loaded into HANA via HCP IoT services.
To control the Sphero and get access to the sensor data, we are going to use Node.js. There are Sphero SDKs available in other languages too (Ruby, Python, iOS, Android, etc.) but we will focus on Node, as it is also getting momentum in the SAP world with the release of HANA SPS11. The Sphero has no (or very limited) internal memory so it is not possible to actually store any code on the Sphero. Instead, we are using an edge device to control the Sphero, read the sensor data and expose it to the Internet. In our case this edge device is a MacBook Pro running OS X, but this could be replaced with another device fulfilling the following requirements:
- Run Node.js version 0.12.9 (Node v0.12.9 (LTS) | Node.js)
- Connect to the Xbox 360 Controller (on OS X use the following driver GitHub – 360Controller/360Controller: TattieBogle Xbox 360 Driver (with improvements))
While the local Node.js application will send the data to the HANA Cloud Platform, we are also going to show realtime data (current speed and battery state) within the SAPUI5 application. For this purpose, there is going to be another small Node.js application acting as a message broker forwarding information from the Sphero to the application and back.
Finally, to analyze the data, we will use SAP Lumira. We only leverage functionality from the Standard Edition, so there is no need to have a valid license for the full Desktop edition.
To follow the blog series, there are two hardware devices required: at least one Sphero and a Xbox 360 controller. A Sphero costs around $120 (EUR) on the Internet (Amazon.com, Apple.com, Sphero.com). We did our racing with the 2.0 and SPRK edition of Sphero, but the BB-8 version should work as well.
To control the Sphero we will use a Xbox 360 controller. Those are also available on the Internet for around $30 (EUR) either as a wired or wireless version. To connect a computer to a wireless controller, there is also a Wireless Receiver required, which need to be purchased in addition.
Ready to go
With the theoretical background and the hardware in place, we are ready to go. Our first goal is to connect our edge to the IoT device (Sphero) and write a short Node.js program to take control over our racing ball. See you in the next blog post.