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!
cancel
Showing results for 
Search instead for 
Did you mean: 
WouterLemaire
Active Contributor
DescriptionHyperlink
OverviewHCP IoT HANA Car v1.0
Internet of Things configurationHANA Car v1.0 - Internet of Things configuration
UI5 Java WebappHANA Car v1.0 – Java Webapp
The Car with raspberry PiHANA Car v1.0 – Raspberry Pi

Introduction

Once upon a time when I was still in high school I was dreaming of building my own car with remote control. At that time there was a great James Bond movie where James Bond controlled his car from his Nokia phone! This was incredible at that time! Here you have a scene of the James Bond movie where he’s using the remote control:

https://youtu.be/meY1R43fJIQ

This was my inspiration to build my own remote controlled car someday. That day has finally come :smile: Okay, building a remote controlled car isn’t that big of a deal.  It’s the underlying technology that makes this remote controlled car special. This remote controlled car is using Internet of Things service on top of the HANA Cloud Platform!  Thanks to this service I can control the car from everywhere as long as the car is connected to a Wifi network. (This could be improved with a 3G module.) All the data of the car will be stored in HANA, that’s why it’s called the “HANA Car”.

The Big Picture

I created a car with a Raspberry Pi which I can control from a UI5 application.The UI5 app sends messages to a Java servlet in HCP. The Java servlet sends messages to the IoT service in HCP and the IoT service sends messages to the car (raspberry pi).

Car

I started from an old “Radio Remote Controlled Toy Car” like this:

First I removed the electronic components of the car and only left the two motors of the car. One motor for going forward and backward, one for turning left and right. Then I connected the motors to motor controller IC L293D. Each motor has his own motor controller. Each motor controller is then connected to ouput ports on a RaspberryPI 2 model B:

The raspberry has a large battery and a Wifi adapter so the car can drive wireless  On the raspberry I created a small script that listens to the Internet of Things service of HCP. Every time the script receives a message it will start the right motor in the right direction depending on the content of the message. You can find a python example of this on the IoT starter kit:

iot-starterkit/src/code-snippets/python/hcp-iot-services/wss at master · SAP/iot-starterkit · GitHub

More details about the raspberry pi: HANA Car v1.0 – Raspberry Pi

HANA Cloud Platform – Internet of Things

In the IoT service I configured one device and one messagetype.  For the direction of the messagetype I’ve chosen “bidirectional”. This is important if you want to use the websocket for the communication. With a websocket you don’t have to use polling to get new messages. A websocket will automatically inform you when there’s a new message for that device. In the case of the HANA car the response time is very important. For that reason I’ve chosen to use the websocket of the IoT service.

More information about the IoT part: HANA Car v1.0 - Internet of Things configuration

Webapp

For controlling the car I created a UI5 app. With JavaScript it isn’t possible to communicate to the IoT websocket directly. I suppose this is due to security. To avoid this I created a Java Servlet which I actually downloaded from the IoT starterkit:

iot-starterkit/src/apps/java/consumption at master · SAP/iot-starterkit · GitHub

I replaced the existing UI in the Java project with a simple joystick for controlling the car. Each move with the joystick will send the direction to the Java Servlet. The Java Servlet will in his turn forward the message to the IoT service. The IoT service will send the message to the raspberry and he will start the right motor.

This is how the webapp looks like: (Thanks to jonas.vanderkelen for the UI5 app)


More details about the Java Webapp:  HANA Car v1.0 – Java Webapp

Demo

Together with a friend/colleague I’ve presented the HANA Car at SAP Inside Track Frankfurt. Thanks a lot to jeremy.coppey3 for making the beautiful presentation! You canfind the presentation at Hana Car by Jérémy Coppey on Prezi


The organization of sitFRA also created a small movie of the car:


Tweet: https://twitter.com/CBasis/status/708661853279416322


Thanks christian.braukmller for the video!


The HANA Car:


Next steps:

I'm planning to add a camera to the car so I can drive the car without being in the same place and still see where I'm driving :smile:

Also want to add additional sensors to gathering information and scanning the environment around the car and store it in HCP.

Hope this blog will inspire you to do more stuff with IoT on HCP :smile:

Kind regards,

Wouter

7 Comments
Labels in this area