Posted on

Internet of Things (IoT) Enablement Factors

Internet-of-Things-IoT-enablement-factors

Today we will be talking about the factors that enabled and boosted the Internet of Things (IoT).

1. Miniaturization Of Devices

The size (and cost) of electronic components that are needed to support capabilities such as sensing, tracking and control has been reducing and will continue to reduce as per Moore’s law.

2. Radio Frequency Identification (RFID)

Moving into the future, RFID has the potential to provide streams of data that will provide information systems with real-time, item-specific data and be flexible enough to be placed in extremely small spaces and locations, i.e., coil-on-chip technology.

3. Internet Protocol Version 6 (IPv6)

IPv6 is the next Internet addressing protocol that is used to replace IPv4. With IPv6, there are approximately 3.4×1038 (340 trillion) unique IPv6 addresses, allowing the Internet to continue to grow and innovate.

4. Communication Throughput And Lower Latency

Low latency makes it possible for IOT applications to query or receive quicker updates from sensor devices. LTE networks have latencies about 50-75 ms, which will open up new types of programming possibilities for application developers.

5. Low Power Consumption Devices

Low Power consumption devices will allow the devices to run for longer duration.  Some devices will use solar capability to run, which will be self-sustained.

6. Cloud Computing

IOT connects billions of devices and sensors to create new and innovative applications.  In order to support these applications, a reliable, elastic, and agile platform is essential. Cloud computing is one of the enabling platforms to support IOT, which provides required storage, processing power, and scaling capability.

7. Improved Security And Privacy

This allows the communication channel to be trustworthy. Critical business data can be passed by encryption or authentication code (MAC), protecting the confidentiality and authenticity of transaction data as it “transits” between networks.

There is still evolving standards in IoT security and with IPv6, IPsec support is integrated into the protocol design and connections can be secured when communicating with other IPv6 devices.

UI5CN

Posted on

The Internet of Things: an introduction

Internet of Things IoT Global Economic Value

 

What is The Internet of Things (IoT) ? What is its value ?

IoT Concept and Examples

The IOT concept was initially coined by a member of the Radio Frequency Identification (RFID) development community in 1999, and it has recently become more relevant to the practical world largely because of the growth of mobile devices, embedded and ubiquitous communication, cloud computing and data analytics.

Since then, many have seized on the phrase “Internet of Things” to refer to the general idea of things, especially everyday objects, that are readable, recognisable, locatable, addressable, and/or controllable via the Internet, irrespective of the communication means (whether via RFID, wireless LAN, wide- area networks, or other means).

Everyday objects include not only the electronic devices we encounter or the products of higher technological development such as vehicles and equipment but things that we do not ordinarily think of as electronic at all – such as food and clothing.

Examples of “things” include:

  • People
  • Animals and Natural ecosystem
  • Location (of objects)
  • Time Information (of objects)
  • Condition (of objects)

These “things” of the real world shall seamlessly integrate into the virtual world, enabling anytime, anywhere connectivity.

Internet of Things (IoT) Global Economic Value

In 2010, the number of everyday physical objects and devices connected to the Internet was around 1 billion.

Cisco forecasts that this figure will reach to 25 billion in 2015 as the number of more smart devices per person increases, and to a further 50 billion by 2020.

In addition, the global economic impact, which IoT will collectively have, will be more than $14 Trillion; if we compare this to the world population, then by 2020 we will have around more than six connected devices per person.

UI5CN

Posted on

SAP HANA Internet of Things (IoT): Raspberry, Arduino Uno, XSJS & SAPUI5: Part 7

 

SAP HANA IoT and The Internet of Things

If you have not seen yet, double check the introduction, first partsecond partthird partfourth partfifth part and sixth part of this SAP HANA IoT series.

Tying loose ends and going live

All the components are now setup individually and all we need to do is to run them synchronously.

We should double check the URLs of the services, that links Raspberry Pi to SAP HANA system, from the sensor side; and SAP HANA system to SAPUI5, from the front end user’s side.

Let’s go for the go-live.

