Posted on

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

 

SAP HANA IoT and The Internet of Things

In this entire blog series, we are going to cover one SAP Internet of Things (IoT) application setup, end to end.

Scope and Goals of our HANA IoT Project

SAP HANA IoT has started and is not just one more buzzword.

We have chosen a smart home example which will monitor our place. An example that everyone can relate to.

A photosensor will be monitoring the activity in our place and sending the data to an SAP HANA system, using Arduino and Raspberry Pi, in real-time.

From SAP HANA, you will be using SAPUI5 dashboarding capability to see the LUX  sensor information, in a fancy and simple UI.

Amazing isn’t it?

So prepare for the future and read on.

The main components of this project are:

  1. Lights
  2. Photoelectric sensors
  3. Raspberry Pi
  4. Arduino 
  5. SAP HANA system
  6. SAPUI5 technology

 

Raspberry Pi arduino for IoT UI5CN

This project, SAP HANA IoT With Arduino Uno, Raspberry Pi, HANA XSJS and SAPUI5, will be detailed in the next blogs:

UI5CN

Posted on

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

 

SAP HANA IoT and The Internet of Things

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

If you have not seen yet, double check the introductionthe first part and the second part of this SAP HANA IoT series.

Today, in this article we are going to perform:

Step 2 – Connect Raspberry Pi to Arduino and able to establish the same configuration which was achieved via computer and Arduino

Since there are many sub-steps, we will cover this step in this part 3 and the the following part 4 of this series.

Here, we are going to do the Raspberry Pi configuration and connecting it to the Arduino Uno.

Raspberry Pi is capable of running a complete operating system and the real advantage is the capability to running with so less power consumption and the easiness to interface with other micro-controller and digital/analog devices .

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

Why do we use Arduino here ?

Raspberry Pi is a fine little computer board, though not nearly as good as the Arduino when it comes to I/O capabilities.

Since our experiment has a sensor network setup, it will be simpler to interface it with Arduino Uno.

Once we have the Arduino connection setup , then we can connect the Raspberry Pi through serial connection and do wonders with it.

Now, we are going to see how you can setup the connection of Raspberry and Arduino Uno in 10 simple steps:

Step 1: Download the RASPBIAN OS in Raspberry download section.

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

Step 2: Write the image to the disc (SD card) using Win32 image. Bear in mind that If you copy and paste the disk to image then it will not work.

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

Step 3.Open the SD card in your computer and add following line to the end of file cmdline.txt. Make sure that you leave a line break at the end, as in Linux it will be assumed to be execution of the command. It will be better to use notepad++ to edit, as sometimes notepad can insert some windows specific characters in the file which will not work in Linux (Raspberry system).

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

In the above image , the Raspberry IP address is first one and our Ethernet port IP is second one. This will enable to connect Raspberry Pi to the Internet through our computer.

Step 4: Change the IP of your Ethernet port to the IP which you have specified in the config file. In this tutorial, it is 192.168.137.1

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

Step 5: Install Xming and Putty. Putty will be used to establish a SSH connection to Taspberry Pi and Xming will be used to create a graphical session .Download link of Putty and Xming.

Step 6: Once you have installed them, run Xming server and then open Putty.

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

Enter the IP address of the Raspberry Pi you configured in step 3 i.e :192.168.137.10

Also make sure that you have SSH enabled in X11 :

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

Now press open.

Step 7: It will ask for user name and password: username is pi and password is raspberry

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

Now you are inside the Raspberry Pi 🙂

To view the graphical interface, you have to type lxsession and if everything is correct you will be able to see the graphical navigation window of Raspberry:

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

Step 8: After you have closed the graphical session using CTR+ Z, install Arduino to Raspberry, using the bellow commands:

sudo apt-get update

sudo apt-get install Arduino

After the installation, you will get a success message as well.

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

Step 9: Open the graphical session again using lxsession command and open the Arduino sketch IDE that has been installed:

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

Step 10: Now we have the Arduno’s sketch installed in the Raspberry Pi OS. This final step is to check if we can see the serial port connection visible (/dev/ttyACM0 in Raspberry OS).

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

We will use this port for our devices’ communication, in the use cases.

In part 4 we will install Java in order to enable a Java program to communicate with Arduino’s serial port 🙂

Posted on

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

 

SAP HANA IoT and The Internet of Things

If you have not seen yet, double check the introduction and the first part of this SAP HANA IoT series.
SAP HANA IoT Internet of Things: Raspberry, Arduino Uno, XSJS & SAPUI5Today, in this article we are going to perform:

Step 1 – Connect our Arduino to a Computer and checking if the analog input is working perfectly

