How to set up a Raspberry Pi tank with live stream and wifi control

At the end of the tutorial you will come up with something similar to this:

STEP1 Installing a webserver.

For this project we will use apache2 with the php extension. The apache server will host the html side that will be displayed to the user and the php server will execute the commands on our pi (like ‘gpio write 0 1’).

1.Step (receive the necessary packages:

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

2.Step (restart the webserver):

>sudo service apache2 restart

3.Step Varify that everything is working:

Open a browser on a different device in your local and enter the address of the pi. If you don't know the current address you can run the ifconfig command.

STEP2 Installing a ftp-server (Proftpd).

This step is necessary if you want to transfer your html/JavaScript/php easily to your pi by using an ftp client like filezilla.

1.Step getting the nessary software:

sudo apt-get install proftpd

2.Step Choose run proftpd as Standalone

3.Step The proftpd package now needs to be adjusted to our needs:

sudo nano /etc/proftpd/proftpd.conf

4.Step We will add a virtual user called piftp thats why you have to add the following lines to the proftpd.conf file

DefaultRoot ~
AuthOrder              mod_auth_file.c  mod_auth_unix.c
AuthUserFile /etc/proftpd/ftpd.passwd
AuthPAM off
RequireValidShell off

5.Step Before we can add our new user we need to change to the proftpd directory

cd /etc/proftpd/

6.Step Adding the new user (mine is called piftp). This command will also add the user to the group www-data (gid 33). Note After you entered the comment you will be asked for the password of the new user

sudo ftpasswd --passwd --name piftp --uid 33 --gid 33 --home /var/www/ --shell /bin/false

7.Step change the access rights to allow the piftp user to upload to the /var/www/ directory.

chmod g+s /var/www
chmod 775 /var/www
chown -R www-data:www-data /var/www

Last Step: Restart the Server

sudo /etc/init.d/proftpd restart

You should now be able to upload a file with an ftp client to your pi. The server address is the address of your pi. The port is 20, the user piftp and the password is the one that you entered in Step 6.

STEP 3 Installing the PiCam with mjpeg streamer.


# Make a new directory and change it.
sudo mkdir /opt/mjpg-streamer
cd /opt/mjpg-streamer/

# Install all the required packages
sudo apt-get install libjpeg8-dev
sudo apt-get install imagemagick
sudo apt-get install subversion

# Download MJPG Streamer into your active directory
sudo svn co .

# Compile it by running the make command
sudo make

STEP 4 Add the following script to you home directory, to automatically start the PiCam stream.

sudo nano
sudo nano /etc/rc.local

Add the following line:

After rebooting you should see the a red light at the camera lens. Further if you insert you pi’s ip-address + Port number (in my case 8080) into a browser on the same network, you should be now able to see the pictures of the camera.

STEP 5 Clone the code from github to your web-directory

Change to the the web directory

cd /var/www/

Clone the directory (You may need to install git)

git clone

Now we are finished with the software part thats why I would suggest to move on to the hardware.

The hardware

My current GPIO allocation, please mind if you want to use different functions it is necessary to change my suggestion towards your needs. Further note, not all pi versions have the P5 header.

The motor drivers

My old motor controller board


Schematic PiTruck

My new motor controller board



One thought on “How to set up a Raspberry Pi tank with live stream and wifi control

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s