We are going to open the SAPUI5 app screen and start the Java program that reads the serial data and sends it back to HANA:

SAP-HANA-IoT-with-Arduino-and-Raspberry-Pi-3-750x703

 

 

Now, once we start the Java program, we will instantly see the SAPUI5 app starts updating all the sensors data, on near real time basis.

A video result is shown here:

 

 

 

 

 

 

Congratulations we have now a working prototype ready of application leveraging Internet of Things with Raspberry Pi, Arduino Uno, sensors, SAP HANA and SAPUI5.

Posted on

SAP HANA Internet of Things (IoT): Raspberry, Arduino Uno, XSJS & SAPUI5: Part 6

 

SAP HANA IoT and The Internet of Things

If you have not seen yet, double check the introduction, first partsecond partthird partfourth part and fifth part of this SAP HANA IoT series.

Configuring SAP UI5

We have covered all the steps related to hardware setup and have also configured the backend SAP HANA.

We’ll configure now the UI which is going to show the sensor information.

SAP HANA IoT Internet of Things: Raspberry, Arduino Uno, XSJS & SAPUI5

The UI is simple and we have kept two tiles

The first tile is showing the value of the sensor ie. the LUX value or light intensity. The small window, below the reading value, tells how the sensor looks like (used custom CSS mapping).

We are going to create a simple view and controller and place the tiles in the view.The tiles will be placed in the tile container and the tile container will be returned inside the content of the page.

There are 3 main component here :

  1. Index.html
  2. View
  3. Controller.

Code for the above components are:

Index.html


HANA IoT

<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%3E%2F%2F%20%3C!%5BCDATA%5B%20sap.ui.localResources(%22shiot_ui%22)%3B%20app%20%3D%20new%20sap.m.App(%7BinitialPage%3A%22idshiot_ui1%22%7D)%3B%20var%20page%20%3D%20sap.ui.view(%7Bid%3A%22idshiot_ui1%22%2C%20viewName%3A%22shiot_ui_02.shiot_ui_02%22%2C%20type%3Asap.ui.core.mvc.ViewType.JS%7D)%3B%20app.addPage(page)%3B%20app.placeAt(%22content%22)%3B%20%2F%2F%20%5D%5D%3E%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;script&gt;" title="&lt;script&gt;" />


<div id="splash-screen">


<div class="splash-screen-text">


<div class="en">Welcome to HANA IoT Demo</div>


</div>




<div class="splash-screen-circle-outer"></div>




<div class="splash-screen-circle-inner"></div>


</div>


<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%20id%3D%22sap-ui-bootstrap%22%20src%3D%22https%3A%2F%2Fsapui5.hana.ondemand.com%2Fresources%2Fsap-ui-core.js%22%20data-sap-ui-libs%3D%22sap.m%2Csap.suite.ui.commons%2Csap.ui.core%2Csap.viz%22%20data-sap-ui-theme%3D%22sap_bluecrystal%22%3E%2F%2F%20%3C!%5BCDATA%5B%20%2F%2F%20%5D%5D%3E%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;script&gt;" title="&lt;script&gt;" />

View:


