Skip to Content
Author's profile photo Wouter Lemaire

HCP IoT HANA Car v1.0

Description Hyperlink
Overview HCP IoT HANA Car v1.0
Internet of Things configuration HANA Car v1.0 – Internet of Things configuration
UI5 Java Webapp HANA Car v1.0 – Java Webapp
The Car with raspberry Pi HANA 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 🙂 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).

full picture.png

Car

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

/wp-content/uploads/2016/04/car_921348.jpg

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:

/wp-content/uploads/2016/04/raspberry_921349.jpg

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)


/wp-content/uploads/2016/04/pic2_921356.png

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 Jérémy Coppey 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 Braukmüller for the video!


The HANA Car:


/wp-content/uploads/2016/04/pic3_921357.png

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 🙂

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 🙂

Kind regards,

Wouter

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Huseyin Dereli
      Huseyin Dereli

      I have seen it live 🙂 Really cool project!

      It's ready to be used at the next James Bond movie 😎 Powered by HANA.

      Congrats.

      Author's profile photo Former Member
      Former Member

      Great to see the car driving through the office! I wonder if James Bond got the memo..

      Author's profile photo Nick Warren
      Nick Warren

      Great post / project. Thanks for sharing!

      Author's profile photo Former Member
      Former Member

      Great post. I wanted to try it out. Is there a code shared for this?

      Author's profile photo Wouter Lemaire
      Wouter Lemaire
      Blog Post Author

      Hi Sonali,

      For the WebApp I started from this example: https://github.com/SAP/iot-starterkit/tree/master/src/apps/java/consumption

      The code on the raspberry: HANA Car v1.0 – Raspberry Pi

      Kind regards,

      Wouter

      Author's profile photo Former Member
      Former Member

      Thanks Wouter!

      Author's profile photo Emmanuel Da Costa
      Emmanuel Da Costa

      Good job.

      Very Impressive.

      Regards

      Emmanuel