Chapter 9 – developing a web-interface for the RaPi car:
This chapter is about the developing of a web-interface to control the robot with a smartphone over the internet. The interface has as background the live video stream from the Raspberry Pi car camera to see where the car is moving to. I implemented the buttons left/right, forward/backward and stop as an overlay over the live video stream. The stop button in the middle of the control field stops the motors.
I searched for the best frameworks in the internet which uses Python and supports a HTML site to control the car. I decided to use WebIOPI 0.7. This frameworks works best for my idea and I was able to implement the web-interface very fast and easy.
I used the following components for the web-interface:
WebIOPi 0.7: Homepage
Video Stream mjpg-streamer: Video Stream HowTo
This is a picture of my Samsung Galaxy S5 with the active web-interface and the RaPi car in the background.
WebIOPi 0.7 – installation:
It is very easy to install WebIOPi on the Raspberry Pi. You have to download the WebIOPi file from the WebIOPi homepage and extract the file. After this you have to install WebIOPi and that is it. To do so you need a few commands I listed here:
The command to extract the WebIOPi tar file:
tar zxvf WebIOPi-0.7.0.tar.gz
Now you have to change the directory to the folder where the WebIOPi files are extracted to.
With the next command you will install WebIOPi on your Raspberry Pi:
sudo python setup.py install
Now WebIOPi is available and can be used.
If this was to short the homepage from WebIOPi has lots of HowTo papers and explanations.
E-Book – build a remote controlled robot with a Raspberry Pi
With this e-book you can create step by step, your unique remote controlled car. The interaction of hardware, electronics and software are explained with the help of concrete examples. This makes it easy to understand the more complex parts of the project.
The e-book is available as PDF.
The e-book costs 14.90 USD inkl. 19% VAT. (Germany).
When ordering from other countries the gross price may vary since then other VAT rates apply.
Python Script – RaPi car control:
This is my Python script I use for the web-interface version of my robot control script. It is the first version, not very nice but it works:
This is the little HTML site I developed as interface. This is the version shown in the picture above.
HTML site: rapi_car
Update 12.09.2014 – New web-interface
I updated the version with nice arrows pictures for the direction buttons. The picture is a screenshot from my Galaxy S5:
The Python script with the latest user inteface is available here for download: Python_Script_Web_Buttons
The Python script is located in the folder /rapi_car/python/ on my Raspberry Pi car.
The HTML files for the new user interface are available here for download: html_files_Web_Buttons
The HTML files are saved in the following folder: /usr/share/webiopi/htdocs/
Video of my robot car:
I did a new video from my RaPi car with the latest version of the web-interface. In this video I tried for the second time to control the car with the Smartphone. Not everything works perfect but it works and this is very cool. I should increase the value for the acceleration as you see in the video I have to press the button very often.
With the web-interface it makes much for fun to control the car as with the keyboard script version. Now I have the possibility to control the car over the internet over many miles. This opportunity opens room for new ideas what you can do with such car in combination with an easy to use web-interface. The range restriction known from radio controlled model cars no longer exist.
Chapter 1: Raspberry Pi WIFI radio controlled rc vehicle – introduction
Chapter 2: Raspberry Pi WIFI radio controlled rc vehicle – component list
Chapter 3: Raspberry Pi WIFI radio controlled rc vehicle – chassis
Chapter 4: Raspberry Pi WIFI radio controlled rc vehicle – wiring
Chapter 5: Raspberry Pi WIFI radio controlled rc vehicle – software installation
Chapter 6: Raspberry Pi WIFI radio controlled rc vehicle – power supply
Chapter 7: Raspberry Pi WIFI radio controlled rc vehicle – programing
Chapter 8: Raspberry Pi WIFI radio controlled rc vehicle – live video streaming
Chapter 9: Raspberry Pi WIFI radio controlled rc vehicle – web-interface and smartphone
Chapter 10: Raspberry Pi WIFI radio controlled rc vehicle – cooling with passive heat sinks
Chapter 11: Raspberry Pi WIFI radio controlled rc vehicle – startup scripts
Chapter 12: Raspberry Pi WIFI radio controlled rc vehicle – cardboard car model
Chapter 13: Raspberry Pi WIFI radio controlled rc vehicle – power consumption