sap.ui.jsview("shiot_ui_02.shiot_ui_02", {

/** Specifies the Controller belonging to this View.

* In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.

* @memberOf shiot_ui_02.shiot_ui_02

*/

getControllerName : function() {

return "shiot_ui_02.shiot_ui_02";

},

/** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.

* Since the Controller is given to this method, its event handlers can be attached right away.

* @memberOf shiot_ui_02.shiot_ui_02

*/

createContent : function(oController) {

var content = new sap.suite.ui.commons.NumericContent("idInRateValue", {

size: "S",

scale: "LUX",

value: "{/value}",

valueColor: "Good",

indicator: "{/direction}"

});

var tileContent = new sap.suite.ui.commons.TileContent("idInTileCont", {

unit: "",

size: "L",

content: [

content

]

});

var tileInInfo = new sap.suite.ui.commons.GenericTile("idTileInInfo", {

header: "In",

size: "S",

frameType: "TwoByOne",

tileContent: [

tileContent

]

});

var tileCompr = new sap.suite.ui.commons.GenericTile("idAllGTStatus", {

header: "Compare Level",

size: "L",

scale: "L",

frameType: "TwoByOne",

press: function(){

sap.m.MessageToast.show("Demo");

},

tileContent: [

new sap.suite.ui.commons.TileContent("idDaysComprDash", {

size: "S",

scale: "S",

content: [

new sap.suite.ui.commons.ComparisonChart("idDaysCompr", {

size: "XS",

width: "18rem",

data: [

new sap.suite.ui.commons.ComparisonData({

title: "Maximum Limit",

value: "{/comparisonValue1}",

color: sap.suite.ui.commons.InfoTileValueColor.Error

}),

new sap.suite.ui.commons.ComparisonData({

title: "Current",

value: "{/comparisonValue2}",

color: sap.suite.ui.commons.InfoTileValueColor.Critical

}),new sap.suite.ui.commons.ComparisonData({

title: "Mimumim Limit",

value: "{/comparisonValue3}",

color: sap.suite.ui.commons.InfoTileValueColor.Good

})

]

})

]

})

]

});

tileCompr.addStyleClass("sapMTile backGroundWhite");

var custeReading = new sap.m.CustomTile({

content: [

tileContent

]

});

var custeCompare = new sap.m.CustomTile({

content: [

tileCompr

]

});

var tileContainer = new sap.m.TileContainer("idMainTiles", {

tiles: [

custeReading,

custeCompare

]

});

//Polling implementation

setInterval(oController.changeKPITest, 1000 * 3);

// create the page holding the List

var page1 = new sap.m.Page({

title: "HANA IoT KPI",

enableScrolling: false,

content : [

tileContainer

]

});

return page1;

}

});

Controller:


sap.ui.controller("shiot_ui_02.shiot_ui_02", {

/**

* Called when a controller is instantiated and its View controls (if available) are already created.

* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.

* @memberOf shiot_ui_02.shiot_ui_02

*/

//onInit: function() {

//

//},

/**

* Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered

* (NOT before the first rendering! onInit() is used for that one!).

* @memberOf shiot_ui_02.shiot_ui_02

*/

onBeforeRendering: function() {

var data =     {

"value": 0,

"direction": "Down",

"comparisonValue1": 0,

"comparisonValue2": 0,

"comparisonValue3": 0

};

var oModel = new sap.ui.model.json.JSONModel();

oModel.setData(data);

sap.ui.getCore().setModel(oModel);

},

//Triggers automatically for display test

changeKPITest: function(){

/*var min = 0;

var max = 100;

var newRandomreading = Math.floor(Math.random() * (max - min)) + min;*/

var url = "http:///demoApp/demo01/app01/services/getSensorReading.xsjs?id=";

var _SENSORID = "A001";

var _MAXLIMIT = 170;

var _MINLIMIT = 25;

var data =     {

"value": 0,

"direction": "Down",

"comparisonValue1": _MAXLIMIT,

"comparisonValue2": 0,

"comparisonValue3": _MINLIMIT

};

var oModel;

var newColorCode;

//for now hardcoding the sensor ID

url = url + _SENSORID;

//Doing the asyn call to HANA system

jQuery.ajax({

url: url,

async: true,

dataType: 'json',

type: 'GET',

success: function(oData) {

if (!oData) {

sap.m.MessageToast.show("Not able to get Data");

} else {

data["value"] = oData["value"];

data["comparisonValue2"] = oData["value"];

oModel =  sap.ui.getCore().getModel();

if(oModel.getData()["comparisonValue2"] &gt; data["comparisonValue2"]){

data["direction"] = "Down";

}else{

data["direction"] = "Up";

}

oModel.setData(data);

oModel.refresh();

//changing the color as well

newColorCode = parseInt(data["value"])*2  ;

if(newColorCode &gt; 255){

newColorCode = 255;

}

$('#idInTileCont-footer-text').css("background-color", "rgba("+newColorCode+", "+newColorCode+", "+newColorCode+", 0.99)");

}

},

error: function(XMLHttpRequest, textStatus, errorThrown) {

sap.m.MessageToast.show("Connection not able to establish");

}

});

},

/**

* Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here.

* This hook is the same one that SAPUI5 controls get after being rendered.

* @memberOf shiot_ui_02.shiot_ui_02

*/

//onAfterRendering: function() {

//

//},

/**

* Called when the Controller is destroyed. Use this one to free resources and finalize activities.

* @memberOf shiot_ui_02.shiot_ui_02

*/

//onExit: function() {

//

//}

});

