
The Internet of Things (IoT) is the network of physical objects or "things" embedded with electronics, software, sensors and connectivity to enable it to achieve greater value and service by exchanging data with the manufacturer, operator and/or other connected devices.
There are already some simple applications in the market based on IoT, like smart umbrellas and smart houses.
In industry, predictive maintenance capability of machinery is avoiding unplanned downtime, in order to save huge failover cost and time.
According to recent reports and estimation, by Gartner and Cisco, the economic impact that IoT will have in coming 5 years is more than $14 trillion.
Recent buying of connected home device maker Nest, for $3.2 billion, and seven more similar companies, by Google, has hyped the IoT even more.
The projects involving Internet of Things (IoT) will be very different from the way we normally deliver enterprise solutions, since developers will need to know and understand the connected devices and the new architecture and security standards.
The testing landscape will be completely transformed which will ensure the application robustness, security and fault safe.
Once the security standards are set for IoT applications, UX will drive the competitiveness in the marketplace, between major players.
Apart from the new architecture and standards, there will be many new components like sensors, microcontrollers and microprocessors, and interfacing and programming tasks, which one needs to know to work in IoT projects.
A sensor is a transducer whose purpose is to sense (that is, to detect) some characteristics of its environment. It detects events or changes in quantities and provides a corresponding output, generally as an electrical or optical signal; for example, a thermocouple converts temperature to an output voltage.
There are 2 categories: Digital and Analogic sensors.
Digital sensors can interface digital devices, like your computer, but analogic sensors need an Analogic to Digital convertor (A to D convertor) for interfacing with computing devices.
Digital sensors are easy to interface compared to analogic sensors, but have limitations like inflexibility and are more expensive.
A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single integrated circuit, containing a processor core, memory and programmable input/output peripherals.
Program memory as RAM, Flash or ROM is also often included in chips.
Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications.
Analogic sensors can be connected to microcontrolling devices like Arduino, which can be easily programmed to control and monitor sensor data.
Arduino can then be interfaced with other devices for helping in other tasks.
Raspberry Pi, which is a microprocessor also well known for its size and computation capability, has been widely used to interface with Arduino, in IoT applications.
Arduino and Raspberry Pi can be easily setup through serial communication, using USB connection .
Both Raspberry Pi and Arduino have a huge community around it to help developers building applications.
There are already some customers who are leveraging IoT capabilities.
Although most of the projects that involve IoT are carried with an aura of secrecy to maintain competitive advantage, there are some popular SAP public examples that include Kaeser Kompressoren predictive maintenance, BMW connected cars and AMG sensors for engine testing.
These examples are some of the next generation manufacturing operations, so-called Industry 4.0.
To understand IoT, and the individual components, we have chosen a problem/project to keep things interesting.
We are going to setup a small home monitoring system.
We are going to use a photo sensor that will measure the light intensity of a room and then monitor it remotely,
We can monitor a facility during our absence.
SAP HANA is best suited for IoT for its In memory capability, which plays a major role when we have huge data set, and analytics capability, for real time monitoring.
Arduino is an open-source computer hardware and software company that designs and manufactures kits for building digital devices and interactive objects that can sense and control the physical world. Arduino boards may be purchased preassembled, or as do-it-yourself kits; at the same time, the hardware design information is available for those who would like to assemble an Arduino from scratch.
The project is based on a family of microcontroller board designs, manufactured primarily by SmartProjects in Italy and also by several other vendors, using various 8-bit Atmel AVR microcontrollers or 32-bit Atmel ARM processors.
These systems provide sets of digital and analogic I/O pins that can be interfaced with various extension boards and circuits. The boards feature serial communication interfaces, including USB on some models, for loading programs from personal computers.
For programming the microcontrollers, the Arduino platform provides an integrated development environment (IDE) based on the Processing project, which includes support for C and C++ programming languages.
It can be bought in Amazon within $10-$20.
The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button.
It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable, or power it with a AC-to-DC adapter or battery, to get started.
Main Interfacing Components of Arduino Uno
A sketch is the name that Arduino uses for a program. It's the unit of code that is uploaded to and run on an Arduino board.
There are many example programs present in the IDE of Arduino, which can be used to learn and use in real life projects .
There are two special functions that are part of every Arduino sketch: setup()and loop().
The setup()is called once, when the sketch starts. It's a good place to do setup tasks like setting pin modes or initializing libraries. The loop()function is called over and over and is the heart of most sketches. You need to include both functions in your sketch, even if you don't need them for anything.
A variable in sketch is a place for storing a piece of data. It has a name, a type, and a value. For example, our blink sketch declares a variable with the name ledPin, with type int, and an initial value of 13. It's being used to indicate which Arduino pin the LED is connected to. Every time the name ledPinappears in the code, its value will be retrieved.
Serial monitor can be used for real serial data from Arduino. The frequency at both ends needs to be set with the same values to make it happen.
Breadboard
Breadboard, sometimes known as a solderless breadboard. It has lots of holes that you can stick wires or electronic components into, and which are connected inside the breadboard. This lets you create a circuit containing multiple components without having to physically attach them to each other.
Interfacing a circuit with Arduino requires setting a power input in the circuit and connecting the sensor or device with Digital/Analog I/O pins, depending on the type of device and/or sensors.
Raspberry Pi is a series of credit card-sized single-board computers, developed in the UK by the Raspberry Pi Foundation, with the intention of promoting the teaching of basic computer science in schools.
Raspberry Pi is capable of running a complete operating system and the real advantage is the capability to run with so less power consumption and the easiness to interface with other micro-controllers and digital and analogic devices .
The original Raspberry Pi is based on the Broadcom system on a chip (SoC), which includes an ARM700 MHzprocessor, VideoCore GPU, and was originally shipped with 256 megabytes of RAM, later upgraded (models B and B+) to 512 MB.
The system has Secure Digital (SD) or MicroSD sockets for boot media and persistent storage.
The chip used in the Raspberry Pi is equivalent to a chip used in a cellphone, and does not become hot enough to need any special cooling. RAM in Raspberry Pi is a Package on Package (POP) on top of the SoC (system on a chip), so it is not removable or swappable, and 512 MB is the maximum RAM the Raspberry Pi can support since there are no manufacturers making larger-capacity compatible devices.
The GPU provides Open GL1080p30 H.264 high-profile encode and decode.The GPU is capable of 1Gpixel/s, 1.5Gtexel/s or 24 GFLOPs of general purpose computing and features a bunch of texture filtering and DMA infrastructure. This means that graphics capabilities are roughly equivalent to the original Xbox's level of performance. Overall, real world performance is something like a 300MHz Pentium 2, only with much, much swankier graphics
The Raspberry Pi primarily uses Linux-kernel-based operating systems. It also has a huge open source community build around it.
Raspberry Pi is a fine little computer board, though not nearly as good as the Arduino when it comes to I/O capabilities.
It is very simple to interface with Arduino and once we have made the Arduino connection we can connect Raspberry Pi through serial connection and do wonders with it.
Steps for Configuring Raspberry Pi and connecting it to computer and Internet:
Install Java in the Raspberry Pi
Usually Raspbian will come with Java installed but you can still check it via the following command:
java -version
When you update your Raspbian it will also update the Java library, if required.
sudo apt-get update
The communication is in serial mode between Arduino and Raspberry Pi, so we need a way to make our Java program to understand it.
So download the below files:
libjawt.so
librxtxSerial.so
RXTXcomm.jar
and go into the download folder of the files and type the below commands:
sudo cp libjawt.so /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/lib/arm
sudo cp RXTXcomm.jar /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre/lib
sudo cp librxtxSerial.so /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/lib/arm
sudo cp librxtxSerial.so /usr/lib/jni/
Now, we are assuming here that you have your jdk-8-oracle-arm-vfp-hflt inside your /usr/lib/jvm.
If not, then your Java is not updated to jdk-8 and you have to update the JDK and JRE .
sudo apt-get install oracle-java8-installer
Install Jedit for quick and easy copy and paste in Raspberry Pi .
Copy Java program from UI5CN blog part 4 and compile it with the following command:
javac -source 1.6 -target 1.6 -cp /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre/lib/RXTXcomm.jar SerialTestGET.java
Here, we are giving class path of our RXTX.jar file and using 1.6 compatible compiler mode because the Jar file is 1.6 compatible.
Run the class file which you created from the compilation using
java SerialTestGET
The overall usecase which we have considered involves the following communication sequence:
Sensor->Arduino->Raspberry Pi->Internet->SAP HANA XSJS->SAP HANA DB->SAP UI5 Application
Raspberry Pi will be sending data to SAP HANA by invoking SAP XSJS script and providing data in request parameter.
The data is stored in a table where we are going to store the sensor ID, timestamp and the sensor value.
SAPUI5 application will be reading recent data using polling mechanism.
In order to keep the development process simple to understand we have not provided a security key validation during sensor reading insertion into HANA DB.
And also we have not considered the timestamp when the data is inserted in the database so we could avoid the timestamp conversion steps.
SAPUI5 application will have two tiles: one to show near real time sensor values and another as a comparator.
Note: In real life IoT project these two things should be included. We can also use push notification instead of polling which is a better alternative in real IoT world projects.
We are going to create the following files:
DemoSchema.hdbschema: For linking the DemoSchema to the project.
SensorNetwork.hbdd: For our Data Definition.
insert_sensors_reading.hdbprocedure: For inserting sensor data to HANA database.
sensor_read.hdbprocedure: For reading recent sensor data from HANA database.
getSensorReading.xsjs: For passing recent sensor data to SAPUI5 application.
putSensorReading.xsjs: For allowing Raspberry Pi to insert sensor reading to SAP HANA database.
.xsaccess and anonymous_access.xssqlcc: For providing anonymous access to HANA Database .
We need to configure the anonymous access by going into HANA admin panel using URL:
https://<ip:host>/sap/hana/xs/admin/
We need to download Eclipse Kepler and install SAP HANA plugins from this repository https://tools.hana.ondemand.com/kepler/
We need to copy the program present in the powerpoint to the corresponding files.
Special attention: make changes in the code if you are going to use a different package structure. In this case, you need to replace all the occurrences of demoApp.demo01.app02.SHIOT_02 with your HANA project package path.
.hdbschema is a design-time definition of a database schema, which organizes database objects into groups.
This database schema enables you to create and activate application artifacts such as tables, views and database procedures. Without a defined schema, database objects cannot be generated in the SAP HANA catalog upon activation of specific design-time artifacts that are added to the SAP HANA repository.
SAP HANA repository: The SAP HANA repository is the central component of the SAP HANA development infrastructure and an integral part of the SAP HANA system. The repository is used for central storage and versioning of software artifacts, and it is also the foundation for lifecycle management for SAP HANA content and for the translation of SAP HANA applications. The repository provides the export and import functions needed for shipping applications to customers and for transporting development results between SAP HANA systems.
The XSJS file are using $.request.parameters.get() function to read data from the URL and $.response.contentType, $.response.status and $.response.setBody() variables and function respectively to set the response of the XSJS script.
HANA database procedures are called by the XSJS script using conn.prepareCall() function which takes a parameter called query that corresponds to our stored procedure call statement with appropriate parameter set using setString() and setInteger() integer.
On successful reading of the record we will get a record of demo02sensor_active_TS which is storing sensor Transactional Data in our HANA Database.
On successful insertion of a new record in demo02sensor_active_TS table we get zero number of the record in the database.
Having exception handling in XSJS script is useful as it can give you a quick feedback in case of errors.
Given an overview of the architecture and concepts of SAPUI5
SAPUI5 is a client UI technology based on JavaScript, CSS and HTML5. SAPUI5 applications run in a browser. Depending on the device the application is to run on (mobile, tablet or desktop PC), you use different UI libraries.
In the Model View Controller concept, the representation of information is separated from the user's interaction:
As SAPUI5 is a client-side web UI library meaning that it runs in a browser, a SAPUI5 application typically is composed of an HTML page and, if required, many more files.
To create a SAPUI5 Application Project, you must have installed the SAPUI5 Application Development feature in your Eclipse installation.
As SAPUI5 is a client-side web UI library meaning that it runs in a browser, a SAPUI5 application typically is composed of an HTML page and, if required, many more files.
SAPUI5 is implemented in JavaScript. For loading SAPUI5, its bootstrap needs to be included with a <script> tag. The last two attributes select the visual design to apply initially (other choices would be sap_hcb or sap_goldreflection) and the SAPUI5 control library/libraries to use . In your scenario you need to make sure the URL points to a SAPUI5 installation.
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
SAP UI5 project for this project is very simple and contains only one Controller SHIOT_UI_02.controller.js and a view SHIOT_UI_02.view.js.
View:
View is using sap.suite.ui.commons.GenericTile and placing them in tile container sap.suite.ui.commons.TileContent which is added to the content section of the sap.m.Page.
setInterval() is responsible for the polling mechanism in the View which will run the changeKPITest function of the controller every 3 sec.
Controller :
changeKPITest() is responsible for calling XSJS script using AJAX and updating the SAPUI5 model which is bound to the tiles. It is also changing the small color window background CSS relative to sensor measurement.
The development code can be found in the powerpoint provided in the resource section or UI5CN blog.
SAP UI5 application need to be linked to our previously build SAP HANA project .
This section is the Go-Live phase where we tie the loose ends.
So far, we have connected the sensor circuit, interfaced it with Arduino and connected Arduino to Raspberry Pi which is able to reach internet and read serial data from a Java program.
From SAP side, we have our SAP HANA native development and SAPUI5 frontend ready.
We are going to start the Raspberry Pi Java program and open the SAPUI5 application in our browser.
We will see the dashboard changing based on the sensor reading of our home.
Congratulations!
You have reached the end of the course.
This video wraps everything up and it's where we thank you for sticking with us throughout this course.
And lastly... please ... leave a review and if you liked it give a 5-star rating.
Tell us if you enjoyed the course and found the material useful.
If you think we could have done something better, please say so.
We love to learn from past experiences.
Kind regards!
PubNub is a cloud based Data Stream Network.
It allows you to build and deploy realtime apps with excellent scalability, reliability, performance and service.
Already some big names are using PubNub like SAP Finance, Coca-Cola, McDonald's, CBS,Yahoo and more.
PubNub supports more than 70 SDK which allows developers to take advantage of PubNub cloud.
The free account provides 1 Million messages with 100 devices on 30 days trial which is enough to learn the
basics of using PubNub and create IoT usecases and Proof-of-Concepts for customers.
We have already setup a sensor circuit which is sending data to Arduino which is connected to internet via Raspberry Pi .
Raspberry Pi is pushing the sensor readings to SAP HANA. And in the frontend SAP UI5 application is able to show the data in near real time .
Now we are going to extend the usecase by making Raspberry Pi communicate directly to Pubnub cloud to push data updates and also enabling push notification capabilities to our SAP UI5 frontend.
We will change our existing Java code by replacing the module, which was pushing data to SAP HANA, to make it push data to PubNub Cloud. The Java development is easy to follow through.
The Jar files required are linked in the external links section on this lecture with the Java program code which will be used in this project .
We suggest you to sign up with PubNub and go to admin console where you will get Subscribe key and Publish key which you need to replace in our code.
Once you start your Java program, it will be able to send data via your PubNub cloud to the my_channel which is a default channel given to you when you sign up with PubNub on trial basis for free.
The front end UI5 code will be able to get push notifications from the PubNub cloud, if you subscribe to the same channel with the same keys in which the Raspberry Pi is publishing the data.
For now we are only displaying the sensor data in console and the communication are in real time.
Do you know why all of a sudden all big names in IT like SAP, IBM, Apple, Google and Amazon are talking about Internet of Things so seriously ?
Have you ever read an article or attended a talk or watched a video or even spoke to your colleagues about Internet of Things (IoT) and it filled you with more questions than answers ?
To put in a very simple way, IoT will be bigger than anything that's ever been done in high tech and IoT projects are not simple to do, therefore consultants and teams who are working in IoT are paid top rates and salaries.
After long and extensive work of more than 5 SAP consultants and hardware experts for more than 1 month, we are able to finally compile a course which can cover entire end-to-end Internet of Things, in a simple and easy to understand way .
This course is packed with information, knowledge, hands-on and real life project experience learning.
After taking this course :
We have covered SAP HANA Native development, SAPUI5, Raspberry Pi, Arduino Uno and sensor interfacing to solve a personal life problem that will keep the course interesting and fun. Once we achieved that, we will extend the same project by using PubNub Cloud platform and replacing SAP HANA backend.
All the steps are easy to follow and understand.
You will be learning some of the most difficult technologies with ease because this course was compiled based upon DEEP principle.
Even if you are a beginner in IT or an expert or a manager you will never regret after taking this course.
We are giving you a 30 days money back guarantee!
The Future is Now!