Why sPiRobot ?
If you are following my blog I always use Arduino Board to make my projects, but for this I use Raspberry Pi as a brain of my Robot. That’s the reason I called this “PiRobot”.
1x Raspberry Pi
1x USB wifi Dongle
1x 4Gb Memory Card (Raspberry Pi)
1x Micro Usb Cable to power Pi (Raspberry Pi)
1x 9v Battery
1x H-Bridge / L293d Motor Driver
1x HDMI / AV Video Monitor ( Raspberry Pi)
1x Keyboard-Mouse( Raspberry Pi)
Setting up your Raspberry Pi :
First we will setup our Raspberry Pi and then use it with Robot. Initially we will use Micro USB cable to power up our Pi.
After getting Raspberry Pi you need SD Card which has desired OS. You will find lots of blogs and links about making SD card for Raspberry Pi. You can follow any of them to make your own SD Card, but if you want, you can check out this link. This has vary good start up guide for Raspberry Pi. If you are following this guide then after completing all the setup skip to next step.
As you are ready with your Raspberry Pi and SD Card connect it with any HDMI / AV display, connect keyboard and mouse with it, connect USB wifi dongle with it & connect Micro USB cable to power up our Pi. Usually I connect Micro USB cable with my laptop to power Rasbperry Pi.
Note : Choose vary good Micro USB cable to power up your Pi.
Installation of desired packages ?
Open Lx-Terminal / Terminal in Raspberry Pi and type following command.
$ sudo apt-get update $ sudo apt-get install libv4l-dev libjpeg8-dev subversion imagemagick libapache2-mod-php5 php5 apache2 git
This will install all required packages.
Now connect your USB Webcam with Pi.
To stream our webcam output we will use MPEG-STREAM package.
Open terminal & checkout mpeg-stream repo by typing following command in terminal.
svn co https://svn.code.sf.net/p/mjpg-streamer/code/ MJPG-streamer
After this you will get MJPG-streamer folder.
$ cd MJPG-streamer/mjpg-streamer $ sudo make USE_LIBV4L2=true
This will generate some executable and shared libraries in this folder. This folder should contain,
1) mjpg_streamer (binary)
Cross check by opening this MJPG-streamer/mjpg-streamer folder.
Get Codes for this project ?
Execute following command in your terminal window to get all the codes related to this project.
$ git clone https://github.com/sohil4932/sPiRobot
As you are done with cloning you will get one folder “sPiRobot”. This folder contain all the server related codes.
Move your codes into Server Folder ?
Now you should copy all the server codes to “/var/www” (apache server ) folder. For that you can execute following command into terminal.
$ cd sPiRobot $ sudo cp backward.sh control.html forward.sh help_steuerkreuz.png index.html init.sh left.sh right.sh spirobot.php shutdown.sh stop.sh /var/www/
@Most important command.
Now if you want to use GPIOs from server files you need to add “www-data” user to shouders group, for that execute following command as soon as you copy all the files into /var/www folder.
$ sudo echo "www-data ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
Get IP Address of you Pi ?
As per our guidelines, we need wifi dongle to connect our Pi with wifi router. After connecting wifi dongle to PI , open Wi-Config application(you can find this application pre installed in raspbian OS) & connect your PI with your wifi router. If your Pi is already connected with your wifi router, execute following command into terminal to know your IP Address.
you will find IP address of your Pi in output. Do remember this IP Address for future use also. You will need it control your Robot.