Web Interface for RaspiMower

A web interface that I can access from my phone is the ideal solution to control my robot. I choose to use Apache and PHP for this as I am most familiar with it but you can easily use Nginx as an alternative to Apache if you like.

One of the key things I needed was simple inter-process communication, and I choose to use memcached for this as it would not only allow inter-process, but multiple computer communication if necessary.

Goals:

  • 1. The web page needs to display the live video stream from the Pi, and also send commands to the robot control program.
  • 2. The c++ control program needs to be able to receive commands from the web server and send status information back to the web server.
  • 3. If an extra Raspberry Pi will be used for image processing and A.I., it needs to be able to talk to the first Raspberry Pi easily. (I have used memcached before with fantastic results for coordinating multiple web servers, so I figured it would work great here as well)

Install apache, and php and memcached using the following command:

$ sudo apt-get install apache2 php5 libapache2-mod-php5 memcached

If you grab the latest version of RaspiMower from https://bitbucket.org/ronostafichuk/raspimower you will find the c++ program modified to talk to memcached. The web page code ‘index.php’ and ‘ajax.php’ have been added to the repository as well, but you will need to copy it to /var/www so it will work.

I have removed the raspicam functionality from the control program as it was too much load on the process and caused large delays in the control of the motion (very bad). I could have solved this with threading, but after finding a great video streaming solution, I no longer needed to.

The resulting Web page should look like this:
DalekWebUI

I removed the old Raspi Mk1 from my robot and installed the camera and the Raspberry Pi Mk2. Here is a link to the Video. YouTube Video of Dalek with Pi Mk2 and camera