Wifi controlled Raspberry Pi robot

I will document my journey to build a wifi controlled Raspberry Pi robot here. This post will be updated as and when I have progress on the project.

Desirable features:
- controllable via wifi
- Web interface to control the robot.
- movable using 4 wheels
- has a display (16×2 LCD display is sufficient)
- has a webcam for live feed
- webcam can be rotated for capture at different angles
- run on battery

Nice to have features:
- Mobile interface to control the robot
- a speaker for robot to “talk” (text sent via the website command, then robot speaks using TTS ?)
- a microphone for interaction with human (other people speaks to the robot, and I can hear back at the website command?)
- object tracking: robot is able to track moving objects and follows that object

Hardware Components:
- Raspberry Pi, Model B
- Wifi dongle
- 16×2 LCD display – USD $5
- PCB boards
- 4 wheels DC motors – USD $16
- USB webcam / Piwebcam
- Servo motor – USD $5.15

- Breadboard
- Dupont cables
- PCB boards
- Solid core cable – US $2.95

Optional Tools
- Raspberry Pi GPIO Cobbler extension – USD $8
- Pin header – USD $1.5
- Breadboard power supply – USD $1.5

Considering power bank for Raspberry Pi

I am in need of a suitable battery pack to power my Raspberry Pi and all its peripherals. This entry is to list down any considerations made along the way :
Remember RaspPi runs at 5V, hence input power is required to provide a steady 5V stream, more and you may destroy the Pi, less and the Pi will start to behave wildly.

A Raspberry Pi needs 5V with 700 mA, meaning it has a consumption of 3.5 Watt.
Note that consumption indicates a maximum value because it can never get more power that the indicated consumption.

(1) Buy an off-the-shelf power bank. A useful article to decide on which power bank to buy : FB don’t buy power bank until you read this

(2) Use AA batteries with UBEC-Universal Battery Eliminator Circuit, which essentially is a switch mode voltage regulator .

Set up a live webcam streamer on Raspberry Pi

I used Motion as the camera live streamer. Found a great short and comprehensive guide for the setup here.

To keep long story short, these are the important commands:

  1. sudo apt-get install motion
  2. sudo nano /etc/motion/motion.conf
    => in the config file, change these values :
    Daemon = OFF to ON
    webcam_localhost = ON to OFF
    minimum_motion_frames 5 to 2999
    (changing minimum_motion_frames to avoid Motion to capture exessive screenshots whenever movement is detected. I only need the live stream camera function.
    Btw, your screen captures are stored in /tmp/motion )
  3. sudo nano /etc/default/motion
    Then change the value “start_motion_daemon=no” to “yes”
  4. sudo service motion start
  5. Access at : http://[pi ip address]:8081
    I accessed ok using Firefox. Chromes doesnot work for some reason.

Settings in my Raspberry pi /etc/network/interfaces

pi@raspberrypi ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback

#allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static

#auto eth0
#iface eth0 inet static
# Your static IP

Frequently used Unix / Raspberry Pi commands (I kinda mix them up in this single post)

ps ax | grep vnc search for process which name contains “vnc” in all running processes
cat /etc/rc.local this file defines the commands at startup
crontab -l list user’s crontab.
crontab -e edit user’s crontab. You can use crontab to define autoscript at bootup
Simply add an entry starting with @reboot
eg. @reboot sleep 180; sh ~/startupscript.sh #after bootup, wait for 3minutes then run startupscript.sh
kill -9 1234 kill the running process which id is 1234
tightvncserver start tightVNC server
cat /etc/network/interfaces view network information pre-configured on raspberry pi
wpa_passphrase [yourSSID] [yourpassword] to generate an entry for your wifi ssid and password.
You then take this entry and set in /etc/wpa_supplicant/wpa_supplicant.conf
sudo shutdown -ht 0 now shutdown pi and halt after shutdown
sudo /etc/init.d/networking restart restart network, to take new settings into effect
lsusb view all connecting devices via USB
sudo service [service_name] start start a service
sudo service [service_name] stop stop a service

Why are Java applications blocked by your security settings, and How do you bypass that

This is an article written by Oracle, hosted here

I face this issue in my work and this guide came to the rescue.
As part of my job, I frequently need to remote into UAT servers, hosted on a secured network, via a Java web interface. Things have been working well until the latest update of JRE to version 7 update 51. Since then, I have been always prompted with an error saying “Missing Application-Name manifest attribute for:” and the connection cannot be established.
From this Oracle article I realize the error is because the aforementioned web program is Self signed. No hush, this is an Intranet program and provided by my trusted partner so I am willing to run this program, and accept its “risk”.
Now, what I need to do is adding the URL into an Exception Site List so Java doesn’t strictly block anything coming from this site.
Here is the guide, copy here for reference :


It is highly recommended not to run these kind of applications, however if you still want to run, run only if you understand risk and implications involved.
As a workaround, the user can use Exception Site list feature to run the applications blocked by security settings. By adding the URL of the blocked application to the Exception Site list allows it to run with some warnings.

Steps to Add URL to the Exception Site list:
- Go to the Java Control Panel (On Windows Click Start and then Configure Java)
- Click on the Security tab
- Click on the Edit Site List button
- Click the Add in the Exception Site List window
- Add url to Exception Site list
Click in the empty field under Location field to enter the URL
Example: http://www.example.com
( URL should begin with http:// or https://)

If the URL where the applet is hosted is different than the URL for the page on which the applet is called you need to add both the URL for the applet.
Example: For Yahoo games Checkers (This is just an example the host url can be different for depending on which host is serving the game), enter:
http://www.games.yahoo.com and (This is the url for Yahoo games domain)
http://yog36.games.sp2.yahoo.com (This is the url where game is the hosted and is shown in the dialog box for blocked application)

- Click OK to save the URL that you entered.
- Click Continue on the Security Warning dialog