For this experiment we have photo sensors that will detect the light intensity and give the data to a computer by serial port communication.

First, install the Arduino Kit from here, to your computer. In our scenario, we will be using Windows.

It looks like this after the installation:

 

Check also the serial port which is connected to Arduino and set the right port in your installed software:

 

Now, for this demo we are going to follow the circuit diagram below:

 

Our circuit looks like this:

 

Let’s have a look at the code which takes analog input from serial output:


/*

Analog input, analog output, serial output
Reads an analog input pin, maps the result to a range from 0 to 255
and uses the result to set the pulsewidth modulation (PWM) of an output pin.
Also prints the results to the serial monitor.
The circuit:
* potentiometer connected to analog pin 0.
Center pin of the potentiometer goes to the analog pin.
side pins of the potentiometer go to +5V and ground
* LED connected from digital pin 9 to ground
created 29 Dec. 2008
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
*/
// These constants won’t change. They’re used to give names
// to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);
// print the results to the serial monitor:
Serial.println(sensorValue);
// wait 5 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(500);
}

Here we are trying to read the analog signal from the photo sensor, via Arduino, and then Arduino will send it via serial port to the computer and use it to show the data sensor reading.

After writing the program you should upload the program to the Arduino Uno.

 

And now to see the magic happening, open the serial monitor in top right side of the program.

 

We have demonstrated the result of the step 1 in a short video: SAP HANA IoT with Arduino and Raspberry Pi.

In SAP HANA IoT With Arduino and Raspberry Pi: Part 3, we will be performing step 2.

UI5CN

Posted on

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

 

SAP HANA IoT and The Internet of Things

If you have not seen yet, double check the introduction of this series.

Before starting the project we should know why we selected both Arduino and Raspberry Pi .

SAP HANA IoT Project – why Raspberry Pi and Arduino ?

The Raspberry Pi is a low-cost credit-card-size computer with an ARM-processor that has a huge community to help to build applications.

pie

Raspberry Pi can multitask processes – it can run multiple programs in the background while activated. For example, you can have a Raspberry Pi that is serving as both a print server and a VPN server, at the same time.

Arduino is a micro-controller with easier capability to integrate analog input,

aud

The Arduino IDE is significantly easier to use than Linux.

For example, if you wanted to write a program to blink a LED with Raspberry Pi, you’d need to install an operating system and some code libraries – and that’s just to start. Whereas, with Arduino, you can get a LED light to blink in just eight lines of code.

Arduino isn’t designed to run an OS or a lot of software, you can just plug it in and get started.

You can leave an Arduino plugged in as it conducts a single process for a long time, and just unplug it when you’re not using it. This is why we recommend the Arduino for beginners before going for Pi.

As per Limor Fried, the founder of Adafruit, a DIY electronics store that offers parts and kits for both Arduino and Pi projects, “The Arduino is simpler, harder to ‘break’ or ‘damage’ and has much more learning resources at this time for beginners, With the Pi you have to learn some Linux as well as programming—such as Python. The Arduino works with any computer and can run off of a battery. You can also turn it on and off safely at any time. The Pi setup can be damaged by unplugging it without a proper shutdown.”

While the Raspberry Pi shines in software application, the Arduino makes hardware projects very simple. It’s simply a matter of figuring out what you want to do.

Sound like Raspberry Pi is superior to Arduino, but that’s only when it comes to software applications. Arduino’s simplicity makes it a much better bet for pure hardware projects.

The ultimate answer when deciding between the Pi and Arduino is, “Why choose?”

If you’re looking to learn about IoT, each one will teach you something different.

Raspberry Pi and Arduino are complementary. Ideally expert suggests a scenario where the Arduino is the sensory workhouse, while the Pi doles out directions.

both

Our SAP HANA IoT Project Steps

So we are going to do exactly that, in this article series we are going to use:

  1. Arduino for analog interface
  2. and providing data in digital format to Raspberry Pi
  3. and Pi should take care of communication to SAP HANA.

Simplified steps are :

Step 1: Connect Arduino to a Computer and checking if the analog input is working perfectly. For this experiment, we have photosensors that will detect light intensity and give the data to a computer by serial port communication, through Arduino.

Step 2. Connect Raspberry Pi to Arduino and able to establish the same configuration which was achieved via computer and Arduino. Also setting up a webserver in Raspberry Pi which can communicate over internet.

Step 3: Storing data into the SAP HANA system from Pi and displaying it using SAPUI5 in near real time.

In SAP HANA IoT With Arduino and Raspberry Pi: Part 2, we will be performing step 1.

UI5CN