HCP IoT HANA Car v1.0
|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|
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:
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).
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:
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
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
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:
Thanks Christian Braukmüller for the video!
The HANA Car:
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 🙂