Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Former Member

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

The Raspberry Pi is a low-cost credit-card-size computer with an ARM-processor that has a huge community to help build applications .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.

On the other hand Arduino is a microcontroller with easier capability to integrate analogous input, The Arduino IDE is significantly easier to use than Linux. For example, if you wanted to write a program to blink an LED with Raspberry Pi, you’d need to install an operating system and some code libraries—and that’s just to start. On Arduino, you can get an LED light to blink in just eight lines of code. Since Arduino isn’t designed to run an OS or a lot of software, you can just plug it in and get started.

On the other hand, 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 expert would 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.

So we are going to do exactly that , in this our 3 step  blog we are going to use arduino that is to interface analogous and provide data in digital format to Pie and Pie should take care of communication to SAP HANA.

Simplified steps are :

Step 1: Connect Arduino to Computer and checking the Analog input is working perfectly .For this Experiment we are choosing Photo sensors which will detect the intensity of light and will give the data to computer by serial port communication.

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

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

For this blog we are going to perform Step 1:

First install the Arduino Kit from here to your computer, for me it is windows .It looks like this after installation:

Also check the Serial port which is connected to Arduino and set the right port in your installed software

Now for this demo we are going for below circuit diagram:

And mine circuit looks like this in real world :wink:

We are going to use 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:
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.print("sensor = " );
  Serial.print("\t output = ");
  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:

Here we are trying to read the analog signal from the photo sensor via Arduino and then Arduino is going to send it via Serial port to computer and use it to show the data reading of the sensor.

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

And to see the magic open the serial Monitor in top right side of the program.

We have demonstrated the result of the step 1 in a short video which is here.

-Ajay Nayak


Labels in this area