Here the controller function changeKPITest is polled every 3 sec and we have the new data bound to model, which is returned from SAP HANA XSJS AJAX call .

It is better to have a push notification feature in here instead of polling which, is called web-­­sockets, but for simplicity purpose we have kept the configuration minimal.

In part 7, we are tying the loose ends and going live.

UI5CN

UI5CN

Posted on

SAP HANA Internet of Things (IoT): Raspberry, Arduino Uno, XSJS & SAPUI5: Part 5

 

SAP HANA IoT and The Internet of Things

If you have not seen yet, double check the introduction, first partsecond partthird part and fourth part of this SAP HANA IoT series.

We have already covered all the steps related to hardware setup and configuration.

We are going now to focus our attention on SAP HANA and interfacing it with our SAP UI5 frontend.

We are going to cover the SAP HANA setup in this part and SAPUI5 setup in part 6 of the series:

SAP HANA IoT Internet of Things (IoT): Raspberry, Arduino Uno, XSJS & SAPUI5

Steps which we are going to follow for configuring SAP HANA

Step1: Create the Data Definition for our HANA XS which will be storing the data.

Step2: Create the SQL procedures to do data operations.

Step3: Create the XSJS services to act as a Gateway between the SQL Procedures calls and the service calls for Raspberry Pi and SAPUI5 application.

Step1 – Create the Data Definition for HANA XS

We  are going to name it Demo Schema .hdbschema. Note here that demoApp.demo01.app02 is the package path and SHIOT_02 is the project name:


namespace demoApp.demo01.app02.SHIOT_02.Data;

@Schema: 'DemoSchema'

context demo02sensorNetwork {

type sensor_key : String(10);

@Schema: 'DemoSchema'

context demo02sensorNetwork {

type sensor_key : String(10);

@Catalog.tableType : #COLUMN

Entity demo02sensor_info_MD {

key ID: sensor_key;

DESC: String(200);

};

@Catalog.tableType : #COLUMN

Entity demo02sensor_active_TS {

key ID: sensor_key;

key time_stamp: UTCTimestamp;

value : Integer;

};

Once you have activate the code, you need to create two tables demo02sensor_active_TS and demo02sensor_info_MD .

demo02sensor_active_TS: Stores the transactional Data of the sensors (readings with timestamp).

demo02sensor_info_MD: Stores the Master Data of the sensors (Sensor Id’s)

Step2 – Create the SQL procedures to do data operations

We have to create two SQL procedures for data operations: insert_sensor_reading.hdbprocedure and sensor_read.hdbprocedure.

As the names suggest, the  first one is going to insert sensor data in sensor table and second one is going to read the recent sensor data from the table.

insert_sensor_reading.hdbprocedure is inside the folder Procedures. It is taking sensor ID and sensor Reading as input:

PROCEDURE


"DemoSchema"."demoApp.demo01.app02.SHIOT_02.Procedures::insert_sensor_reading" (

IN SENSORID NVARCHAR(10),

IN sensor_reading INTEGER )

LANGUAGE SQLSCRIPT AS

BEGIN

/*****************************

Inserting sensor Data

*****************************/

insert into "demoApp.demo01.app02.SHIOT_02.Data::demos02sensorNetwork.demo02sensor_active_TS"

VALUES(:SENSORID, CURRENT_TIMESTAMP , sensor_reading

);

END;

sensor_read.hdbprocedure is inside the folder Procedures. It is taking sensor ID as input and returns one data set of demo02sensor_active_TS.

PROCEDURE


"DemoSchema"."demoApp.demo01.app02.SHIOT_02.Procedures::sensor_read(

IN id NVARCHAR(10),

OUT result "DemoSchema"."demoApp.demo01.app02.SHIOT_02.Data::demo02sensorNetwork.demo02sensor_active_TS")

LANGUAGE SQLSCRIPT

SQL SECURITY INVOKER

--DEFAULT SCHEMA

READS SQL DATA &lt;u&gt;AS&lt;/u&gt;

BEGIN

/*****************************

Reading sensors Data

*****************************/

result = select *

from "DemoSchema"."demoApp.demo01.app02.SHIOT_02.Data::demo02sensorNetwork.demo02sensor_active_TS"

where "ID" = :id and "time_stamp" = (select max("time_stamp") from

"DemoSchema"."demoApp.demo01.app02.SHIOT_02.Data::demo02sensorNetwork.demo02sensor_active_TS"

where "ID"= :id);

END;

Step3: Create the XSJS services

Create the XSJS services to act as a Gateway between the SQL Procedures calls and the service calls for Raspberry Pi and SAP UI5 application:

We have two services.

The first one is getSensorReading.xsjs which reads the recent sensor reading for the sensor id, passed in the URL. It uses sensor_read.hdbprocedure for database call.


var sensorId = $.request.parameters.get("id");

var body = "error";

var data ={

"id":"error",

"timestamp":"error",

"value":0

};

body = sensorId;

if(sensorId === undefined){

$.response.setBody( "Invalid key !!!");

}

else{

$.response.contentType = "text/plain";

$.response.setBody(sensorId);

try {

var conn = $.db.getConnection();

var query = 'call \"demoApp.demo01.app02.SHIOT_02.Procedures::sensor_read\"(?,?)';

var cst = conn.prepareCall(query);

cst.setString(1, sensorId);

var rs = cst.execute();

conn.commit();

rs = cst.getResultSet();

while(rs.next()){

data.id = rs.getNString(1);

data.timestamp= rs.getTimestamp(2) ;

data.value= rs.getInteger(3);

}

body = JSON.stringify(data);

conn.close();

} catch (e) {

body = e.stack + "\nName:"+ e.name+"\nMsg" + e.message;

$.response.status = $.net.http.BAD_REQUEST;

}

}

$.response.contentType = "text/plain";

$.response.setBody(body);

Then after that, we use putSensorReading.xsjs which reads the recent sensor reading for the sensor id and sensor value passed in the URL. It uses insert_sensor_reading.hdbprocedure for database call to store the data.


var sensorId = $.request.parameters.get("id");

var sensorReading = $.request.parameters.get("value");

sensorReading = parseInt(sensorReading,10);

var body = "error";

if(sensorId === undefined){

$.response.setBody( "Invalid key !!!");

}

else{

$.response.contentType = "text/plain";

$.response.setBody(sensorId);

try {

var conn = $.db.getConnection();

var query = 'call \"demoApp.demo01.app02.SHIOT_02.Procedures::insert_sensor_reading\"(?,?)';

var cst = conn.prepareCall(query);

cst.setString(1, sensorId);

cst.setInteger(2, sensorReading);

var rs = cst.execute();

conn.commit();

//as no record returned

if(rs == 0){

body = true;

}

conn.close();

} catch (e) {

body = e.stack + "\nName:"+ e.name+"\nMsg" + e.message;

$.response.status = $.net.http.BAD_REQUEST;

}

}

$.response.contentType = "text/plain";

$.response.setBody(body);

In the real world setup we need also to assign the security key to each sensor and pass it to verify the readings.

Also it would be better to have the timestamp taken from the sensor source and store it in the database but for keeping the coding and complexity minimum we are focusing on the core steps.

In part 6, we are going to setup the SAPUI5 App and integrate it with the backend.

UI5CN